Function expand_dict
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def expand_dict(d, separator='.'):
""" Expand a dict, converting string or tuple keys into nested keys
Args:
d (:obj:`dict`): dictionary to expand
- 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 flatten_dict
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def flatten_dict(d, root_flat_key=None):
""" Flatten a dict, converting nested keys into tuples
Args:
d (:obj:`dict`): dictionary to flatten
- 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 set_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_value(d, target_key, new_value, match_type=True):
""" Set values of target keys in a nested dictionary
Consider every `key`-`value` pair in nested dictionary `d`. If `value` is not a `dict`,
and `key` is equal to `target_key` then replace `value` with `new_value`. However, if
- 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"