Skip to content

Commit 1f87537

Browse files
mergify[bot]tnemoz
andauthored
Added pylint disables (backport #205) (#206)
Co-authored-by: Tristan NEMOZ <36485441+tnemoz@users.noreply.github.com>
1 parent 7f3f1ef commit 1f87537

36 files changed

+77
-39
lines changed

qiskit_algorithms/amplitude_amplifiers/amplification_problem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2021, 2023.
3+
# (C) Copyright IBM 2021, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -29,6 +29,7 @@ class AmplificationProblem:
2929
on the optimal bitstring.
3030
"""
3131

32+
# pylint: disable=too-many-positional-arguments
3233
def __init__(
3334
self,
3435
oracle: QuantumCircuit | Statevector,

qiskit_algorithms/amplitude_estimators/ae_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# pylint: disable=invalid-name
2121

2222

23+
# pylint: disable=too-many-positional-arguments
2324
def bisect_max(f, a, b, steps=50, minwidth=1e-12, retval=False):
2425
"""Find the maximum of the real-valued function f in the interval [a, b] using bisection.
2526

qiskit_algorithms/amplitude_estimators/estimation_problem.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class EstimationProblem:
3131
or a custom Grover operator.
3232
"""
3333

34+
# pylint: disable=too-many-positional-arguments
3435
def __init__(
3536
self,
3637
state_preparation: QuantumCircuit,

qiskit_algorithms/amplitude_estimators/iae.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -47,6 +47,7 @@ class IterativeAmplitudeEstimation(AmplitudeEstimator):
4747
`arXiv:quant-ph/0005055 <http://arxiv.org/abs/quant-ph/0005055>`_.
4848
"""
4949

50+
# pylint: disable=too-many-positional-arguments
5051
def __init__(
5152
self,
5253
epsilon_target: float,

qiskit_algorithms/gradients/spsa/spsa_estimator_gradient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2022, 2023.
3+
# (C) Copyright IBM 2022, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -40,6 +40,7 @@ class SPSAEstimatorGradient(BaseEstimatorGradient):
4040
`doi: 10.1109/TAC.2000.880982 <https://ieeexplore.ieee.org/document/880982>`_
4141
"""
4242

43+
# pylint: disable=too-many-positional-arguments
4344
def __init__(
4445
self,
4546
estimator: BaseEstimator,

qiskit_algorithms/gradients/spsa/spsa_sampler_gradient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2022, 2023.
3+
# (C) Copyright IBM 2022, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -40,6 +40,7 @@ class SPSASamplerGradient(BaseSamplerGradient):
4040
`doi: 10.1109/TAC.2000.880982 <https://ieeexplore.ieee.org/document/880982>`_.
4141
"""
4242

43+
# pylint: disable=too-many-positional-arguments
4344
def __init__(
4445
self,
4546
sampler: BaseSampler,

qiskit_algorithms/minimum_eigensolvers/sampling_vqe.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ def evaluate_energy(parameters: np.ndarray) -> np.ndarray | float:
335335

336336
return evaluate_energy
337337

338+
# pylint: disable=too-many-positional-arguments
338339
def _build_sampling_vqe_result(
339340
self,
340341
ansatz: QuantumCircuit,

qiskit_algorithms/optimizers/adam_amsgrad.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ADAM(Optimizer):
5757
"snapshot_dir",
5858
]
5959

60+
# pylint: disable=too-many-positional-arguments
6061
def __init__(
6162
self,
6263
maxiter: int = 10000,

qiskit_algorithms/optimizers/aqgd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class AQGD(Optimizer):
4949

5050
_OPTIONS = ["maxiter", "eta", "tol", "disp", "momentum", "param_tol", "averaging"]
5151

52+
# pylint: disable=too-many-positional-arguments
5253
def __init__(
5354
self,
5455
maxiter: int | list[int] = 1000,
@@ -179,6 +180,7 @@ def _compute_objective_fn_and_gradient(
179180
gradient = 0.5 * (values[1 : num_params + 1] - values[1 + num_params :])
180181
return obj_value, gradient
181182

183+
# pylint: disable=too-many-positional-arguments
182184
def _update(
183185
self,
184186
params: np.ndarray,

qiskit_algorithms/optimizers/cg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -33,7 +33,7 @@ class CG(SciPyOptimizer):
3333

3434
_OPTIONS = ["maxiter", "disp", "gtol", "eps"]
3535

36-
# pylint: disable=unused-argument
36+
# pylint: disable=unused-argument, too-many-positional-arguments
3737
def __init__(
3838
self,
3939
maxiter: int = 20,

qiskit_algorithms/optimizers/cobyla.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -31,7 +31,7 @@ class COBYLA(SciPyOptimizer):
3131

3232
_OPTIONS = ["maxiter", "disp", "rhobeg"]
3333

34-
# pylint: disable=unused-argument
34+
# pylint: disable=unused-argument, too-many-positional-arguments
3535
def __init__(
3636
self,
3737
maxiter: int = 1000,

qiskit_algorithms/optimizers/gradient_descent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def grad(x):
174174
175175
"""
176176

177+
# pylint: disable=too-many-positional-arguments
177178
def __init__(
178179
self,
179180
maxiter: int = 100,

qiskit_algorithms/optimizers/gsls.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -51,7 +51,7 @@ class GSLS(Optimizer):
5151
"max_failed_rejection_sampling",
5252
]
5353

54-
# pylint: disable=unused-argument
54+
# pylint: disable=unused-argument, too-many-positional-arguments
5555
def __init__(
5656
self,
5757
maxiter: int = 10000,
@@ -131,6 +131,7 @@ def minimize(
131131

132132
return result
133133

134+
# pylint: disable=too-many-positional-arguments
134135
def ls_optimize(
135136
self,
136137
n: int,
@@ -270,6 +271,7 @@ def sample_points(
270271

271272
return points, directions
272273

274+
# pylint: disable=too-many-positional-arguments
273275
def sample_set(
274276
self, n: int, x: np.ndarray, var_lb: np.ndarray, var_ub: np.ndarray, num_points: int
275277
) -> tuple[np.ndarray, np.ndarray]:
@@ -342,6 +344,7 @@ def sample_set(
342344
x + self._options["sampling_radius"] * accepted[:num_points],
343345
)
344346

347+
# pylint: disable=too-many-positional-arguments
345348
def gradient_approximation(
346349
self,
347350
n: int,

qiskit_algorithms/optimizers/l_bfgs_b.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -46,7 +46,7 @@ class L_BFGS_B(SciPyOptimizer): # pylint: disable=invalid-name
4646

4747
_OPTIONS = ["maxfun", "maxiter", "ftol", "iprint", "eps"]
4848

49-
# pylint: disable=unused-argument
49+
# pylint: disable=unused-argument, too-many-positional-arguments
5050
def __init__(
5151
self,
5252
maxfun: int = 15000,

qiskit_algorithms/optimizers/nelder_mead.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -40,7 +40,7 @@ class NELDER_MEAD(SciPyOptimizer): # pylint: disable=invalid-name
4040

4141
_OPTIONS = ["maxiter", "maxfev", "disp", "xatol", "adaptive"]
4242

43-
# pylint: disable=unused-argument
43+
# pylint: disable=unused-argument, too-many-positional-arguments
4444
def __init__(
4545
self,
4646
maxiter: int | None = None,

qiskit_algorithms/optimizers/nft.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2019, 2023.
3+
# (C) Copyright IBM 2019, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -29,7 +29,7 @@ class NFT(SciPyOptimizer):
2929

3030
_OPTIONS = ["maxiter", "maxfev", "disp", "reset_interval"]
3131

32-
# pylint: disable=unused-argument
32+
# pylint: disable=unused-argument, too-many-positional-arguments
3333
def __init__(
3434
self,
3535
maxiter: int | None = None,
@@ -69,7 +69,7 @@ def __init__(
6969
super().__init__(method=nakanishi_fujii_todo, options=options, **kwargs)
7070

7171

72-
# pylint: disable=invalid-name
72+
# pylint: disable=invalid-name, too-many-positional-arguments
7373
def nakanishi_fujii_todo(
7474
fun, x0, args=(), maxiter=None, maxfev=1024, reset_interval=32, eps=1e-32, callback=None, **_
7575
):

qiskit_algorithms/optimizers/p_bfgs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -52,7 +52,7 @@ class P_BFGS(SciPyOptimizer): # pylint: disable=invalid-name
5252

5353
_OPTIONS = ["maxfun", "ftol", "iprint"]
5454

55-
# pylint: disable=unused-argument
55+
# pylint: disable=unused-argument, too-many-positional-arguments
5656
def __init__(
5757
self,
5858
maxfun: int = 1000,

qiskit_algorithms/optimizers/powell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -33,7 +33,7 @@ class POWELL(SciPyOptimizer):
3333

3434
_OPTIONS = ["maxiter", "maxfev", "disp", "xtol"]
3535

36-
# pylint: disable=unused-argument
36+
# pylint: disable=unused-argument, too-many-positional-arguments
3737
def __init__(
3838
self,
3939
maxiter: int | None = None,

qiskit_algorithms/optimizers/qnspsa.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2021, 2023.
3+
# (C) Copyright IBM 2021, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -93,6 +93,7 @@ def loss(x):
9393
9494
"""
9595

96+
# pylint: disable=too-many-positional-arguments
9697
def __init__(
9798
self,
9899
fidelity: FIDELITY,
@@ -184,6 +185,7 @@ def __init__(
184185

185186
self.fidelity = fidelity
186187

188+
# pylint: disable=too-many-positional-arguments
187189
def _point_sample(self, loss, x, eps, delta1, delta2):
188190
loss_points = [x + eps * delta1, x - eps * delta1]
189191
fidelity_points = [

qiskit_algorithms/optimizers/slsqp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -36,7 +36,7 @@ class SLSQP(SciPyOptimizer):
3636

3737
_OPTIONS = ["maxiter", "disp", "ftol", "eps"]
3838

39-
# pylint: disable=unused-argument
39+
# pylint: disable=unused-argument, too-many-positional-arguments
4040
def __init__(
4141
self,
4242
maxiter: int = 100,

qiskit_algorithms/optimizers/spsa.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def __call__(self, nfev, parameters, value, stepsize, accepted) -> bool:
161161
162162
"""
163163

164+
# pylint: disable=too-many-positional-arguments
164165
def __init__(
165166
self,
166167
maxiter: int = 100,
@@ -280,6 +281,7 @@ def __init__(
280281
self._nfev: int | None = None # the number of function evaluations
281282
self._smoothed_hessian: np.ndarray | None = None # smoothed average of the Hessians
282283

284+
# pylint: disable=too-many-positional-arguments
283285
@staticmethod
284286
def calibrate(
285287
loss: Callable[[np.ndarray], float],
@@ -413,6 +415,7 @@ def settings(self) -> dict[str, Any]:
413415
"termination_checker": self.termination_checker,
414416
}
415417

418+
# pylint: disable=too-many-positional-arguments
416419
def _point_sample(self, loss, x, eps, delta1, delta2):
417420
"""A single sample of the gradient at position ``x`` in direction ``delta``."""
418421
# points to evaluate
@@ -478,6 +481,7 @@ def _point_estimate(self, loss, x, eps, num_samples):
478481
hessian_estimate / num_samples,
479482
)
480483

484+
# pylint: disable=too-many-positional-arguments
481485
def _compute_update(self, loss, x, k, eps, lse_solver):
482486
# compute the perturbations
483487
if isinstance(self.resamplings, dict):

qiskit_algorithms/optimizers/tnc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -33,7 +33,7 @@ class TNC(SciPyOptimizer):
3333

3434
_OPTIONS = ["maxiter", "disp", "accuracy", "ftol", "xtol", "gtol", "eps"]
3535

36-
# pylint: disable=unused-argument
36+
# pylint: disable=unused-argument, too-many-positional-arguments
3737
def __init__(
3838
self,
3939
maxiter: int = 100,

qiskit_algorithms/phase_estimators/ipe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2021, 2023.
3+
# (C) Copyright IBM 2021, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -59,6 +59,7 @@ def __init__(
5959
self._num_iterations = num_iterations
6060
self._sampler = sampler
6161

62+
# pylint: disable=too-many-positional-arguments
6263
def construct_circuit(
6364
self,
6465
unitary: QuantumCircuit,

0 commit comments

Comments
 (0)