-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CRITICAL] (PY-R1000) Function with cyclomatic complexity higher than threshold #267
Comments
This comment was marked as outdated.
This comment was marked as outdated.
related to #159 : from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
# ... [Your existing code] ...
async def send_file(unzip_bot, c_id, doc_f, query, full_path, log_msg, split):
# ... [Your existing code] ...
try:
# ... [Your existing code] ...
# Attempt to extract audio metadata
audio_meta = {}
try:
audio = MP3(doc_f, ID3=EasyID3)
audio_meta['duration'] = int(audio.info.length) # Duration in seconds
audio_meta['performer'] = audio.get('artist', [None])[0] # Performer name
audio_meta['title'] = audio.get('title', [None])[0] # Track name
except Exception as e:
LOGGER.error(f"Error extracting metadata: {e}")
# ... [Your existing code for upmsg and thumbornot] ...
if ul_mode == "media" and fext in extentions_list["audio"]:
send_kwargs = {
'chat_id': c_id,
'audio': doc_f,
'caption': Messages.EXT_CAPTION.format(fname),
'disable_notification': True,
'progress': progress_for_pyrogram,
'progress_args': (
Messages.TRY_UP.format(fname),
upmsg,
time(),
unzip_bot,
),
'duration': audio_meta.get('duration'),
'performer': audio_meta.get('performer'),
'title': audio_meta.get('title'),
}
if thumbornot:
send_kwargs['thumb'] = Config.THUMB_LOCATION + "/" + str(c_id) + ".jpg"
await unzip_bot.send_audio(**send_kwargs)
# ... [Your existing code] ... using kwargs might not be a bad idea |
DESCRIPTION
Occurrences
|
Description
A function with high cyclomatic complexity can be hard to understand and maintain. Cyclomatic complexity is a software metric that measures the number of independent paths through a function. A higher cyclomatic complexity indicates that the function has more decision points and is more complex.
Occurrences
There are 3 occurrences of this issue in the repository.
See all occurrences on DeepSource → app.deepsource.com/gh/EDM115/unzip-bot/issue/PY-R1000/occurrences/
The text was updated successfully, but these errors were encountered: