Function is_supported_type
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def is_supported_type(param: Any, types: Tuple, none_support):
if isinstance(param, types) or (param is None and none_support):
if isinstance(param, dict):
for key, value in param.items():
assert isinstance(key, str), f'Invalid key "{key}". Only type "str" is supported as dictionary key.'
- 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 supported_types
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def supported_types(*types: Tuple, is_classmethod=True):
# Check if we support NoneType
none_support = False
for a in types:
if a 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 get_param_with_blocking
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_param_with_blocking(name, backend, default=_unspecified, timeout=2.0):
params = Unspecified()
start = time.time()
while isinstance(params, Unspecified):
if time.time() - start > timeout:
- 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"