-
-
Notifications
You must be signed in to change notification settings - Fork 987
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
Sourcery refactored main branch #26
Conversation
Uploader/button.py
Outdated
description = response_json["fulltitle"][0:1021] | ||
# escape Markdown and special characters | ||
description = response_json["fulltitle"][:1021] | ||
# escape Markdown and special characters | ||
tmp_directory_for_each_user = Config.DOWNLOAD_LOCATION + \ | ||
"/" + str(update.from_user.id) + f'{random1}' | ||
if not os.path.isdir(tmp_directory_for_each_user): | ||
os.makedirs(tmp_directory_for_each_user) | ||
download_directory = tmp_directory_for_each_user + "/" + custom_file_name | ||
download_directory = f"{tmp_directory_for_each_user}/{custom_file_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function youtube_dl_call_back
refactored with the following changes:
- Simplify conditional into switch-like form [×6] (
switch
) - Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index
) - Use f-string instead of string concatenation [×5] (
use-fstring-for-concatenation
)
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 73-74
refactored with the following changes:
- Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension
)
if not "." + youtube_dl_ext in custom_file_name: | ||
custom_file_name += '.' + youtube_dl_ext | ||
if f".{youtube_dl_ext}" not in custom_file_name: | ||
custom_file_name += f'.{youtube_dl_ext}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ddl_call_back
refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan
) - Use f-string instead of string concatenation [×7] (
use-fstring-for-concatenation
)
@@ -290,5 +290,4 @@ async def download_coroutine(bot, session, url, file_name, chat_id, message_id, | |||
display_message = current_message | |||
except Exception as e: | |||
logger.info(str(e)) | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_coroutine
refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass
)
return ''.join(random.choice(string.ascii_letters) for x in range(y)) | ||
return ''.join(random.choice(string.ascii_letters) for _ in range(y)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function random_char
refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore
)
b48460a
to
e6ca4df
Compare
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.03%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
This pull request fixes 1 alert when merging e6ca4df into dc3422d - view on LGTM.com fixed alerts:
|
Branch
main
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
main
branch, then run:Help us improve this pull request!