Showing 157 of 209 total issues
Function build
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build(self, add_variable_constraints=False):
"""Build the problem instance.
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_root
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_root() -> str:
"""Get the project root directory.
We require that all commands are run from the project root, i.e. the
directory that contains setup.py, setup.cfg, and versioneer.py .
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function primal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def primal(self):
if getattr(self, "problem", None) is not None and self.problem.status == interface.OPTIMAL:
if self.lb is not None:
primal = self.lb + self.problem.problem.get_constraint_slack(self.lower_constraint_name)
return primal
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _constraint_lb_and_ub_to_cplex_sense_rhs_and_range_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _constraint_lb_and_ub_to_cplex_sense_rhs_and_range_value(lb, ub):
"""Helper function used by Constraint and Model"""
if lb is None and ub is None:
raise Exception("Free constraint ...")
elif lb is None:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function objective
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def objective(self, value):
value.problem = None
if self._objective is not None:
variables = self.objective.variables
for variable in variables:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _constraint_lb_and_ub_to_gurobi_sense_rhs_and_range_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _constraint_lb_and_ub_to_gurobi_sense_rhs_and_range_value(lb, ub):
"""Helper function used by Constraint and Model"""
if lb is None and ub is None:
raise Exception("Free constraint ...")
elif lb is None:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return {"type": "Number", "value": float(expr)}
Avoid too many return
statements within this function. Open
return {"type": "Number", "value": int(expr)}
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return symbolics.sympify(expr["value"])
Avoid too many return
statements within this function. Open
return symbolics.Symbol(expr["name"])
Avoid too many return
statements within this function. Open
return is_quad
Avoid too many return
statements within this function. Open
return {"type": "Number", "value": expr}
Avoid too many return
statements within this function. Open
return {"version": "0+unknown", "full-revisionid": None,
Avoid too many return
statements within this function. Open
return poly.is_quadratic
Avoid too many return
statements within this function. Open
return {"version": "0+unknown", "full-revisionid": None,
Function __setstate__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __setstate__(self, state):
for key, val in state.items():
if key != "tolerances":
setattr(self, key, val)
for key, val in state["tolerances"].items():
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function coefficient_dict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def coefficient_dict(self):
if self.expression.is_Add:
coefficient_dict = {variable: coef for variable, coef in
self.expression.as_coefficients_dict().items() if variable.is_Symbol}
elif self.expression.is_Atom and self.expression.is_Symbol:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function objective
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def objective(self, value):
value.problem = None
if self._objective is not None: # Reset previous objective
self.problem.obj_linear_coefs = dict()
self.problem.obj_quadratic_coefs = dict()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"