File misc.py
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
""" Miscellaneous utilities.
:Author: Jonathan Karr <karr@mssm.edu>
:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Date: 2016-11-05
Function validate_dataclass_type
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate_dataclass_type(self, attr_name):
""" Validate the type of an attribute in a dataclass instance
Args:
attr_name (:obj:`str`): the name of the attribute to validate
- 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 isclass_by_name
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def isclass_by_name(cls_name, cls_info):
"""Compares a class name with the names of the classes in `cls_info`.
Args:
cls_name (:obj:`str`): class name
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, start_state, accepting_state, transitions):
"""
Args:
start_state (:obj:`object`): a DFSM's start state
accepting_state (:obj:`object`): a DFSM must be in this state to accept a message sequence
- 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 as_dict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def as_dict(obj):
""" Provide a dictionary representation of `obj`
`obj` must define an attribute called `ATTRIBUTES` which iterates over the attributes that
should be included in the representation.
- 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"