Showing 139 of 397 total issues
File _invest_non_convex_flow_block.py
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""Creating sets, variables, constraints and parts of the objective function
for Flow objects with both Nonconvex and Investment options.
Function results
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def results(model, remove_last_time_point=False):
"""Create a nested result dictionary from the result DataFrame
The already rearranged results from Pyomo from the result DataFrame are
transferred into a nested dictionary of pandas objects.
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""Creates the relation for the class:`Link`.
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 _old_dsm_capacity_rule_end
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _old_dsm_capacity_rule_end(block):
"""Rule definition for determining old endogenously installed
capacity to be decommissioned due to reaching its lifetime.
Investment and decommissioning periods are linked within
the constraint. The respective decommissioning period is
- 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
File _flow.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
solph version of oemof.network.Edge
Function __init__
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
demand,
capacity_up,
capacity_down,
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""Creates the linear constraint for the class:`ElectricalLine`
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 main
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main(dump_and_restore=False):
# For models that need a long time to optimise, saving and loading the
# EnergySystem might be advised. By default, we do not do this here. Feel
# free to experiment with this once you understood the rest of the code.
dump_results = restore_results = dump_and_restore
Function storage_level_constraint
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def storage_level_constraint(
model,
name,
storage_component,
multiplexer_bus,
- 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 main
has 43 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(2017, number=len(data))
Function main
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
# Read data file
filename = os.path.join(os.getcwd(), "tuple_as_label.csv")
try:
data = pd.read_csv(filename)
Function __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function investment_limit_per_period
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def investment_limit_per_period(model, limit=None):
r"""Set an absolute limit for the total investment costs of a
investment optimization problem for each period
of the multi-period problem.
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def _create(self, group=None):
"""
Create constraints for GenericCAESBlock.
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 main
has 39 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 storage_level_constraint_example
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def storage_level_constraint_example():
es = EnergySystem(
timeindex=pd.date_range("2022-01-01", freq="1H", periods=24),
infer_last_interval=True,
)
Function main
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
# Read data file
filename = os.path.join(os.getcwd(), "variable_chp.csv")
try:
data = pd.read_csv(filename)
Function __init__
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function main
has 36 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 _objective_expression
has a Cognitive Complexity of 12 (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"