Repository navigation
Recommend using PEP 585 - #5055
Merged
Merged
Conversation
Remove old note about optional default arguments (now part of PEP 484 and enforced by CI)
Collaborator
Author
|
Weird that the pytype check fails here, while it succeeded in #5050. |
| * avoid invariant collection types (`List`, `Dict`) in argument | ||
| * use built-in generics (`list`, `dict`, `tuple`, `set`), instead | ||
| of importing them from `typing`, **except** for arbitrary length tuples | ||
| (`Tuple[int, ...]`); |
Member
There was a problem hiding this comment.
It would be helpful here to link to the mypy issue, so we can easily refer back to it.
Member
|
The pytype failures are strange: @rchen152 do you know what could be causing this? |
Collaborator
They're strange because pytype is crashing :/ Looking. |
rchen152
added a commit
to google/pytype
that referenced
this pull request
Feb 23, 2021
See python/typeshed#5055. typeshed is moving toward using types from builtins and collections.abc rather than typing (PEP 585). Mostly, this should just work with pytype, since we rewrite typing.X to builtins.x anyway, and the collections.abc types are represented as aliases of the typing ones. However, typing.Callable has its own pytd node type, so we need to special-case collections.abc.Callable in the parser. Since Tuple also has a special node type, I added a test for Tuple as well - that appears to already be working. PiperOrigin-RevId: 359096397
Collaborator
|
This is fixed in pytype-2021.02.23. (I retriggered the pytype check, and it seems happy now.) |
Member
|
Awesome, thanks for the quick fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also remove conventions enforced by black and remove old note about optional default arguments (now part of PEP 484 and enforced by CI).
Unfortunately, due to python/mypy#9980 we need a special rule for
Tuple[x, ...].