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

Added pylint disables #205

Merged
merged 3 commits into from
Oct 2, 2024
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2021, 2023.
# (C) Copyright IBM 2021, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -29,6 +29,7 @@ class AmplificationProblem:
on the optimal bitstring.
"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
oracle: QuantumCircuit | Statevector,
Expand Down
1 change: 1 addition & 0 deletions qiskit_algorithms/amplitude_estimators/ae_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# pylint: disable=invalid-name


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class EstimationProblem:
or a custom Grover operator.
"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
state_preparation: QuantumCircuit,
Expand Down
3 changes: 2 additions & 1 deletion qiskit_algorithms/amplitude_estimators/iae.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -47,6 +47,7 @@ class IterativeAmplitudeEstimation(AmplitudeEstimator):
`arXiv:quant-ph/0005055 <http://arxiv.org/abs/quant-ph/0005055>`_.
"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
epsilon_target: float,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2022, 2023.
# (C) Copyright IBM 2022, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -40,6 +40,7 @@ class SPSAEstimatorGradient(BaseEstimatorGradient):
`doi: 10.1109/TAC.2000.880982 <https://ieeexplore.ieee.org/document/880982>`_
"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
estimator: BaseEstimator,
Expand Down
3 changes: 2 additions & 1 deletion qiskit_algorithms/gradients/spsa/spsa_sampler_gradient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2022, 2023.
# (C) Copyright IBM 2022, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -40,6 +40,7 @@ class SPSASamplerGradient(BaseSamplerGradient):
`doi: 10.1109/TAC.2000.880982 <https://ieeexplore.ieee.org/document/880982>`_.
"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
sampler: BaseSampler,
Expand Down
1 change: 1 addition & 0 deletions qiskit_algorithms/minimum_eigensolvers/sampling_vqe.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def evaluate_energy(parameters: np.ndarray) -> np.ndarray | float:

return evaluate_energy

# pylint: disable=too-many-positional-arguments
def _build_sampling_vqe_result(
self,
ansatz: QuantumCircuit,
Expand Down
1 change: 1 addition & 0 deletions qiskit_algorithms/optimizers/adam_amsgrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ADAM(Optimizer):
"snapshot_dir",
]

# pylint: disable=too-many-positional-arguments
def __init__(
self,
maxiter: int = 10000,
Expand Down
2 changes: 2 additions & 0 deletions qiskit_algorithms/optimizers/aqgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class AQGD(Optimizer):

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

# pylint: disable=too-many-positional-arguments
def __init__(
self,
maxiter: int | list[int] = 1000,
Expand Down Expand Up @@ -179,6 +180,7 @@ def _compute_objective_fn_and_gradient(
gradient = 0.5 * (values[1 : num_params + 1] - values[1 + num_params :])
return obj_value, gradient

# pylint: disable=too-many-positional-arguments
def _update(
self,
params: np.ndarray,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/cg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -33,7 +33,7 @@ class CG(SciPyOptimizer):

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int = 20,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/cobyla.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -31,7 +31,7 @@ class COBYLA(SciPyOptimizer):

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int = 1000,
Expand Down
1 change: 1 addition & 0 deletions qiskit_algorithms/optimizers/gradient_descent.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def grad(x):

"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
maxiter: int = 100,
Expand Down
7 changes: 5 additions & 2 deletions qiskit_algorithms/optimizers/gsls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -51,7 +51,7 @@ class GSLS(Optimizer):
"max_failed_rejection_sampling",
]

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int = 10000,
Expand Down Expand Up @@ -131,6 +131,7 @@ def minimize(

return result

# pylint: disable=too-many-positional-arguments
def ls_optimize(
self,
n: int,
Expand Down Expand Up @@ -270,6 +271,7 @@ def sample_points(

return points, directions

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

# pylint: disable=too-many-positional-arguments
def gradient_approximation(
self,
n: int,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/l_bfgs_b.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -46,7 +46,7 @@ class L_BFGS_B(SciPyOptimizer): # pylint: disable=invalid-name

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxfun: int = 15000,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/nelder_mead.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -40,7 +40,7 @@ class NELDER_MEAD(SciPyOptimizer): # pylint: disable=invalid-name

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int | None = None,
Expand Down
6 changes: 3 additions & 3 deletions qiskit_algorithms/optimizers/nft.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2019, 2023.
# (C) Copyright IBM 2019, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -29,7 +29,7 @@ class NFT(SciPyOptimizer):

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int | None = None,
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
super().__init__(method=nakanishi_fujii_todo, options=options, **kwargs)


# pylint: disable=invalid-name
# pylint: disable=invalid-name, too-many-positional-arguments
def nakanishi_fujii_todo(
fun, x0, args=(), maxiter=None, maxfev=1024, reset_interval=32, eps=1e-32, callback=None, **_
):
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/p_bfgs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -52,7 +52,7 @@ class P_BFGS(SciPyOptimizer): # pylint: disable=invalid-name

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxfun: int = 1000,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/powell.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -33,7 +33,7 @@ class POWELL(SciPyOptimizer):

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int | None = None,
Expand Down
4 changes: 3 additions & 1 deletion qiskit_algorithms/optimizers/qnspsa.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2021, 2023.
# (C) Copyright IBM 2021, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -93,6 +93,7 @@ def loss(x):

"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
fidelity: FIDELITY,
Expand Down Expand Up @@ -184,6 +185,7 @@ def __init__(

self.fidelity = fidelity

# pylint: disable=too-many-positional-arguments
def _point_sample(self, loss, x, eps, delta1, delta2):
loss_points = [x + eps * delta1, x - eps * delta1]
fidelity_points = [
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/slsqp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -36,7 +36,7 @@ class SLSQP(SciPyOptimizer):

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int = 100,
Expand Down
4 changes: 4 additions & 0 deletions qiskit_algorithms/optimizers/spsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def __call__(self, nfev, parameters, value, stepsize, accepted) -> bool:

"""

# pylint: disable=too-many-positional-arguments
def __init__(
self,
maxiter: int = 100,
Expand Down Expand Up @@ -280,6 +281,7 @@ def __init__(
self._nfev: int | None = None # the number of function evaluations
self._smoothed_hessian: np.ndarray | None = None # smoothed average of the Hessians

# pylint: disable=too-many-positional-arguments
@staticmethod
def calibrate(
loss: Callable[[np.ndarray], float],
Expand Down Expand Up @@ -413,6 +415,7 @@ def settings(self) -> dict[str, Any]:
"termination_checker": self.termination_checker,
}

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

# pylint: disable=too-many-positional-arguments
def _compute_update(self, loss, x, k, eps, lse_solver):
# compute the perturbations
if isinstance(self.resamplings, dict):
Expand Down
4 changes: 2 additions & 2 deletions qiskit_algorithms/optimizers/tnc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2018, 2023.
# (C) Copyright IBM 2018, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -33,7 +33,7 @@ class TNC(SciPyOptimizer):

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

# pylint: disable=unused-argument
# pylint: disable=unused-argument, too-many-positional-arguments
def __init__(
self,
maxiter: int = 100,
Expand Down
3 changes: 2 additions & 1 deletion qiskit_algorithms/phase_estimators/ipe.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2021, 2023.
# (C) Copyright IBM 2021, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -59,6 +59,7 @@ def __init__(
self._num_iterations = num_iterations
self._sampler = sampler

# pylint: disable=too-many-positional-arguments
def construct_circuit(
self,
unitary: QuantumCircuit,
Expand Down
Loading
Loading