Skip to content
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

Merged
merged 4 commits into from
Jan 25, 2022

Conversation

AlexWaygood
Copy link
Member

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood marked this pull request as ready for review January 25, 2022 14:46
@AlexWaygood AlexWaygood marked this pull request as draft January 25, 2022 14:46
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit 5d07ebc into python:master Jan 25, 2022
@AlexWaygood AlexWaygood deleted the module-defaults branch January 25, 2022 15:15
@@ -24,22 +24,22 @@ class _SpecialForm(object):
def __getitem__(self, typeargs: Any) -> object: ...

Union: _SpecialForm = ...
Optional: _SpecialForm = ...
Tuple: _SpecialForm = ...
Optional: _SpecialForm
Copy link
Member

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.

Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants