Import from collections.abc wherever possible (#7635)

This commit is contained in:
Alex Waygood
2022-04-18 11:50:37 +01:00
committed by GitHub
parent a17b3afb16
commit 97a74bc1aa
230 changed files with 449 additions and 348 deletions

View File

@@ -1,6 +1,6 @@
from collections.abc import Mapping, Sequence
from importlib.abc import Loader
from types import ModuleType
from typing import Mapping, Sequence
__all__ = ["__import__", "import_module", "invalidate_caches", "reload"]

View File

@@ -10,9 +10,10 @@ from _typeshed import (
StrPath,
)
from abc import ABCMeta, abstractmethod
from collections.abc import Iterator, Mapping, Sequence
from importlib.machinery import ModuleSpec
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
from typing import IO, Any, BinaryIO, Iterator, Mapping, NoReturn, Protocol, Sequence, overload, runtime_checkable
from typing import IO, Any, BinaryIO, NoReturn, Protocol, overload, runtime_checkable
from typing_extensions import Literal, TypeAlias
_Path: TypeAlias = bytes | str

View File

@@ -1,7 +1,8 @@
import importlib.abc
import sys
import types
from typing import Any, Callable, Iterable, Sequence
from collections.abc import Callable, Iterable, Sequence
from typing import Any
if sys.version_info >= (3, 8):
from importlib.metadata import DistributionFinder, PathDistribution

View File

@@ -2,12 +2,12 @@ import abc
import pathlib
import sys
from _typeshed import Self, StrPath
from collections.abc import Mapping
from collections.abc import Iterable, Mapping
from email.message import Message
from importlib.abc import MetaPathFinder
from os import PathLike
from pathlib import Path
from typing import Any, ClassVar, Iterable, NamedTuple, Pattern, overload
from typing import Any, ClassVar, NamedTuple, Pattern, overload
if sys.version_info >= (3, 10):
__all__ = [

View File

@@ -1,4 +1,5 @@
from typing import Any, Iterator, Protocol, TypeVar
from collections.abc import Iterator
from typing import Any, Protocol, TypeVar
_T = TypeVar("_T")

View File

@@ -1,9 +1,10 @@
import os
import sys
from collections.abc import Iterator
from contextlib import AbstractContextManager
from pathlib import Path
from types import ModuleType
from typing import Any, BinaryIO, Iterator, TextIO
from typing import Any, BinaryIO, TextIO
from typing_extensions import TypeAlias
if sys.version_info >= (3, 10):

View File

@@ -3,7 +3,8 @@ import importlib.machinery
import sys
import types
from _typeshed import StrOrBytesPath
from typing import Any, Callable
from collections.abc import Callable
from typing import Any
from typing_extensions import ParamSpec
_P = ParamSpec("_P")