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

refactor: make mypy happy about Torrent.is_paused #457

Merged
merged 4 commits into from
May 29, 2024
Merged

Conversation

trim21
Copy link
Contributor

@trim21 trim21 commented May 28, 2024

mypy doesn't think is_paused is a property so it raise a warning

error: Function "is_paused" could always be true in boolean context [truthy-function]

@trim21 trim21 changed the title make mypy happy about Torrent.is_paused refactor: make mypy happy about Torrent.is_paused May 28, 2024
Copy link

codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (404281e) to head (99ba259).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #457   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines         1929      1935    +6     
  Branches       373       376    +3     
=========================================
+ Hits          1929      1935    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rmartin16
Copy link
Owner

That's unfortunate; this seems to be the upstream issue documenting this behavior in mypy.

Given how often this library is aliasing things, I'd be surprised if this is the only case. I'll see if I can proactively find others.

- When a property method is aliased to another label, mypy considers the
  type of the alias to be a callable instead of the return type of the
  method; therefore, mypy is likely to error when using them
- This resolves the issue for client.application, client.authorization,
  and TorrentState.is_paused
- Instances of the issue (mostly in client.app) arising from camelCase
  aliases will not be resolved; use the snake case names as a workaround
@rmartin16 rmartin16 merged commit 3ae9783 into rmartin16:main May 29, 2024
35 checks passed
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