Showing 139 of 397 total issues
Function convert_keys_to_strings
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def convert_keys_to_strings(result, keep_none_type=False):
"""
Convert the dictionary keys to strings.
All (tuple) keys of the result object e.g. results[(pp1, bus1)] are
- 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 valid_sequence
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def valid_sequence(sequence, length: int) -> bool:
"""Checks if an object is a numpy array of at least the given length
or an 'emulated' sequence object of class _FakeSequence.
If unset, the latter is set to the required lenght.
- 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 _check_and_set_flows
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _check_and_set_flows(om, flows, keyword):
"""Checks and sets flows if needed
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 _create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""Creates the constraints for
:class:`oemof.solph.components.experimental._extraction_turbine_chp.ExtractionTurbineCHPBlock`.
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 _create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _create(self, group):
"""Create a storage block for investment modeling"""
m = self.parent_block()
# ########################## CHECKS ###################################
Function __init__
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
demand,
capacity_up,
capacity_down,
Function main
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
data = [0, 15, 30, 35, 20, 25, 27, 10, 5, 2, 15, 40, 20, 0, 0]
# create an energy system
idx = solph.create_time_index(2020, number=len(data))
Function main
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
# Read data file
filename = os.path.join(os.getcwd(), "storage_investment.csv")
try:
data = pd.read_csv(filename)
Function main
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
# Read data file
filename = os.path.join(os.getcwd(), "storage_investment.csv")
try:
data = pd.read_csv(filename)
Function _create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""Creates the balance constraints for the class:`BusBlock` block.
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 _create_variables
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _create_variables(self, group):
r"""Creates all variables for standard flows.
All *Flow* objects are indexed by a starting and ending node
:math:`(i, o)`, which is omitted in the following for the sake of
- 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 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _create(self, group=None):
"""
Create constraints for GenericCHPBlock.
Parameters
Function main
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
# *************************************************************************
# ********** PART 1 - Define and optimise the energy system ***************
# *************************************************************************
Function _evaluate_remaining_value_difference
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def _evaluate_remaining_value_difference(
Function draw_graph
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_graph(
Function draw_graph
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_graph(
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
nominal_value=None,
variable_costs=0,
min=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 investment_limit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def investment_limit(model, limit=None):
r"""Set an absolute limit for the total investment costs of an investment
optimization problem (over all periods in case of a multi-period model):
.. math:: \sum_{investment\_costs} \leq limit
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""
Create constraints for GenericCHPBlock.
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"