Function _tree_flattend
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
def _tree_flattend(self, flatten_tree, tree, parent='', sep='_'):
for node, child in tree.items():
parent_node = node if not parent else sep.join((parent, node))
flatten_child = self.flatten_datatree(child,
parent=parent_node)
Function build_header
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
def build_header(self, data, parent_key=None):
header = []
if isinstance(data, dict):
for colname, colvalue in data.items():
Cyclomatic complexity is too high in method build_header. (9)
def build_header(self, data, parent_key=None):
header = []
if isinstance(data, dict):
for colname, colvalue in data.items():
Cyclomatic complexity is too high in method _tree_flattend. (9)
def _tree_flattend(self, flatten_tree, tree, parent='', sep='_'):
for node, child in tree.items():
parent_node = node if not parent else sep.join((parent, node))
flatten_child = self.flatten_datatree(child,
parent=parent_node)
Avoid deeply nested control flow statements.
if sub_child.keys() <= sub_tree.keys():
subtree_copy = deepcopy(sub_tree)
subtree_copy.update(sub_child)
flatten_tree.append(subtree_copy)
break
Function VALUE_TO_CONST
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def VALUE_TO_CONST(self):
"""
Dict {"value": "const"}
"""
if self._VALUE_TO_CONST is None:
Function REVERTED_CHOICES_DICT
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def REVERTED_CHOICES_DICT(self):
"""
Dict {"display_value": "value"}
"""
Function CHOICES_DICT
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def CHOICES_DICT(self):
if self._CHOICES_DICT is None:
self._CHOICES_DICT = {}
for c, k, v in self.RAW_CHOICES:
if c in self._CONSTS:
Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
def build_header(self, data, parent_key=None):
Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
def _tree_flattend(self, flatten_tree, tree, parent='', sep='_'):
Take the required action to fix the issue indicated by this "FIXME" comment.
Similar blocks of code found in 2 locations. Consider refactoring.
@property
def VALUE_TO_CONST(self):
"""
Dict {"value": "const"}
"""
Similar blocks of code found in 2 locations. Consider refactoring.
@property
def REVERTED_CHOICES_DICT(self):
"""
Dict {"display_value": "value"}
"""
Similar blocks of code found in 2 locations. Consider refactoring.
@property
def CHOICES(self):
"""
Tuple of tuples (value, display_value).
"""
Similar blocks of code found in 2 locations. Consider refactoring.
@property
def CONST_CHOICES(self):
"""
Tuple of tuples (constant, display_value).
"""
There are no issues that match your filters.