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

Replace deprecated typing imports with collections.abc #18336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Dec 25, 2024

No description provided.

@@ -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
Copy link
Collaborator Author

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.

@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Callable, Iterable, Sequence
from collections.abc import Iterable, Sequence
from typing import Callable
Copy link
Collaborator Author

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.

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

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.

1 participant