Function __call__
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, cutpoint_function):
if isasyncfunction is not None and isasyncfunction(cutpoint_function):
assert isasyncgenfunction(cutpoint_function) or iscoroutinefunction(cutpoint_function)
async def advising_asyncgenerator_wrapper_py35(*args, **kwargs):
- 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 weave_class
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
def weave_class(
klass, aspect, methods=NORMAL_METHODS, subclasses=True, lazy=False, owner=None, name=None, aliases=True, bases=True, bag=BrokenBag
):
"""
Low-level weaver for classes.
- 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 __init__.py
has 606 lines of code (exceeds 250 allowed). Consider refactoring. Open
import builtins
import re
import sys
import warnings
from collections import deque
Function weave
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def weave(target, aspects, **options):
"""
Send a message to a recipient
Args:
- 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 patch_module
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options):
"""
Low-level attribute patcher.
:param module module: Object to patch.
- 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 weave_instance
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def weave_instance(instance, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options):
"""
Low-level weaver for instances.
.. warning:: You should not use this directly.
- 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 weave_class
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def weave_class(
Function _find_super_classes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _find_super_classes(klass):
if hasattr(klass, '__mro__'):
for k in klass.__mro__:
yield k
else:
- 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 _rewrap_method
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _rewrap_method(func, klass, aspect):
if isinstance(func, staticmethod):
if hasattr(func, '__func__'):
return staticmethod(_checked_apply(aspect, func.__func__))
else:
- 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 patch_module
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options):
Function weave_module
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def weave_module(module, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options):
Avoid deeply nested control flow statements. Open
for attr, func in sklass.__dict__.items():
if method_matches(attr) and attr not in original and attr not in super_original:
if isroutine(func):
logdebug("@ patching attribute %r (from superclass: %s, original: %r).", attr, sklass.__name__, func)
setattr(klass, attr, _rewrap_method(func, sklass, aspect))
Function weave_module
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def weave_module(module, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options):
"""
Low-level weaver for "whole module weaving".
.. warning:: You should not use this directly.
- 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 weave_instance
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def weave_instance(instance, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options):
Function patch_module_function
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def patch_module_function(module, target, aspect, force_name=None, bag=BrokenBag, **options):
Consider simplifying this complex logical expression. Open
if name and getattr(builtins, name, None) is target:
if bag.has(target):
return Nothing
return patch_module_function(builtins, target, aspects, **options)
elif PY3 and ismethod(target):
Avoid too many return
statements within this function. Open
return weave_instance(target, aspects, **options)
Avoid too many return
statements within this function. Open
return mimic(advising_function_wrapper, cutpoint_function)
Avoid too many return
statements within this function. Open
return patch_module_function(builtins, target, aspects, **options)
Avoid too many return
statements within this function. Open
return patch_module_function(owner, obj, aspects, force_name=name, **options)
Avoid too many return
statements within this function. Open
return Nothing
Avoid too many return
statements within this function. Open
return _checked_apply(aspect, func)
Avoid too many return
statements within this function. Open
return weave(obj, aspects, **options)
Avoid too many return
statements within this function. Open
return weave_class(target, aspects, **options)
Avoid too many return
statements within this function. Open
return mimic(advising_generator_wrapper_py35, cutpoint_function)
Avoid too many return
statements within this function. Open
return patch_module(owner, name, _checked_apply(aspects, func), func, **options)
Avoid too many return
statements within this function. Open
return Nothing
Avoid too many return
statements within this function. Open
return Rollback(lambda: delattr(inst, name))
Avoid too many return
statements within this function. Open
return weave_module(target, aspects, **options)
Avoid too many return
statements within this function. Open
return Nothing