-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Replace deprecated typing imports with collections.abc #18336
Conversation
@@ -6,7 +6,8 @@ | |||
import os | |||
import os.path | |||
from collections import Counter | |||
from typing import Any, Dict, Final, Iterable | |||
from collections.abc import Iterable | |||
from typing import Any, Dict, Final |
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.
Will replace the generic builtins like Dict
, Tuple
in a followup.
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.
@@ -1,6 +1,7 @@ | |||
from __future__ import annotations | |||
|
|||
from typing import Callable, Iterable, Sequence | |||
from collections.abc import Iterable, Sequence | |||
from typing import Callable |
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.
collections.abc.Callable
is broken inside Union
and Optional
on 3.9.0
and 3.9.1
, so it isn't safe to replace just yet. https://bugs.python.org/issue42965
We could consider bumping requires-python
to >=3.9.2
or just wait until we drop 3.9 next year.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
No description provided.