-
-
Notifications
You must be signed in to change notification settings - Fork 409
mypy: use generic types instead of typing aliases where possible
#2480
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
Conversation
Exirel
left a comment
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.
If mypy doesn't complain, I'm OK with that.
SnoopJ
left a comment
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.
LGTM. I had forgotten that typing.Iterable, typing.Generator were deprecated and I'm annoyed that collections.abc is the "right" way to do it, but that's hardly this PR's fault, and using the generic forms of the built-ins is a huge win.
Description
It turns out that "where possible" is equivalent to "almost everywhere". There are a very few places where we still have to leave
typingaliases in for compatibility with Python versions before 3.9.Checklist
make qa(runsmake qualityandmake test)mypy1.4 under Python 3.8, to make sure none of the changes breaks that version. (I did not bother to test Python 3.7 since it's EOL any day now. Tentatively it's EOL today, but I haven't seen any formal announcement or update to the Python Versions page yet.)Notes
Follow-up to #2471; prerequisite for finishing #2477 (so I can extract a very nice, clean file for packaging externally).
Haven't touched
remindas it's due to be removed shortly (#2478, replaced by external package).