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

Fix 'NoneType' object has no attribute 'state' #138

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

Angel-noori
Copy link
Contributor

@Angel-noori Angel-noori commented Sep 14, 2024

Summary by Sourcery

Fix the error related to 'NoneType' object by passing the client instance to the get_download function and enhance the QbittorrentStatus class by adding a method to access the client instance.

Bug Fixes:

  • Fix the 'NoneType' object has no attribute 'state' error by ensuring the client is passed correctly to the get_download function.

Enhancements:

  • Introduce a client method in the QbittorrentStatus class to access the client instance.

Copy link
Contributor

sourcery-ai bot commented Sep 14, 2024

Reviewer's Guide by Sourcery

This pull request addresses a 'NoneType' object error by modifying the QbittorrentStatus class and related functions in the qbit_status.py file. The changes improve error handling, introduce a client parameter, and update the cancel_download method.

File-Level Changes

Change Details Files
Modify get_download function to accept a client parameter
  • Add 'client' parameter to get_download function
  • Replace xnox_client with the passed client parameter
bot/helper/mirror_leech_utils/status_utils/qbit_status.py
Update QbittorrentStatus class initialization and methods
  • Add self.__client attribute initialized with xnox_client
  • Initialize self.__info in the constructor using get_download
  • Update __update method to use self.__client
  • Add client method to return self.__client
bot/helper/mirror_leech_utils/status_utils/qbit_status.py
Modify cancel_download method to use instance client
  • Replace xnox_client with self.__client in torrents_pause and torrents_delete calls
  • Add torrents_delete_tags call to clean up tags after cancellation
bot/helper/mirror_leech_utils/status_utils/qbit_status.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Angel-noori - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider the implications of moving from a global xnox_client to an instance-specific client. This change might affect behavior if multiple QbittorrentStatus instances are created.
  • The __update method is called frequently. Consider optimizing this by implementing a callback mechanism or updating only when necessary to improve performance.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@5hojib 5hojib merged commit 0d011f9 into AeonOrg:main Sep 14, 2024
@5hojib
Copy link
Collaborator

5hojib commented Sep 14, 2024

Thanks a lot! 💖

@Angel-noori
Copy link
Contributor Author

welcome

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.

2 participants