Showing 23 of 23 total issues
File base.py
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import pickle
import sys
import time
import zipfile
File connection_session.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import multiprocessing as mp
import sys
import time
from dataclasses import dataclass
Function _pull
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _pull(self, conn: "Connection", complete: bool, post_status: Optional[str]):
_ls = partial(self._remote_ls, conn)
_mv = partial(self._conn_move, conn)
self._merge_status_cache(conn)
# TODO: all this set() thing brings a bit of uncertainty
- 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_handler_events
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_handler_events(
self,
handler: Optional[Union[str, ANY_HANDLER_T]] = None,
only_successful=True,
only_latest=True,
- 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 consume
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def consume(self, task: HandlingTask):
handler_name = task.handler.name
if (handler_name in self._broken_handlers) or (
task.handler.restart_session_after < self._num_queries
):
- 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 continue_run
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def continue_run(
Function integrate_events
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def integrate_events(
session: Session, events: Iterable[Union[RegEvent, CollEvent]], dump_dir=None
):
reg_urls = defaultdict(list)
coll_urls = defaultdict(list)
- 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_parsed_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_parsed_response(
self, url, handler=RequestSoupHandler(), params: Optional[dict] = None
):
if params:
url = add_url_params(url, params)
- 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 cleanup_statuses
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def cleanup_statuses(self):
errs = {}
err_set = set()
while True:
for st in self.statuses_path.iterdir():
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function browser_wait
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def browser_wait(
Function get_caps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_caps(self):
caps = [*self.proxy.caps]
if isinstance(self, BrowserHandler):
if not self.headless: # pragma: no cover
caps.append(Caps.display)
- 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_actor_items
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_actor_items(handlers: Iterable[ANY_HANDLER_T], depot_path: Path):
# TODO this is extreme hacky
for handler in handlers:
caps = handler.get_caps()
full_kwargs = dict(proxy_cls=handler.proxy_cls, depot_path=depot_path)
- 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 _log_miss
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _log_miss(self, msg, content, handler: ANY_HANDLER_T, attempt, status, url):
Function _get_leaf
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_leaf(self, needs_db=False):
# just one that has no children
# and has the most runs in its tree
most_runs = 0
leaf, leaf_tree = Status(), 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 get_handler_events
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_handler_events(
Function get_soup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_soup(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function monitor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def monitor(