-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Use PEP 585 syntax in typing
and typing_extensions
, and remove module-level defaults where possible
#7036
Conversation
…dule-level defaults where possible
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
@@ -24,22 +24,22 @@ class _SpecialForm(object): | |||
def __getitem__(self, typeargs: Any) -> object: ... | |||
|
|||
Union: _SpecialForm = ... | |||
Optional: _SpecialForm = ... | |||
Tuple: _SpecialForm = ... | |||
Optional: _SpecialForm |
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.
I don't really like this change. It's confusing to readers that half of these seemingly identical names have = ...
and the other half don't.
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.
Maybe the best solution is to copy the flake8 rule for undefined vars to flake8-pyi and adapt it for stub files.
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.
Or we can just switch off my proposed Y032 for typing.pyi
and typing_extensions.pyi
.
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.
Third option: move all the _SpecialForm
objects in typing
/typing_extensions
that need a default value together in the stub, and add a comment explaining why they need a default value when the other _SpecialForm
objects don't.
Refs PyCQA/flake8-pyi#145