Skip to content

Commit

Permalink
Typing for aliases of @Property methods
Browse files Browse the repository at this point in the history
- 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 Torrent.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
  • Loading branch information
rmartin16 committed May 29, 2024
1 parent bca2a13 commit a8b7634
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/qbittorrentapi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def app(self) -> Application:
self._application = Application(client=self)
return self._application

application = app
@property
def application(self) -> Application:
return self.app

def app_version(self, **kwargs: APIKwargsT) -> str:
"""qBittorrent application version."""
Expand Down
4 changes: 3 additions & 1 deletion src/qbittorrentapi/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def auth(self) -> Authorization:
self._authorization = Authorization(client=self)
return self._authorization

authorization = auth
@property
def authorization(self) -> Authorization:
return self.auth

@property
def is_logged_in(self) -> bool:
Expand Down

0 comments on commit a8b7634

Please sign in to comment.