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

Ban importing Match and Pattern from typing (import from re instead) #324

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

AlexWaygood
Copy link
Collaborator

Closes #46

@github-actions

This comment has been minimized.

AlexWaygood added a commit to python/typeshed that referenced this pull request Jan 16, 2023
AlexWaygood added a commit to python/typeshed that referenced this pull request Jan 16, 2023
@AlexWaygood AlexWaygood reopened this Jan 16, 2023
@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one suggestion though.

README.md Outdated
@@ -55,7 +55,7 @@ currently emitted:
| Y019 | Certain kinds of methods should use `_typeshed.Self` instead of defining custom `TypeVar`s for their return annotation. This check currently applies for instance methods that return `self`, class methods that return an instance of `cls`, and `__new__` methods.
| Y020 | Quoted annotations should never be used in stubs.
| Y021 | Docstrings should not be included in stubs.
| Y022 | Imports linting: use typing-module aliases to stdlib objects as little as possible (e.g. `builtins.list` over `typing.List`, `collections.Counter` over `typing.Counter`, etc.).
| Y022 | Use typing-module aliases to stdlib objects as little as possible (e.g. `builtins.list` over `typing.List`, `collections.OrderedDict` over `typing_extensions.OrderedDict`, etc.).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use typing_extensions here? I think typing is more "canonical", easier to understand, and more succinct.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realised we didn't mention anywhere that Y022 bans various imports from typing_extensions as well as various imports from typing, and that felt like something which might be useful to make clear. But I can reword this if the current phrasing is just confusing!

Copy link
Collaborator Author

@AlexWaygood AlexWaygood Jan 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's it look now?

@github-actions

This comment has been minimized.

@github-actions
Copy link

This change has no effect on typeshed. 🤖🎉

@srittau srittau merged commit 675411c into master Jan 16, 2023
@srittau srittau deleted the match-pattern branch January 16, 2023 11:49
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.

Suggest using collections.abc etc, not typing (deprecated since 3.9)
2 participants