Skip to content
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

Merged
merged 1 commit into from
Aug 1, 2022
Merged

Sourcery refactored main branch #26

merged 1 commit into from
Aug 1, 2022

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Aug 1, 2022

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:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from kalanakt August 1, 2022 15:53
Comment on lines 108 to 114
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}"
Copy link
Author

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:

Comment on lines 33 to 34


Copy link
Author

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:

Comment on lines -81 to +82
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}'
Copy link
Author

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:

@@ -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
Copy link
Author

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:

return ''.join(random.choice(string.ascii_letters) for x in range(y))
return ''.join(random.choice(string.ascii_letters) for _ in range(y))
Copy link
Author

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:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Aug 1, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.03%.

Quality metrics Before After Change
Complexity 43.66 ⛔ 43.77 ⛔ 0.11 👎
Method Length 277.78 ⛔ 278.33 ⛔ 0.55 👎
Working memory 18.87 ⛔ 18.87 ⛔ 0.00
Quality 17.03% 17.00% -0.03% 👎
Other metrics Before After Change
Lines 603 603 0
Changed files Quality Before Quality After Quality Change
Uploader/button.py 6.66% ⛔ 6.66% ⛔ 0.00%
Uploader/config.py 65.65% 🙂 65.81% 🙂 0.16% 👍
Uploader/dl_button.py 17.22% ⛔ 17.07% ⛔ -0.15% 👎
Uploader/functions/ran_text.py 94.92% ⭐ 96.67% ⭐ 1.75% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
Uploader/button.py youtube_dl_call_back 60 ⛔ 971 ⛔ 22 ⛔ 4.82% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
Uploader/dl_button.py ddl_call_back 47 ⛔ 889 ⛔ 20 ⛔ 7.88% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
Uploader/dl_button.py download_coroutine 14 🙂 213 ⛔ 16 ⛔ 35.25% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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!

Copy link
Owner

@kalanakt kalanakt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@kalanakt kalanakt merged commit 38fdaa7 into main Aug 1, 2022
@kalanakt kalanakt deleted the sourcery/main branch August 1, 2022 16:17
@lgtm-com
Copy link

lgtm-com bot commented Aug 1, 2022

This pull request fixes 1 alert when merging e6ca4df into dc3422d - view on LGTM.com

fixed alerts:

  • 1 for Unnecessary pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant