Skip to content

Commit

Permalink
add pylint: disable=too-many-arguments to fix pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TolisChal committed Oct 23, 2024
1 parent 29a679f commit 11bc552
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions qiskit_optimization/algorithms/admm_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
class ADMMParameters:
"""Defines a set of parameters for ADMM optimizer."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
rho_initial: float = 10000,
factor_c: float = 100000,
Expand Down Expand Up @@ -175,7 +175,7 @@ def __init__(self, op: QuadraticProgram, rho_initial: float) -> None:
class ADMMOptimizationResult(OptimizationResult):
"""ADMMOptimization Result."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: np.ndarray,
fval: float,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/algorithms/cobyla_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CobylaOptimizer(MultiStartOptimizer):
>>> result = optimizer.solve(problem)
"""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
rhobeg: float = 1.0,
rhoend: float = 1e-4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GoemansWilliamsonOptimizationResult(OptimizationResult):
values of just one solution. Explore ``samples`` for all possible solutions.
"""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: Optional[Union[List[float], np.ndarray]],
fval: float,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_optimization/algorithms/grover_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
class GroverOptimizer(OptimizationAlgorithm):
"""Uses Grover Adaptive Search (GAS) to find the minimum of a QUBO function."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
num_value_qubits: int,
num_iterations: int = 3,
Expand Down Expand Up @@ -325,7 +325,7 @@ def _bin_to_int(v: str, num_value_bits: int) -> int:
class GroverOptimizationResult(OptimizationResult):
"""A result object for Grover Optimization methods."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: Union[List[float], np.ndarray],
fval: float,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/algorithms/minimum_eigen_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class MinimumEigenOptimizationResult(OptimizationResult):
"""Minimum Eigen Optimizer Result."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: Optional[Union[List[float], np.ndarray]],
fval: Optional[float],
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/algorithms/optimization_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class OptimizationResult:
should maintain the order when generating a new ``OptimizationResult`` object.
"""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: Union[List[float], np.ndarray] | None,
fval: float | None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class IntermediateResult(Enum):
class RecursiveMinimumEigenOptimizationResult(OptimizationResult):
"""Recursive Eigen Optimizer Result."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: Union[List[float], np.ndarray],
fval: float,
Expand Down Expand Up @@ -137,7 +137,7 @@ class RecursiveMinimumEigenOptimizer(OptimizationAlgorithm):
from Symmetry Protection. `arXiv:1910.08980 <http://arxiv.org/abs/1910.08980>`_
"""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
optimizer: OptimizationAlgorithm,
min_num_vars: int = 1,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_optimization/algorithms/slsqp_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SlsqpOptimizationResult(OptimizationResult):
SLSQP optimization result, defines additional properties that may be returned by the optimizer.
"""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
x: Union[List[float], np.ndarray],
fval: float,
Expand Down Expand Up @@ -104,7 +104,7 @@ class SlsqpOptimizer(MultiStartOptimizer):
"""

# pylint: disable=redefined-builtin
def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
iter: int = 100,
acc: float = 1.0e-6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class WarmStartQAOAOptimizer(MinimumEigenOptimizer):
"""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
pre_solver: OptimizationAlgorithm,
relax_for_pre_solver: bool,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/applications/vehicle_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def depot(self, depot: int) -> None:

@staticmethod
# pylint: disable=undefined-variable
def create_random_instance(
def create_random_instance( # pylint: disable=too-many-arguments
n: int,
low: int = 0,
high: int = 100,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/problems/linear_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LinearConstraint(Constraint):
# Note: added, duplicating in effect that in Constraint, to avoid issues with Sphinx
Sense = ConstraintSense

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
quadratic_program: Any,
name: str,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/problems/quadratic_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class QuadraticConstraint(Constraint):
# Note: added, duplicating in effect that in Constraint, to avoid issues with Sphinx
Sense = ConstraintSense

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
quadratic_program: Any,
name: str,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/problems/quadratic_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QuadraticObjective(QuadraticProgramElement):

Sense = ObjSense

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
quadratic_program: Any,
constant: float = 0.0,
Expand Down
16 changes: 8 additions & 8 deletions qiskit_optimization/problems/quadratic_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _add_variable(
key_format = ""
return self._add_variables(1, lowerbound, upperbound, vartype, name, key_format)[1][0]

def _add_variables(
def _add_variables( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int],
Expand Down Expand Up @@ -239,7 +239,7 @@ def _find_name(name, key_format, k):
variables.append(variable)
return names, variables

def _var_dict(
def _var_dict( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int],
Expand Down Expand Up @@ -277,7 +277,7 @@ def _var_dict(
zip(*self._add_variables(keys, lowerbound, upperbound, vartype, name, key_format))
)

def _var_list(
def _var_list( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int],
Expand Down Expand Up @@ -333,7 +333,7 @@ def continuous_var(
"""
return self._add_variable(lowerbound, upperbound, Variable.Type.CONTINUOUS, name)

def continuous_var_dict(
def continuous_var_dict( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int] = 0,
Expand Down Expand Up @@ -367,7 +367,7 @@ def continuous_var_dict(
keys, lowerbound, upperbound, Variable.Type.CONTINUOUS, name, key_format
)

def continuous_var_list(
def continuous_var_list( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int] = 0,
Expand Down Expand Up @@ -494,7 +494,7 @@ def integer_var(
"""
return self._add_variable(lowerbound, upperbound, Variable.Type.INTEGER, name)

def integer_var_dict(
def integer_var_dict( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int] = 0,
Expand Down Expand Up @@ -526,7 +526,7 @@ def integer_var_dict(
"""
return self._var_dict(keys, lowerbound, upperbound, Variable.Type.INTEGER, name, key_format)

def integer_var_list(
def integer_var_list( # pylint: disable=too-many-arguments
self,
keys: Union[int, Sequence],
lowerbound: Union[float, int] = 0,
Expand Down Expand Up @@ -717,7 +717,7 @@ def quadratic_constraints_index(self) -> Dict[str, int]:
"""
return self._quadratic_constraints_index

def quadratic_constraint(
def quadratic_constraint( # pylint: disable=too-many-arguments
self,
linear: Union[ndarray, spmatrix, List[float], Dict[Union[int, str], float]] = None,
quadratic: Union[
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/problems/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Variable(QuadraticProgramElement):

Type = VarType

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
quadratic_program: Any,
name: str,
Expand Down
2 changes: 1 addition & 1 deletion qiskit_optimization/translators/prettyprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _concatenate_terms(terms: List[str], wrap: int, indent: int) -> str:
return buf


def expr2str(
def expr2str( # pylint: disable=too-many-arguments
constant: float = 0.0,
linear: Optional[LinearExpression] = None,
quadratic: Optional[QuadraticExpression] = None,
Expand Down

0 comments on commit 11bc552

Please sign in to comment.