File __init__.py
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
How it works: the library is composed of 2 major parts:
* The `sealers`. They return a class that implements a container according the given specification (list of field names
and default values).
Function class_sealer
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def class_sealer(fields, defaults,
base=__base__, make_init_func=make_init_func,
initializer=True, comparable=True, printable=True, convertible=False, pass_kwargs=False):
"""
This sealer makes a normal container class. It's mutable and supports arguments with default values.
- 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 make_init_func
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def make_init_func(fields, defaults,
baseclass_name='FieldsBase',
header_name='__init__',
header_start='def {func_name}(self',
header_end='):\n',
- 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 __new__
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __new__(mcs, name="__blank__", bases=(), namespace=None, last_field=None, required=(), defaults=(),
sealer=_SealerWrapper(class_sealer)):
if not bases:
assert isinstance(sealer, _SealerWrapper)
- 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 make_init_func
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_init_func(fields, defaults,
Function class_sealer
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def class_sealer(fields, defaults,
Function __new__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __new__(mcs, name="__blank__", bases=(), namespace=None, last_field=None, required=(), defaults=(),
Function __invert__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __invert__(cls):
if cls.__concrete is None:
if not cls.__all_fields:
raise TypeError("You're trying to use an empty Fields factory !")
if cls.__defaults and cls.__last_field is not 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 __getattr__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __getattr__(cls, name):
if name.startswith("__") and name.endswith("__"):
return type.__getattribute__(cls, name)
if name in cls.__required:
raise TypeError("Field %r is already specified as required." % 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"