Showing 34 of 34 total issues
Function download
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def download(from_, config, delete_on_success, proxy, split_files, interactive):
Function get_video_thumb
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_video_thumb(file, output=None, size=200):
output = output or tempfile.NamedTemporaryFile(suffix='.jpg').name
metadata = video_metadata(file)
if metadata is None:
return
- 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 send_files
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_files(self, entity, files: Iterable[File], delete_on_success=False, print_file_id=False,
Function _iter_download_chunk_tasks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _iter_download_chunk_tasks(self, input_location, part_size, dc_id, msg_data, file_size):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, client: 'TelegramManagerClient', files, thumbnail: Union[str, bool, None] = None,
Function benchmark_file_size
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def benchmark_file_size(client: TelegramManagerClient, size: int, repeats: int = REPEATS, wait: int = 0,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, client: 'TelegramManagerClient', path: str, force_file: Union[bool, None] = None,
Function send_files_as_album
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_files_as_album(self, entity, files, delete_on_success=False, print_file_id=False,
Function send_one_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_one_file(self, entity, file: File, send_as_media: bool = False, thumb: Optional[str] = None,
Function send_one_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_one_file(self, entity, file: File, send_as_media: bool = False, thumb: Optional[str] = None,
retries=RETRIES):
message = None
progress, bar = get_progress_bar('Uploading', file.file_name, file.file_size)
- 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_thumbnail
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_thumbnail(self):
thumb = None
if self._thumbnail is None and not self.force_file:
try:
thumb = get_file_thumb(self.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 download
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def download(from_, config, delete_on_success, proxy, split_files, interactive):
"""Download all the latest messages that are files in a chat, by default download
from "saved messages". It is recommended to forward the files to download to
"saved messages" and use parameter ``--delete-on-success``. Forwarded messages will
be removed from the chat after downloading, such as a download queue.
- 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 parse_proxy_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_proxy_string(proxy: Union[str, None]):
if not proxy:
return None
proxy_parsed = urlparse(proxy)
if not proxy_parsed.scheme or not proxy_parsed.hostname or not proxy_parsed.port:
- 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 upload_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def upload_file(extension: str = "", directory: str = ""):
"""Upload a file to Telegram by extension"""
extensions = []
if not directory:
directory = tempfile.gettempdir()
- 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"