Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-15 00:18:19 +00:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions

View File

@@ -89,8 +89,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
# Network I/O methods returning Futures.
async def getaddrinfo(
self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ...
) -> list[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ...
async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ...
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = ...) -> tuple[str, str]: ...
if sys.version_info >= (3, 8):
@overload
async def create_connection(
@@ -104,7 +104,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
@@ -141,7 +141,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
@@ -174,7 +174,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
@overload
@@ -288,8 +288,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
async def create_datagram_endpoint(
self,
protocol_factory: _ProtocolFactory,
local_addr: Tuple[str, int] | None = ...,
remote_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
remote_addr: tuple[str, int] | None = ...,
*,
family: int = ...,
proto: int = ...,
@@ -343,12 +343,12 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
async def sock_recv_into(self, sock: socket, buf: bytearray) -> int: ...
async def sock_sendall(self, sock: socket, data: bytes) -> None: ...
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
async def sock_accept(self, sock: socket) -> Tuple[socket, _RetAddress]: ...
async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ...
else:
def sock_recv(self, sock: socket, nbytes: int) -> Future[bytes]: ...
def sock_sendall(self, sock: socket, data: bytes) -> Future[None]: ...
def sock_connect(self, sock: socket, address: _Address) -> Future[None]: ...
def sock_accept(self, sock: socket) -> Future[Tuple[socket, _RetAddress]]: ...
def sock_accept(self, sock: socket) -> Future[tuple[socket, _RetAddress]]: ...
# Signal handling.
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
def remove_signal_handler(self, sig: int) -> bool: ...

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Sequence, Tuple
from typing import Any, Callable, Sequence
from typing_extensions import Literal
if sys.version_info >= (3, 7):
@@ -14,7 +14,7 @@ _FINISHED: Literal["FINISHED"] # undocumented
def isfuture(obj: object) -> bool: ...
if sys.version_info >= (3, 7):
def _format_callbacks(cb: Sequence[Tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented
def _format_callbacks(cb: Sequence[tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented
else:
def _format_callbacks(cb: Sequence[Callable[[futures.Future[Any]], None]]) -> str: ... # undocumented

View File

@@ -14,7 +14,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
_pid: int | None # undocumented
_returncode: int | None # undocumented
_exit_waiters: list[futures.Future[Any]] # undocumented
_pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
_pending_calls: Deque[tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
_pipes: dict[int, _File] # undocumented
_finished: bool # undocumented
def __init__(

View File

@@ -120,9 +120,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
@abstractmethod
async def getaddrinfo(
self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ...
) -> list[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ...
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
@abstractmethod
async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ...
async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = ...) -> tuple[str, str]: ...
if sys.version_info >= (3, 8):
@overload
@abstractmethod
@@ -137,7 +137,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
@@ -176,7 +176,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
@@ -211,7 +211,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
@overload
@@ -362,8 +362,8 @@ class AbstractEventLoop(metaclass=ABCMeta):
async def create_datagram_endpoint(
self,
protocol_factory: _ProtocolFactory,
local_addr: Tuple[str, int] | None = ...,
remote_addr: Tuple[str, int] | None = ...,
local_addr: tuple[str, int] | None = ...,
remote_addr: tuple[str, int] | None = ...,
*,
family: int = ...,
proto: int = ...,
@@ -430,7 +430,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
@abstractmethod
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
@abstractmethod
async def sock_accept(self, sock: socket) -> Tuple[socket, _RetAddress]: ...
async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ...
else:
@abstractmethod
def sock_recv(self, sock: socket, nbytes: int) -> Future[bytes]: ...
@@ -439,7 +439,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
@abstractmethod
def sock_connect(self, sock: socket, address: _Address) -> Future[None]: ...
@abstractmethod
def sock_accept(self, sock: socket) -> Future[Tuple[socket, _RetAddress]]: ...
def sock_accept(self, sock: socket) -> Future[tuple[socket, _RetAddress]]: ...
# Signal handling.
@abstractmethod
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...

View File

@@ -2,7 +2,7 @@ import functools
import sys
import traceback
from types import FrameType, FunctionType
from typing import Any, Iterable, Tuple, Union, overload
from typing import Any, Iterable, Union, overload
class _HasWrapper:
__wrapper__: _HasWrapper | FunctionType
@@ -11,9 +11,9 @@ _FuncType = Union[FunctionType, _HasWrapper, functools.partial[Any], functools.p
if sys.version_info >= (3, 7):
@overload
def _get_function_source(func: _FuncType) -> Tuple[str, int]: ...
def _get_function_source(func: _FuncType) -> tuple[str, int]: ...
@overload
def _get_function_source(func: object) -> Tuple[str, int] | None: ...
def _get_function_source(func: object) -> tuple[str, int] | None: ...
def _format_callback_source(func: object, args: Iterable[Any]) -> str: ...
def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ...
def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = ...) -> str: ...

View File

@@ -1,6 +1,6 @@
import sys
from concurrent.futures._base import Error, Future as _ConcurrentFuture
from typing import Any, Awaitable, Callable, Generator, Iterable, Tuple, TypeVar
from typing import Any, Awaitable, Callable, Generator, Iterable, TypeVar
from .events import AbstractEventLoop
@@ -38,7 +38,7 @@ class Future(Awaitable[_T], Iterable[_T]):
def __del__(self) -> None: ...
if sys.version_info >= (3, 7):
def get_loop(self) -> AbstractEventLoop: ...
def _callbacks(self: _S) -> list[Tuple[Callable[[_S], Any], Context]]: ...
def _callbacks(self: _S) -> list[tuple[Callable[[_S], Any], Context]]: ...
def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ...
else:
@property

View File

@@ -1,6 +1,5 @@
import sys
from asyncio import transports
from typing import Tuple
class BaseProtocol:
def connection_made(self, transport: transports.BaseTransport) -> None: ...
@@ -19,7 +18,7 @@ if sys.version_info >= (3, 7):
class DatagramProtocol(BaseProtocol):
def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore
def datagram_received(self, data: bytes, addr: Tuple[str, int]) -> None: ...
def datagram_received(self, data: bytes, addr: tuple[str, int]) -> None: ...
def error_received(self, exc: Exception) -> None: ...
class SubprocessProtocol(BaseProtocol):

View File

@@ -1,6 +1,6 @@
import ssl
import sys
from typing import Any, Callable, ClassVar, Deque, Tuple
from typing import Any, Callable, ClassVar, Deque
from typing_extensions import Literal
from . import constants, events, futures, protocols, transports
@@ -38,8 +38,8 @@ class _SSLPipe:
def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> list[bytes]: ...
def shutdown(self, callback: Callable[[], None] | None = ...) -> list[bytes]: ...
def feed_eof(self) -> None: ...
def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[list[bytes], list[bytes]]: ...
def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[list[bytes], int]: ...
def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> tuple[list[bytes], list[bytes]]: ...
def feed_appdata(self, data: bytes, offset: int = ...) -> tuple[list[bytes], int]: ...
class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
@@ -73,7 +73,7 @@ class SSLProtocol(protocols.Protocol):
_server_hostname: str | None
_sslcontext: ssl.SSLContext
_extra: dict[str, Any]
_write_backlog: Deque[Tuple[bytes, int]]
_write_backlog: Deque[tuple[bytes, int]]
_write_buffer_size: int
_waiter: futures.Future[Any]
_loop: events.AbstractEventLoop

View File

@@ -1,9 +1,9 @@
import sys
from typing import Any, Awaitable, Callable, Iterable, Tuple
from typing import Any, Awaitable, Callable, Iterable
from . import events
if sys.version_info >= (3, 8):
async def staggered_race(
coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = ...
) -> Tuple[Any, int | None, list[Exception | None]]: ...
) -> tuple[Any, int | None, list[Exception | None]]: ...

View File

@@ -1,6 +1,6 @@
import sys
from _typeshed import StrPath
from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Optional, Tuple
from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Optional
from . import events, protocols, transports
from .base_events import Server
@@ -24,7 +24,7 @@ async def open_connection(
limit: int = ...,
ssl_handshake_timeout: float | None = ...,
**kwds: Any,
) -> Tuple[StreamReader, StreamWriter]: ...
) -> tuple[StreamReader, StreamWriter]: ...
async def start_server(
client_connected_cb: _ClientConnectedCallback,
host: str | None = ...,
@@ -43,7 +43,7 @@ if sys.platform != "win32":
_PathType = str
async def open_unix_connection(
path: _PathType | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., **kwds: Any
) -> Tuple[StreamReader, StreamWriter]: ...
) -> tuple[StreamReader, StreamWriter]: ...
async def start_unix_server(
client_connected_cb: _ClientConnectedCallback,
path: _PathType | None = ...,

View File

@@ -2,7 +2,7 @@ import subprocess
import sys
from _typeshed import StrOrBytesPath
from asyncio import events, protocols, streams, transports
from typing import IO, Any, Callable, Tuple, Union
from typing import IO, Any, Callable, Union
from typing_extensions import Literal
if sys.version_info >= (3, 8):
@@ -38,7 +38,7 @@ class Process:
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
async def communicate(self, input: bytes | None = ...) -> Tuple[bytes, bytes]: ...
async def communicate(self, input: bytes | None = ...) -> tuple[bytes, bytes]: ...
if sys.version_info >= (3, 10):
async def create_subprocess_shell(

View File

@@ -2,7 +2,7 @@ import concurrent.futures
import sys
from collections.abc import Awaitable, Generator, Iterable, Iterator
from types import FrameType
from typing import Any, Generic, Optional, Set, TextIO, Tuple, TypeVar, Union, overload
from typing import Any, Generic, Optional, Set, TextIO, TypeVar, Union, overload
from typing_extensions import Literal
from .events import AbstractEventLoop
@@ -47,11 +47,11 @@ def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | No
# typing PR #1550 for discussion.
if sys.version_info >= (3, 10):
@overload
def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1]]: ...
def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: Literal[False] = ...) -> Future[tuple[_T1]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], *, return_exceptions: Literal[False] = ...
) -> Future[Tuple[_T1, _T2]]: ...
) -> Future[tuple[_T1, _T2]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -59,7 +59,7 @@ if sys.version_info >= (3, 10):
coro_or_future3: _FutureT[_T3],
*,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2, _T3]]: ...
) -> Future[tuple[_T1, _T2, _T3]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -68,7 +68,7 @@ if sys.version_info >= (3, 10):
coro_or_future4: _FutureT[_T4],
*,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ...
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -78,7 +78,7 @@ if sys.version_info >= (3, 10):
coro_or_future5: _FutureT[_T5],
*,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def gather(
coro_or_future1: _FutureT[Any],
@@ -91,11 +91,11 @@ if sys.version_info >= (3, 10):
return_exceptions: bool = ...,
) -> Future[list[Any]]: ...
@overload
def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: bool = ...) -> Future[Tuple[_T1 | BaseException]]: ...
def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: bool = ...) -> Future[tuple[_T1 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], *, return_exceptions: bool = ...
) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -103,7 +103,7 @@ if sys.version_info >= (3, 10):
coro_or_future3: _FutureT[_T3],
*,
return_exceptions: bool = ...,
) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -112,7 +112,7 @@ if sys.version_info >= (3, 10):
coro_or_future4: _FutureT[_T4],
*,
return_exceptions: bool = ...,
) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -123,14 +123,14 @@ if sys.version_info >= (3, 10):
*,
return_exceptions: bool = ...,
) -> Future[
Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
]: ...
else:
@overload
def gather(
coro_or_future1: _FutureT[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ...
) -> Future[Tuple[_T1]]: ...
) -> Future[tuple[_T1]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -138,7 +138,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2]]: ...
) -> Future[tuple[_T1, _T2]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -147,7 +147,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2, _T3]]: ...
) -> Future[tuple[_T1, _T2, _T3]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -157,7 +157,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ...
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -168,7 +168,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def gather(
coro_or_future1: _FutureT[Any],
@@ -184,7 +184,7 @@ else:
@overload
def gather(
coro_or_future1: _FutureT[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: bool = ...
) -> Future[Tuple[_T1 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -192,7 +192,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: bool = ...,
) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -201,7 +201,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: bool = ...,
) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -211,7 +211,7 @@ else:
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: bool = ...,
) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
@overload
def gather(
coro_or_future1: _FutureT[_T1],
@@ -223,7 +223,7 @@ else:
loop: AbstractEventLoop | None = ...,
return_exceptions: bool = ...,
) -> Future[
Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
]: ...
def run_coroutine_threadsafe(coro: _FutureT[_T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
@@ -232,22 +232,22 @@ if sys.version_info >= (3, 10):
def shield(arg: _FutureT[_T]) -> Future[_T]: ...
def sleep(delay: float, result: _T = ...) -> Future[_T]: ...
@overload
def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[Tuple[Set[_FT], Set[_FT]]]: ... # type: ignore
def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[Set[_FT], Set[_FT]]]: ... # type: ignore
@overload
def wait(
fs: Iterable[Awaitable[_T]], *, timeout: float | None = ..., return_when: str = ...
) -> Future[Tuple[Set[Task[_T]], Set[Task[_T]]]]: ...
) -> Future[tuple[Set[Task[_T]], Set[Task[_T]]]]: ...
def wait_for(fut: _FutureT[_T], timeout: float | None) -> Future[_T]: ...
else:
def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
def sleep(delay: float, result: _T = ..., *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
@overload
def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[Tuple[Set[_FT], Set[_FT]]]: ... # type: ignore
def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[tuple[Set[_FT], Set[_FT]]]: ... # type: ignore
@overload
def wait(
fs: Iterable[Awaitable[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...
) -> Future[Tuple[Set[Task[_T]], Set[Task[_T]]]]: ...
) -> Future[tuple[Set[Task[_T]], Set[Task[_T]]]]: ...
def wait_for(fut: _FutureT[_T], timeout: float | None, *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
class Task(Future[_T], Generic[_T]):

View File

@@ -2,7 +2,7 @@ import sys
from asyncio.events import AbstractEventLoop
from asyncio.protocols import BaseProtocol
from socket import _Address
from typing import Any, Mapping, Tuple
from typing import Any, Mapping
class BaseTransport:
def __init__(self, extra: Mapping[Any, Any] | None = ...) -> None: ...
@@ -43,4 +43,4 @@ class SubprocessTransport(BaseTransport):
class _FlowControlMixin(Transport):
def __init__(self, extra: Mapping[Any, Any] | None = ..., loop: AbstractEventLoop | None = ...) -> None: ...
def get_write_buffer_limits(self) -> Tuple[int, int]: ...
def get_write_buffer_limits(self) -> tuple[int, int]: ...

View File

@@ -34,14 +34,14 @@ if sys.version_info >= (3, 8):
def getpeername(self) -> _RetAddress: ...
def getsockname(self) -> _RetAddress: ...
def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through?
def accept(self) -> Tuple[socket.socket, _RetAddress]: ...
def accept(self) -> tuple[socket.socket, _RetAddress]: ...
def connect(self, address: _Address | bytes) -> None: ...
def connect_ex(self, address: _Address | bytes) -> int: ...
def bind(self, address: _Address | bytes) -> None: ...
if sys.platform == "win32":
def ioctl(self, control: int, option: int | Tuple[int, int, int] | bool) -> None: ...
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ...
else:
def ioctl(self, control: int, option: int | Tuple[int, int, int] | bool) -> NoReturn: ...
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> NoReturn: ...
def listen(self, __backlog: int = ...) -> None: ...
def makefile(self) -> BinaryIO: ...
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
@@ -70,12 +70,12 @@ if sys.version_info >= (3, 8):
else:
def share(self, process_id: int) -> NoReturn: ...
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ...
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
def recvmsg_into(
self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ...
) -> Tuple[int, list[_CMSG], int, Any]: ...
def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, list[_CMSG], int, Any]: ...
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ...
) -> tuple[int, list[_CMSG], int, Any]: ...
def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> tuple[bytes, list[_CMSG], int, Any]: ...
def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def settimeout(self, value: float | None) -> None: ...
def gettimeout(self) -> float | None: ...

View File

@@ -1,7 +1,7 @@
import socket
import sys
from _typeshed import WriteableBuffer
from typing import IO, Any, Callable, ClassVar, NoReturn, Tuple, Type
from typing import IO, Any, Callable, ClassVar, NoReturn, Type
from . import events, futures, proactor_events, selector_events, streams, windows_utils
@@ -33,7 +33,7 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
def __init__(self, proactor: IocpProactor | None = ...) -> None: ...
async def create_pipe_connection(
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
) -> Tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ...
) -> tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ...
async def start_serving_pipe(
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
) -> list[PipeServer]: ...

View File

@@ -1,7 +1,7 @@
import sys
from _typeshed import Self
from types import TracebackType
from typing import Callable, Protocol, Tuple, Type
from typing import Callable, Protocol, Type
class _WarnFunction(Protocol):
def __call__(self, message: str, category: Type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...) -> None: ...
@@ -10,7 +10,7 @@ BUFSIZE: int
PIPE: int
STDOUT: int
def pipe(*, duplex: bool = ..., overlapped: Tuple[bool, bool] = ..., bufsize: int = ...) -> Tuple[int, int]: ...
def pipe(*, duplex: bool = ..., overlapped: tuple[bool, bool] = ..., bufsize: int = ...) -> tuple[int, int]: ...
class PipeHandle:
def __init__(self, handle: int) -> None: ...