File hyperopt.py
has 498 lines of code (exceeds 250 allowed). Consider refactoring. Open
# pragma pylint: disable=too-many-instance-attributes, pointless-string-statement
"""
This module contains the hyperopt logic
"""
Function generate_optimizer
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def generate_optimizer(self, raw_params: List[Any]) -> Dict[str, Any]:
"""
Used Optimize function.
Called once per epoch to optimize whatever is configured.
Keep this function as optimized as possible!
- 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 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, config: Config) -> None:
self.buy_space: List[Dimension] = []
self.sell_space: List[Dimension] = []
self.protection_space: List[Dimension] = []
self.roi_space: List[Dimension] = []
Function _get_params_details
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_params_details(self, params: Dict) -> Dict:
"""
Return the params for each space
"""
result: 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 _get_results_dict
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_results_dict(self, backtesting_results, min_date, max_date,
Function init_spaces
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def init_spaces(self):
"""
Assign the dimensions in the hyperoptimization space.
"""
if HyperoptTools.has_space(self.config, 'protection'):
- 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"