Showing 14 of 16 total issues
Function __restore_dict
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def __restore_dict(cls, dct, attr_call_list, exclude_type):
ret = cls()
for (name, value) in dct.items():
fld = cls._fields.get(name)
if fld:
- 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
File model.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# coding=utf-8
"""Model Base."""
Function __delete_attr
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __delete_attr(self, target, target_route):
try:
obj = reduce(self.__lookup, target_route[:-1], target)
parent_obj = reduce(self.__lookup, target_route[:-2], target)
(name, index) = self.__split_name_index(target_route[-1])
- 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__
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __set__(self, obj, value):
"""Set descriptor."""
attrs = self.target.split(self.sep_char)
self.validate()
asdict = getattr(obj, "asdict", False)
- 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
File fields.py
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# coding=utf-8
"""Fields."""
Function __allocate_array
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __allocate_array(self, asdict, target, attr, current_position,
indexes, value=None):
point = target[attr] if isinstance(target, dict) \
else getattr(target, attr)
for (num, index) in enumerate(indexes):
- 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 __compose_dict
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __compose_dict(self, priority_list, exclude_type):
dct = {}
for (name, fld) in self.fields.items():
if self.__extend_exclusion(fld, exclude_type, "serialize"):
continue
- 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 _cast_type
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _cast_type(self, index, default=__NotSpecifiedYet__, index_only=False):
ret = None
try:
ret = self.set_cast[index]
except TypeError as e:
- 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 __validate_consistency
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __validate_consistency(self, fields=None):
"""Check consistency of the class."""
fields = [
field for field in fields or self.fields.items()
if isinstance(getattr(field[1], "set_cast", None), list)
- 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 __allocate_array
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __allocate_array(self, asdict, target, attr, current_position,
Function reduce_with_index
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def reduce_with_index(fn, iterable, start=None, *args, **kwargs):
Function check_consistency_for_each_value
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def check_consistency_for_each_value(cur, attr, index,
Function __correct_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __correct_value(self, target, indexes, value):
result_value = value
if hasattr(self, "set_cast"):
cast = self._cast_type(-1, None)
if not any([cast is None, type(result_value) is cast]):
- 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 __extend_exclusion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __extend_exclusion(fld, exclude_type, ser_type):
exclude = getattr(fld, "exclude", None)
exclude_method = getattr(fld, ("exclude_{}").format(ser_type), None)
if any([
- 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"