File _generic_storage.py
has 1611 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -
"""
GenericStorage and associated individual constraints (blocks) and groupings.
Function _create
has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""Create a storage block for investment modeling"""
m = self.parent_block()
if group is None:
return 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 __init__
has 22 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _objective_expression
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _objective_expression(self):
r"""
Objective expression for storages with no investment.
Note
- 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 _create
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _create(self, group=None):
"""Create a storage block for investment modeling"""
m = self.parent_block()
if group is None:
return None
Function __init__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
label=None,
inputs=None,
outputs=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 __init__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
label=None,
inputs=None,
outputs=None,
Function _evaluate_remaining_value_difference
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _evaluate_remaining_value_difference(
Function _create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""
Parameters
----------
group : 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 _set_flows
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _set_flows(self):
"""Define inflow / outflow as investment flows when they are
coupled with storage capacity via invest relations
"""
for flow in self.inputs.values():
- 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"