Showing 160 of 330 total issues
Function eng_num
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def eng_num(val: float) -> Tuple[float, str]:
"""Convert a number to engineering notation by returning number and prefix."""
if np.array(val).size > 1:
return np.array(val), ""
if np.isnan(val):
- 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 log_parameters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def log_parameters(self, evaluation, optim_status):
if self.store_better_iterations_only:
if optim_status["goal"] > self.best_iteration:
return
else:
- 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
Consider simplifying this complex logical expression. Open
if isinstance(data, dict):
return {str(k): jsonify_list(v) for k, v in data.items()}
elif isinstance(data, list):
return [jsonify_list(v) for v in data]
elif isinstance(data, tuple):
Function RB
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def RB(
Function get_Lindbladian
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_Lindbladian(self, dims):
"""
Compute the Lindbladian, based on relaxation, dephasing constants and finite
temperature.
- 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 grid2D
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def grid2D(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
"""
Two dimensional scan of the function values around the initial point.
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 __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self, value, unit="undefined", min_val=None, max_val=None, symbol=r"\alpha"
):
pref = 1.0
value = np.array(value)
- 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 initialise
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialise(self, drift_ham, lindbladian=False, init_temp=None):
"""
Prepare the initial state of the system. At the moment finite temperature requires open system dynamics.
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 orbit_infid
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def orbit_infid(
Function tf_batch_propagate
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def tf_batch_propagate(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function state_transfer_infid_set
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def state_transfer_infid_set(
Function leakage_RB
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def leakage_RB(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function ode_solver
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ode_solver(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function set_ideal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_ideal(self, ideal):
if ideal is not None:
self.ideal = ideal
else:
gate_list = []
- 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 __topological_ordering
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __topological_ordering(self, predecessors: Dict[str, List[str]]) -> List[str]:
"""
Computes the topological ordering of a directed acyclic graph.
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 ode_solver_final_state
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ode_solver_final_state(