-
Notifications
You must be signed in to change notification settings - Fork 794
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(typing): Resolve multiple @utils.use_signature
issues
#3565
Conversation
Now `mypy` can understand the symbol, it started complaining
The typing for this isn't the easiest to understand. Adding these aliases makes it a bit clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! A lot for me to learn here. I've added some questions where I could use your help so I can review this further.
Thanks for the review @binste! Tried my best to answer everything so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for digging through it! :)
No problem, thanks for taking the time to review @binste |
Description
This PR addresses problems with this decorator that cause the wrong arguments to bind in some cases.
I've tried (and failed) to fix this multiple times over the past 1-2 months, but until now, hadn't come up with a solution that:
mypy
andpyright
After one signature fails in a chain of methods - an IDE (not
ipython
) can't understand much that follows.Therefore, I consider the issue quite signficant.
Tasks
use_signature
(53057b7)use_signature
return typepyright
is inferringOverload[...]
, which isn't a form I've seen beforeOverload[(cb: (T@decorate, ...) -> R@decorate, /) -> ((T@decorate, **P@use_signature) -> R@decorate), (cb: (...) -> R@decorate, /) -> ((**P@use_signature) -> R@decorate)]
Whatever the solution is, will most likely be a commentConcatenate[T, ...]
insideTypeAliasType
on< (3, 11)
typing.Concatenate
for3.10
typing_extensions.Concatenate
for3.8
,3.9
Repro
Warnings on
main
Fixed on
fix-use-signature-2
Examples that fail type checking on
main
Screenshots
Issues in
api.py
I added these ignore comments in response to this issue during 72bd84d
altair/altair/vegalite/v5/api.py
Line 4168 in 5b58779
altair/altair/vegalite/v5/api.py
Line 4272 in 5b58779
altair/altair/vegalite/v5/api.py
Line 4378 in 5b58779
altair/altair/vegalite/v5/api.py
Line 4504 in 5b58779
Enabling type checking for
tests/