-
Notifications
You must be signed in to change notification settings - Fork 67
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
Strange new type signature issues for TorrentDictionary methods #471
Comments
Hmm....thanks for letting me know. I've had similar issues recently with mypy (see #467 as an example)....however, there are unresolved issues in mypy that are creating these problems. I should be able to look further in to this later but are you able to see if recent previous versions of pylance also throw these errors? I've noticed these different type checkers tend to make changes in tandem....so, I wonder if they all did something recently related to wrapped functions.... As for qbittorrent-api's use of |
Happy to help! Pylance versions Also, before today, I don't think my local copy of qbittorrent-api had been updated in about a year, so the 9-month-ago change you mentioned makes sense. |
Some potential good news: I found a Pylance issue titled functools.wraps broken for complex class decorator for versions after 2023.02.40, and it is true that if I downgrade to 2023.02.40 (about a year old), the problem goes away. And in that discussion, there's a suggestion on how to fix the issue with a code change. Assuming you aren't already using that approach, perhaps it would make both Pylance and mypy happy. |
Thanks for the confirmation and the research. I don't think any of this is going to work, though, unfortunately. Moreover, I only implemented Sooo, I think the "fix" here will just be to remove the |
v2024.7.64 is now published with this fix. |
Describe the bug
I recently updated qbittorrent-api (from what previous version, I can't say), and find that Visual Studio/Pylance is now newly presenting peculiar type signatures for methods of
TorrentDictionary
objects.For example, this used to be fine with Pylance:
mytorrentdict.recheck()
But now that same line causes Pylance to complain
Argument missing for parameter "self"
and display this type signature:(method) recheck: _Wrapped[(self: TorrentsAPIMixIn, torrent_hashes: Iterable[str] | None = None, **kwargs: APIKwargsT), None, (self: TorrentDictionary, **kwargs: APIKwargsT), None]
This occurs for many (if not all)
TorrentDictionary
methods.Steps to reproduce
Try
mytorrentdict.recheck()
in code edited within Visual Studio 1.91.0 with Pylance installed.Expected behavior
Pylance should not complain about
mytorrentdict.recheck()
, and the type signature should not includeself
as the first parameter.Screenshots
No response
Environment
Additional context
While it is possible that this is somehow the fault of Pylance, I tend to look to qbittorrent-api, as the only thing altered in my environment was a qbittorrent-api update, after which Pylance identified dozens of "errors" in mature code that certainly continues to work properly.
Also, Pylance has no complaint about use of client methods such as
client.torrents_recheck()
, but I'd prefer not to overhaul the code to use those forms unless absolutely necessary.The text was updated successfully, but these errors were encountered: