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

Moving group of lint rules #12315

Merged
merged 8 commits into from
Jun 10, 2024
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ disable = [
"too-many-lines", "too-many-branches", "too-many-locals", "too-many-nested-blocks", "too-many-statements",
"too-many-instance-attributes", "too-many-arguments", "too-many-public-methods", "too-few-public-methods", "too-many-ancestors",
"unnecessary-pass", # allow for methods with just "pass", for clarity
"unnecessary-dunder-call", # do not want to implement
"no-else-return", # relax "elif" after a clause with a return
"docstring-first-line-empty", # relax docstring style
"import-outside-toplevel", "import-error", # overzealous with our optionals/dynamic packages
Expand All @@ -217,17 +218,13 @@ disable = [
# TODO(#9614): these were added in modern Pylint. Decide if we want to enable them. If so,
# remove from here and fix the issues. Else, move it above this section and add a comment
# with the rationale
"arguments-renamed",
"consider-using-enumerate",
"consider-using-f-string",
"no-member",
"no-value-for-parameter",
"no-member", # for dynamically created members
"not-context-manager",
"possibly-used-before-assignment",
"unexpected-keyword-arg",
"unnecessary-dunder-call",
"unnecessary-lambda-assignment",
"unspecified-encoding",
"unnecessary-lambda-assignment", # do not want to implement
"unspecified-encoding", # do not want to implement
]

enable = [
Expand Down
2 changes: 1 addition & 1 deletion qiskit/primitives/backend_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _transpile(self):
transpiled_circuit = common_circuit.copy()
final_index_layout = list(range(common_circuit.num_qubits))
else:
transpiled_circuit = transpile(
transpiled_circuit = transpile( # pylint:disable=unexpected-keyword-arg
common_circuit, self.backend, **self.transpile_options.__dict__
)
if transpiled_circuit.layout is not None:
Expand Down
2 changes: 1 addition & 1 deletion qiskit/primitives/backend_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _transpile(self):

start = len(self._transpiled_circuits)
self._transpiled_circuits.extend(
transpile(
transpile( # pylint:disable=unexpected-keyword-arg
self.preprocessed_circuits[start:],
self.backend,
**self.transpile_options.__dict__,
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __copy__(self):

The returned option and validator values are shallow copies of the originals.
"""
out = self.__new__(type(self))
out = self.__new__(type(self)) # pylint:disable=no-value-for-parameter
out.__setstate__((self._fields.copy(), self.validator.copy()))
return out

Expand Down
2 changes: 1 addition & 1 deletion qiskit/transpiler/basepasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __eq__(self, other):
return hash(self) == hash(other)

@abstractmethod
def run(self, dag: DAGCircuit): # pylint: disable=arguments-differ
def run(self, dag: DAGCircuit): # pylint:disable=arguments-renamed
"""Run a pass on the DAGCircuit. This is implemented by the pass developer.

Args:
Expand Down
6 changes: 3 additions & 3 deletions qiskit/transpiler/passmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _finalize_layouts(self, dag):
self.property_set["layout"] = t_initial_layout
self.property_set["final_layout"] = new_final_layout

def append(
def append( # pylint:disable=arguments-renamed
self,
passes: Task | list[Task],
) -> None:
Expand All @@ -153,7 +153,7 @@ def append(
"""
super().append(tasks=passes)

def replace(
def replace( # pylint:disable=arguments-renamed
self,
index: int,
passes: Task | list[Task],
Expand All @@ -167,7 +167,7 @@ def replace(
super().replace(index, tasks=passes)

# pylint: disable=arguments-differ
def run(
def run( # pylint:disable=arguments-renamed
self,
circuits: _CircuitsT,
output_name: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/test_unitary.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_qobj_with_unitary_matrix(self):
class NumpyEncoder(json.JSONEncoder):
"""Class for encoding json str with complex and numpy arrays."""

def default(self, obj):
def default(self, obj): # pylint:disable=arguments-renamed
if isinstance(obj, numpy.ndarray):
return obj.tolist()
if isinstance(obj, complex):
Expand Down
2 changes: 1 addition & 1 deletion test/python/compiler/test_transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2864,7 +2864,7 @@ def max_circuits(self):
def _default_options(cls):
return Options(shots=1024)

def run(self, circuit, **kwargs):
def run(self, circuit, **kwargs): # pylint:disable=arguments-renamed
raise NotImplementedError

self.backend = FakeMultiChip()
Expand Down