File _investment_flow_block.py
has 957 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 investment but without nonconvex option.
Function _create_constraints
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def _create_constraints(self):
r"""Creates all constraints for standard flows.
Depending on the attributes of the *InvestmentFlowBlock*
and *SimpleFlowBlock*, different constraints are created.
- 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 _objective_expression
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def _objective_expression(self):
r"""Objective expression for flows with investment attribute of type
class:`.Investment`. The returned costs are fixed and
investment costs. Variable costs are added from the standard flow
objective expression.
- 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 _evaluate_remaining_value_difference
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def _evaluate_remaining_value_difference(
Function _evaluate_remaining_value_difference
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _evaluate_remaining_value_difference(
self,
m,
p,
i,
- 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"