Function catching
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def catching(errors: Catchable, func: Func):
"""
Similar to catch, but decorates a function rewriting its error handling
policy.
- 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 throttle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def throttle(
dt: float,
func: Func,
policy: Literal["last", "block"] = "last",
clock: Callable[[], T] = time.monotonic,
- 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 retry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def retry(n: int, func: Func, *, error: Catchable = Exception, sleep=None) -> fn:
"""
Retry to execute function at least n times before raising an error.
This is useful for functions that may fail due to interaction with external
- 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 catch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def catch(exc: Union[Catchable, Dict[Catchable, Any]], func: Func, /, *args, **kwargs):
"""
Handle exception in function. If the exception occurs, it executes the given
handler.
- 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 retry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def retry(n: int, func: Func, *, error: Catchable = Exception, sleep=None) -> fn:
Function throttle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def throttle(
Function catch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def catch(exc: Union[Catchable, Dict[Catchable, Any]], func: Func, /, *args, **kwargs):
Function get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get(self, timeout=None, *, default=NOT_GIVEN):
"""
Return result of computation.
Can set optional timeout and default arguments.
- 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"