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

@@ -6,9 +6,9 @@ from asyncio.futures import Future
from asyncio.protocols import BaseProtocol
from asyncio.tasks import Task
from asyncio.transports import BaseTransport, ReadTransport, SubprocessTransport, WriteTransport
from collections.abc import Iterable
from collections.abc import Awaitable, Callable, Coroutine, Generator, Iterable, Sequence
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Awaitable, Callable, Coroutine, Generator, Sequence, TypeVar, overload
from typing import IO, Any, TypeVar, overload
from typing_extensions import Literal, TypeAlias
if sys.version_info >= (3, 7):

View File

@@ -1,5 +1,6 @@
import sys
from typing import Any, Callable, Sequence
from collections.abc import Callable, Sequence
from typing import Any
from typing_extensions import Literal
if sys.version_info >= (3, 7):

View File

@@ -1,6 +1,7 @@
import subprocess
from collections import deque
from typing import IO, Any, Callable, Sequence
from collections.abc import Callable, Sequence
from typing import IO, Any
from typing_extensions import TypeAlias
from . import events, futures, protocols, transports

View File

@@ -2,8 +2,9 @@ import ssl
import sys
from _typeshed import FileDescriptorLike, Self
from abc import ABCMeta, abstractmethod
from collections.abc import Awaitable, Callable, Coroutine, Generator, Sequence
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Awaitable, Callable, Coroutine, Generator, Sequence, TypeVar, overload
from typing import IO, Any, TypeVar, overload
from typing_extensions import Literal, TypeAlias
from .base_events import Server

View File

@@ -1,7 +1,8 @@
import functools
import traceback
from collections.abc import Iterable
from types import FrameType, FunctionType
from typing import Any, Iterable, overload
from typing import Any, overload
from typing_extensions import TypeAlias
class _HasWrapper:

View File

@@ -1,7 +1,8 @@
import sys
from _typeshed import Self
from collections.abc import Awaitable, Callable, Generator, Iterable
from concurrent.futures._base import Error, Future as _ConcurrentFuture
from typing import Any, Awaitable, Callable, Generator, Iterable, TypeVar
from typing import Any, TypeVar
from typing_extensions import Literal, TypeGuard
from .events import AbstractEventLoop

View File

@@ -1,7 +1,8 @@
import sys
from collections import deque
from collections.abc import Callable, Generator
from types import TracebackType
from typing import Any, Callable, Generator, TypeVar
from typing import Any, TypeVar
from typing_extensions import Literal
from .events import AbstractEventLoop

View File

@@ -1,6 +1,7 @@
import sys
from collections.abc import Mapping
from socket import socket
from typing import Any, Mapping, Protocol
from typing import Any, Protocol
from typing_extensions import Literal
from . import base_events, constants, events, futures, streams, transports

View File

@@ -1,5 +1,6 @@
import sys
from typing import Awaitable, TypeVar
from collections.abc import Awaitable
from typing import TypeVar
__all__ = ("run",)
_T = TypeVar("_T")

View File

@@ -1,7 +1,8 @@
import ssl
import sys
from collections import deque
from typing import Any, Callable, ClassVar
from collections.abc import Callable
from typing import Any, ClassVar
from typing_extensions import Literal
from . import constants, events, futures, protocols, transports

View File

@@ -1,4 +1,5 @@
from typing import Any, Awaitable, Callable, Iterable
from collections.abc import Awaitable, Callable, Iterable
from typing import Any
from . import events

View File

@@ -1,6 +1,7 @@
import sys
from _typeshed import Self, StrPath
from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Sequence
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence
from typing import Any
from typing_extensions import TypeAlias
from . import events, protocols, transports

View File

@@ -2,7 +2,8 @@ import subprocess
import sys
from _typeshed import StrOrBytesPath
from asyncio import events, protocols, streams, transports
from typing import IO, Any, Callable
from collections.abc import Callable
from typing import IO, Any
from typing_extensions import Literal, TypeAlias
if sys.version_info >= (3, 7):

View File

@@ -1,8 +1,9 @@
# This only exists in 3.11+. See VERSIONS.
from _typeshed import Self
from collections.abc import Coroutine, Generator
from types import TracebackType
from typing import Any, Coroutine, Generator, TypeVar
from typing import Any, TypeVar
from .tasks import Task

View File

@@ -1,8 +1,8 @@
import concurrent.futures
import sys
from collections.abc import Awaitable, Generator, Iterable, Iterator
from collections.abc import Awaitable, Coroutine, Generator, Iterable, Iterator
from types import FrameType
from typing import Any, Coroutine, Generic, TextIO, TypeVar, overload
from typing import Any, Generic, TextIO, TypeVar, overload
from typing_extensions import Literal, TypeAlias
from .events import AbstractEventLoop

View File

@@ -1,4 +1,5 @@
from typing import Callable, TypeVar
from collections.abc import Callable
from typing import TypeVar
from typing_extensions import ParamSpec
__all__ = ("to_thread",)

View File

@@ -1,8 +1,9 @@
import sys
from asyncio.events import AbstractEventLoop
from asyncio.protocols import BaseProtocol
from collections.abc import Mapping
from socket import _Address
from typing import Any, Mapping
from typing import Any
if sys.version_info >= (3, 7):
__all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "DatagramTransport", "SubprocessTransport")

View File

@@ -1,8 +1,9 @@
import socket
import sys
from builtins import type as Type # alias to avoid name clashes with property named "type"
from collections.abc import Iterable
from types import TracebackType
from typing import Any, BinaryIO, Iterable, NoReturn, overload
from typing import Any, BinaryIO, NoReturn, overload
from typing_extensions import TypeAlias
# These are based in socket, maybe move them out into _typeshed.pyi or such

View File

@@ -2,8 +2,9 @@ import sys
import types
from _typeshed import Self
from abc import ABCMeta, abstractmethod
from collections.abc import Callable
from socket import socket
from typing import Any, Callable
from typing import Any
from typing_extensions import Literal
from .base_events import Server

View File

@@ -1,7 +1,8 @@
import socket
import sys
from _typeshed import WriteableBuffer
from typing import IO, Any, Callable, ClassVar, NoReturn
from collections.abc import Callable
from typing import IO, Any, ClassVar, NoReturn
from typing_extensions import Literal
from . import events, futures, proactor_events, selector_events, streams, windows_utils

View File

@@ -1,8 +1,9 @@
import subprocess
import sys
from _typeshed import Self
from collections.abc import Callable
from types import TracebackType
from typing import Any, AnyStr, Callable, Protocol
from typing import Any, AnyStr, Protocol
from typing_extensions import Literal
if sys.platform == "win32":