Showing 17 of 159 total issues
File retry.py
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
from concurrent.futures import Executor
from threading import RLock, Thread
import logging
import weakref
ProxyFuture
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class ProxyFuture(MapFuture):
# A future which proxies many calls through to the underlying object.
def __init__(self, delegate, timeout):
self.__timeout = timeout
super(ProxyFuture, self).__init__(delegate)
Function _submit_loop
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _submit_loop(executor_ref):
# Runs in a separate thread continuously submitting to the delegate
# executor until no jobs are ready, or waiting until next job is ready
while True:
executor = executor_ref()
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _get_next_job
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _get_next_job(self):
# Find and return the next job to be handled, if any.
# This means a job with when < now, or with stop_retry == True,
# or if there's none, then the job with the minimum value of when.
min_job = 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 _poll_loop
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _poll_loop(executor_ref):
while True:
executor = executor_ref()
if not executor:
break
- 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 _submit_loop_iter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _submit_loop_iter(executor):
if not executor:
return
if executor._shutdown.is_shutdown or is_shutdown():
- 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 handle_done
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def handle_done(self, index, f):
set_result = False
set_exception = False
cancel = False
- 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 record_done
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_done(f, started_when, time, inprogress, cancelled, failed):
Function _delegate_resolved
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _delegate_resolved(self, delegate):
assert delegate is self._delegate, "BUG: called with %s, expected %s" % (
delegate,
self._delegate,
)
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, delegate, count, logger=None, name="default", block=False):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, delegate, fn=None, logger=None, name="default", **kwargs):
Function get_state_update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_state_update(self, f):
set_result = False
set_exception = False
cancel_futures = 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"
Further reading
Function _cancel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _cancel(self, future):
found_job = None
with self._lock:
for idx, job in enumerate(self._jobs):
- 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 _wrapped_f_apply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _wrapped_f_apply(future_fn, future_args):
if not future_args:
return wrap(future_fn).with_map(lambda fn: fn())()
future_key_and_x = future_args[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"