Showing 27 of 90 total issues
Function _make_iterencode
has a Cognitive Complexity of 209 (exceeds 5 allowed). Consider refactoring. Open
def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
_key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, _key_order,
## HACK: hand-optimized bytecode; turn globals into locals
ValueError=ValueError,
dict=dict,
- 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
DataRange
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class DataRange(object):
def __init__(self, iterable=None, value_types=(float, int, str, type(None)), none_alias=(None, ' ', '', 'None'),
**kwargs):
self._value_types = value_types
self._none_alias = none_alias
File encode_json.py
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# unicum
# ------
# Python library for simple object cache and factory.
Function _run
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _run(task, result, pkg_name, cls_name, types):
""" run session loop """
_module = __import__(pkg_name)
_class = getattr(_module, cls_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
File persistentobject.py
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# unicum
# ------
# Python library for simple object cache and factory.
File demo_visible_object.py
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# unicum
# ------
# Python library for simple object cache and factory.
Function _make_iterencode
has 22 arguments (exceeds 4 allowed). Consider refactoring. Open
def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
Function to_serializable
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def to_serializable(self, level=0, all_properties_flag=False, recursive=True):
ret = list()
for r in self.total_list:
l = list()
for v in r:
- 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 dict_from_range
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def dict_from_range(range_list):
# separate keys and values
key_list = list()
value_list = list()
for line in range_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 to_serializable
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def to_serializable(self, level=0, all_properties_flag=False, recursive=True):
d = dict()
for a in [a for a in dir(self) if self.__class__._is_visible(a)]:
if a in self._modified_members or self._from_visible(a) in ['Name', 'Class', 'Module'] or all_properties_flag:
v = getattr(self, a)
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, iterable=None, value_types=(float, int, str, type(None)), none_alias=(None, ' ', '', 'None'),
**kwargs):
self._value_types = value_types
self._none_alias = none_alias
self._col_keys = 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 to_serializable
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def to_serializable(self, level=0, all_properties_flag=False, recursive=True):
if not self:
return [['Name', 'Class', 'Module']]
# list of objects -> list of dicts
d = [x.to_serializable(all_properties_flag=all_properties_flag) for x in self]
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, iterable=None, object_type=PersistentObject, value_types=(float, int, str, type(None))):
if not issubclass(object_type, PersistentObject):
raise TypeError('Required object type of AttributeList items must be subtype of %s ' % PersistentObject.__name__)
self._object_type = object_type
self._value_types = value_types
- 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 decode_list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def decode_list(data):
rv = []
for item in data:
if isinstance(item, basestring): # 2to3 20190915
item = str(item) # .encode('utf-8') # 2to3 20190915
- 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 range_from_dict
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def range_from_dict(range_dict, key_order=()):
rng_dict = dict(range_dict)
# first build flattering range
rng = list()
for key in list(key_order)+sorted(rng_dict.keys()):
- 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 iterencode
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def iterencode(self, o, _one_shot=False):
"""Encode the given object and yield each string
representation as available.
For example::
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, iterable=None, object_type=FactoryObject):
if not issubclass(object_type, FactoryObject):
raise TypeError('Required object type of ObjectList items must be subtype of %s ' % FactoryObject.__name__)
self._object_type = object_type
if iterable is None:
- 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 _from_class
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _from_class(cls, class_name, module_name=None, *args, **kwargs):
""" class method to create object of a given class """
def _get_module(module_name):
names = module_name.split(".")
module = __import__(names[0])
- 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 to_serializable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_serializable(self, level=0, all_properties_flag=False, recursive=True):
r = dict()
for k, v in list(self.items()):
if recursive:
v = v if not hasattr(v, 'to_serializable') else v.to_serializable(level + 1, all_properties_flag)
- 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 clean_up_link_dict
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clean_up_link_dict(self):
links = self._get_links()
names_to_remove = list()
for name in links:
wal_to_remove = set()
- 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"