-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Allows to use type[T]
in stubs
#11863
Conversation
I don't know my way around the mypy code base very well, but it looks like this solves using |
Of course! Just wanted to clarify 🙂 |
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, this is great.
I think the names here could use some cleaning up, if you're willing to do a little more refactoring.
self.allow_new_syntax
is misleading, since it seems to be exactly the same as is_stub_file
.
It would be great if we could set self.always_allow_new_syntax = self.is_stub_file or self.api.is_future_flag_set('annotations')
.
We could then get rid of the new method and have checks like if self.always_allow_new_syntax or self.options.python_version >= (3, 9)
, which seems the most readable to me.
Sounds like a good idea! I was confused with |
@hauntsaninja done!
|
Hooray! |
Refs #10303
CC @JelleZijlstra @AlexWaygood