HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/utils/general_utils.py

Summary

Maintainability
A
50 mins
Test Coverage

Function sec_to_hms has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Wontfix

def sec_to_hms(seconds, ms_places=5, as_str=False):
    """Convert `seconds` to hours, minutes, and seconds

    Parameters
    ----------
Severity: Minor
Found in hyperparameter_hunter/utils/general_utils.py - About 45 mins to fix

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 deep_restricted_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

def deep_restricted_update(default_vals, new_vals, iter_attrs=None):
    """Return an updated dictionary that mirrors `default_vals`, except where the key in `new_vals`
    matches the path in `default_vals`, in which case the `new_vals` value is used

    Parameters
Severity: Minor
Found in hyperparameter_hunter/utils/general_utils.py - About 25 mins to fix

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 extra_enter_attrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def extra_enter_attrs(iter_attrs: Union[BooleanEnterFunc, List[BooleanEnterFunc]]) -> EnterFunc:
    """Build an `enter` function intended for use with `boltons_utils.remap` that enables entrance
    into non-standard objects defined by `iter_attrs` and iteration over their attributes as dicts

    Parameters
Severity: Minor
Found in hyperparameter_hunter/utils/general_utils.py - About 25 mins to fix

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 subdict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def subdict(d, keep=None, drop=None, key=None, value=None):
    """Compute the "subdictionary" of a dict, `d`

    Parameters
    ----------
Severity: Minor
Found in hyperparameter_hunter/utils/general_utils.py - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status