telegram_upload/client/telegram_upload_client.py
File telegram_upload_client.py
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import asyncio
import hashlib
import os
import time
from typing import Iterable, Optional
Function send_files
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def send_files(self, entity, files: Iterable[File], delete_on_success=False, print_file_id=False,
forward=(), send_as_media: bool = False):
has_files = False
messages = []
for file in files:
- 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
Open
def send_files(self, entity, files: Iterable[File], delete_on_success=False, print_file_id=False,
Function send_files_as_album
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
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
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
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"