Showing 18 of 20 total issues
Function reduce_model
has a Cognitive Complexity of 50 (exceeds 10 allowed). Consider refactoring. Open
def reduce_model(linear_op, nonlinear_op, coordinates, size_tuple,
control_vars=None):
"""
Simplifies the given system equation.
- 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 _process_constraints
has a Cognitive Complexity of 45 (exceeds 10 allowed). Consider refactoring. Open
def _process_constraints(linear_op,
nonlinear_op,
constraints,
coordinates,
size_tup):
- 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 _builder
has a Cognitive Complexity of 43 (exceeds 10 allowed). Consider refactoring. Open
def _builder(data, model=None, as_name=None):
if not model:
root = "/"
else:
root = model
- 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 _build_relations
has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring. Open
def _build_relations(self):
rels = []
for string in self._constitutive_relations:
iloc = 0
- 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 _update_build_params
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
def _update_build_params(args, build_args, value, **kwargs):
if isinstance(value, (list, tuple)):
assignments = zip(build_args["params"].keys(), 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 _draw
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
def _draw(system, ax, layout=_networkx_layout):
graph = _build_graph(system)
points = layout(graph)
- 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 add_reaction
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def add_reaction(self, reaction,
forward_rates=None, reverse_rates=None, name=""):
"""
Adds a new reaction to the network.
- 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 add
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def add(self, *args):
# Warning: Scheduled to be deprecated
def validate(component):
if not isinstance(component, BondGraphBase):
raise InvalidComponentException("Invalid component class")
- 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 deeply nested control flow statements. Open
if eqn.is_number:
lin_dict.update({(0, dc_idx): eqn})
else:
nlin += eqn * dvc
linear_op = linear_op.col_join(
Function new
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def new(component=None, name=None, library=base_id, value=None, **kwargs):
"""
Creates a new Bond Graph from a library component.
Args:
- 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 swap
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def swap(old_component, new_component):
"""
Replaces the old component with a new component.
Components must be of compatible classes; 1 one port cannot replace an
n-port, for example.
- 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 deeply nested control flow statements. Open
if new_coeff.is_number:
lin_dict.update({(0, idx): new_coeff})
else:
nlin += new_coeff * coordinates[idx]
for idx, coeff in enumerate(cv_derivs):
Function _fetch_ic
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def _fetch_ic(x0, dx0, system, func, t0, eps=0.001):
if isinstance(x0, list):
assert len(x0) == len(system.state_vars)
X0 = np.array(x0, dtype=np.float64)
elif isinstance(x0, 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"
Further reading
Function _connect_complex
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
def _connect_complex(system, species_anchors, junct, stoichiometry,
is_reversed=False):
for i, (species, qty) in enumerate(stoichiometry.items()):
if qty == 1:
- 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 _build_model_data
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _build_model_data(model, templates):
components = []
out = {}
for c in model.components:
if isinstance(c, BondGraph):
- 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 constitutive_relations
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def constitutive_relations(self):
"""See `BondGraphBase`"""
models = self._build_relations()
subs = []
- 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 _build_component_string
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _build_component_string(component):
out_str = f"{component.name} {component.template}"
logger.debug("Trying to serialise: %s", out_str)
try:
- 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 _build_species
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _build_species(self, system, normalised):
if normalised:
param_dict = {"R": 1, "T": 1}
else:
param_dict = {"R": R, "T": self._T}
- 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"