Repository navigation
Replace deprecated typing.List and friends - #16527
jonathandung wants to merge 9 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| def is_dataclass_any(arg: Any) -> None: | ||
| if dc.is_dataclass(arg): | ||
| assert_type(arg, Union["DataclassInstance", Type["DataclassInstance"]]) | ||
| assert_type(arg, "DataclassInstance" | type["DataclassInstance"]) |
There was a problem hiding this comment.
Isn't this a runtime error (can't do | with a string)? We should avoid using that in tests because a reasonable type checker could error on it.
There was a problem hiding this comment.
ty actually does catch that, i believe, at least in some situations
There was a problem hiding this comment.
I just noticed the file already had from __future__ import annotations at the beginning. I believe the quotes can be removed (correct me if I'm wrong).
There was a problem hiding this comment.
That doesn't do anything here because this is not an annotation.
There was a problem hiding this comment.
Though maybe the quotes can be removed anyway here, not sure why they would be needed.
|
Diff from mypy_primer, showing the effect of this PR on open source code: scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
|
Since Python 3.10 is the lowest supported Python version, this pull request replaces some of the instances of
typing.List,typing.Tupleandtyping.UnionI found across the repository withlist,tupleand|respectively. This removal mainly applies to tests.