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

Update waifu.py (Sourcery refactored) #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 12, 2022

Pull Request #11 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/zYxDevs/AutoProtecc-Userbot pull/11/head
    git merge --ff-only FETCH_HEAD
    git push

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Help us improve this pull request!

BOT_LIST = int(x for x in os.environ.get("BOT_LIST").split())
BOT_LIST = int(iter(os.environ.get("BOT_LIST").split()))
Copy link
Author

Choose a reason for hiding this comment

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

Lines 24-24 refactored with the following changes:

Comment on lines -91 to +103
if message.photo:
if "add" in message.caption.lower():
img = await message.download()
fetchUrl = await get_data(img)
match = await ParseSauce(fetchUrl + "&preferences?hl=en&fg=1#languages")
guess = match["best_guess"]
if not guess:
return await message.reply_text("Failed to protecc this waifu.")
guess = guess.replace("Results for", "")
await time.sleep(DELAY)
kek = await message.reply_text(f"/protecc {guess}")
await kek.delete()
if not message.photo:
return
if "add" in message.caption.lower():
img = await message.download()
fetchUrl = await get_data(img)
match = await ParseSauce(f"{fetchUrl}&preferences?hl=en&fg=1#languages")
guess = match["best_guess"]
if not guess:
return await message.reply_text("Failed to protecc this waifu.")
guess = guess.replace("Results for", "")
await time.sleep(DELAY)
kek = await message.reply_text(f"/protecc {guess}")
await kek.delete()
Copy link
Author

Choose a reason for hiding this comment

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

Function autoprotecc refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Oct 12, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 1.82%.

Quality metrics Before After Change
Complexity 3.49 ⭐ 3.04 ⭐ -0.45 👍
Method Length 93.20 🙂 92.40 🙂 -0.80 👍
Working memory 8.93 🙂 8.29 🙂 -0.64 👍
Quality 65.80% 🙂 67.62% 🙂 1.82% 👍
Other metrics Before After Change
Lines 97 98 1
Changed files Quality Before Quality After Quality Change
waifu.py 65.80% 🙂 67.62% 🙂 1.82% 👍

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

File Function Complexity Length Working Memory Quality Recommendation

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!

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