From 7665b1f91766aa9c2d9469e5a3ad8cb980f3c59f Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Wed, 29 May 2024 12:19:35 -0400 Subject: [PATCH] Typing for aliases of `@property` methods - 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 --- src/qbittorrentapi/app.py | 4 +++- src/qbittorrentapi/auth.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qbittorrentapi/app.py b/src/qbittorrentapi/app.py index 991322dad..2568cd852 100644 --- a/src/qbittorrentapi/app.py +++ b/src/qbittorrentapi/app.py @@ -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.""" diff --git a/src/qbittorrentapi/auth.py b/src/qbittorrentapi/auth.py index 1886672cf..d267eec92 100644 --- a/src/qbittorrentapi/auth.py +++ b/src/qbittorrentapi/auth.py @@ -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: