Allows to use type[T] in stubs#11863
Allows to use type[T] in stubs#11863hauntsaninja merged 5 commits intopython:masterfrom sobolevn:better-type-in-stubs
type[T] in stubs#11863Conversation
|
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.
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