Skip to content

Commit 0666228

Browse files
authored
Update pylint to version 3.0 (#1310)
* Remove leading `_` from type alias (since it is type annotations it is effectively a public name) * Disable the cyclic import checker. By its definition, we do have cyclic imports. pylint seems not to find them when using multiple processes but it does find them when using a single process. * Remove default parallelism from tox pylint runs and from the CI run * Move `posargs` from black to pylint in the tox lint commands so that parallelism can be used optionally
1 parent 12a71b9 commit 0666228

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

.pylintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ disable=fixme, # disabled as TODOs would show up as warnings
7070
no-else-return, # relax "elif" after a clause with a return
7171
docstring-first-line-empty, # relax docstring style
7272
import-outside-toplevel,
73+
cyclic-import, # This checker raises on all module pairs that import each other,
74+
# even submodules that only import already loaded objects from a
75+
# parent module, a common pattern in qiskit-experiments.
7376
assigning-non-slot # https://github.com/Qiskit/qiskit-terra/pull/7347#issuecomment-985007311
7477

7578

qiskit_experiments/framework/experiment_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _repr_svg_(self):
196196
return None
197197

198198

199-
_FigureT = Union[str, bytes, MatplotlibFigure, FigureData]
199+
FigureT = Union[str, bytes, MatplotlibFigure, FigureData]
200200

201201

202202
class ExperimentData:
@@ -1134,7 +1134,7 @@ def data(
11341134
@do_auto_save
11351135
def add_figures(
11361136
self,
1137-
figures: Union[_FigureT, List[_FigureT]],
1137+
figures: Union[FigureT, List[FigureT]],
11381138
figure_names: Optional[Union[str, List[str]]] = None,
11391139
overwrite: bool = False,
11401140
save_figure: Optional[bool] = None,

requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
black~=22.0
22
stestr
3-
pylint~=2.16.2
4-
astroid~=2.14.2 # Must be kept aligned to what pylint wants
3+
pylint~=3.0.2
4+
astroid~=3.0.1 # Must be kept aligned to what pylint wants
55
jinja2==3.0.3
66
sphinx>=6.2.1,<=7
77
jupyter-sphinx>=0.4.0
@@ -20,4 +20,4 @@ coverage>=5.5
2020
ipykernel<=6.21.3
2121
jupyter-client<=8.0.3
2222
ipython<8.13.0 ; python_version<"3.9" # for python 3.8 compatibility
23-
sphinx-remove-toctrees
23+
sphinx-remove-toctrees

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ commands = stestr run {posargs}
5151
[testenv:lint]
5252
envdir = .tox/lint
5353
commands =
54-
black --check {posargs} qiskit_experiments test tools setup.py
55-
pylint -rn -j 0 --rcfile={toxinidir}/.pylintrc qiskit_experiments/ test/ tools/
54+
black --check qiskit_experiments test tools setup.py
55+
pylint -rn {posargs} --rcfile={toxinidir}/.pylintrc qiskit_experiments/ test/ tools/
5656
python {toxinidir}/tools/verify_headers.py
5757

5858
[testenv:lint-incr]
@@ -62,7 +62,7 @@ allowlist_externals = git
6262
commands =
6363
black --check {posargs} qiskit_experiments test tools setup.py
6464
-git fetch -q https://github.com/Qiskit-Extensions/qiskit-experiments :lint_incr_latest
65-
python {toxinidir}/tools/pylint_incr.py -rn -j4 -sn --paths :/qiskit_experiments/*.py :/test/*.py :/tools/*.py
65+
python {toxinidir}/tools/pylint_incr.py -rn {posargs} -sn --paths :/qiskit_experiments/*.py :/test/*.py :/tools/*.py
6666
python {toxinidir}/tools/verify_headers.py qiskit_experiments test tools
6767

6868
[testenv:black]
@@ -105,4 +105,4 @@ commands =
105105
skip_install = true
106106
deps =
107107
allowlist_externals = rm
108-
commands = rm -rf {toxinidir}/docs/stubs/ {toxinidir}/docs/_build
108+
commands = rm -rf {toxinidir}/docs/stubs/ {toxinidir}/docs/_build

0 commit comments

Comments
 (0)