Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycln-fix #396

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ repos:
rev: v2.1.5
hooks:
- id: pycln
args: [--config=pyproject.toml]
args:
- --config=pyproject.toml
- --all
2 changes: 0 additions & 2 deletions src/qibocal/auto/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from qibolab.platform import Platform
from qibolab.qubits import QubitId

from qibocal.config import raise_error

from ..protocols.characterization import Operation
from ..utils import allocate_qubits
from .operation import Data, DummyPars, Qubits, Results, Routine, dummy_operation
Expand Down
2 changes: 1 addition & 1 deletion src/qibocal/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
import pandas as pd
import pint_pandas
import pint_pandas # nopycln: import
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remove that import, several tests fail (I suppose every tests that uses this file).
I am not sure why, but I think that it's implicitly using it with

self._df = pd.DataFrame(
{
"MSR": pd.Series(dtype="pint[V]"),
"i": pd.Series(dtype="pint[V]"),
"q": pd.Series(dtype="pint[V]"),
"phase": pd.Series(dtype="pint[rad]"),
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here our first side effect. Most likely pint_pandas is patching pandas (i.e. replacing some content of the module) upon import.

Luckily, we have #372 :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this is just how pint works for some reason...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wants to be a drop-in replacement of Pandas, that's the reason. But, yeah, I don't like it so much...


from qibocal.config import raise_error

Expand Down
2 changes: 0 additions & 2 deletions src/qibocal/protocols/characterization/rabi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import plotly.graph_objects as go
from plotly.subplots import make_subplots

from qibocal.config import log


def rabi_amplitude_fit(x, p0, p1, p2, p3):
# A fit to Superconducting Qubit Rabi Oscillation
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from pint import DimensionalityError, UndefinedUnitError

from qibocal.data import AbstractData, Data, DataUnits
from qibocal.data import Data, DataUnits


def random_data_units(length, options=None):
Expand Down