-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improve inspect
stubs
#7050
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
Improve inspect
stubs
#7050
Conversation
This comment has been minimized.
This comment has been minimized.
I'm not sure making the Signature class generic is really helpful, and the mypy-primer output agrees. It's usually used for introspection, and most code doing that probably doesn't benefit from precise types for the return annotation. It's also not always correct: your code will infer something like |
Good point -- I've reverted the changes making it generic. I've also removed the TODO comment, since, from what you're saying (and I agree), it sounds like we can't really be more specific here. |
This comment has been minimized.
This comment has been minimized.
@@ -166,7 +167,6 @@ class Signature: | |||
empty = _empty | |||
@property | |||
def parameters(self) -> types.MappingProxyType[str, Parameter]: ... | |||
# TODO: can we be more specific here? |
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.
It's either the empty
marker or whatever the user put in an annotation. I don't think we can express that better in the current type system.
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.
Yeah
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
No description provided.