mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Big diff: use lower-case list and dict (#5888)
This commit is contained in:
@@ -9,7 +9,7 @@ from asyncio.tasks import Task
|
||||
from asyncio.transports import BaseTransport
|
||||
from collections.abc import Iterable
|
||||
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Sequence, Tuple, TypeVar, Union, overload
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, Sequence, Tuple, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -89,7 +89,7 @@ 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]]]: ...
|
||||
) -> 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Callable, List, Sequence, Tuple
|
||||
from typing import Any, Callable, Sequence, Tuple
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -19,4 +19,4 @@ if sys.version_info >= (3, 7):
|
||||
else:
|
||||
def _format_callbacks(cb: Sequence[Callable[[futures.Future[Any]], None]]) -> str: ... # undocumented
|
||||
|
||||
def _future_repr_info(future: futures.Future[Any]) -> List[str]: ... # undocumented
|
||||
def _future_repr_info(future: futures.Future[Any]) -> list[str]: ... # undocumented
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import subprocess
|
||||
from typing import IO, Any, Callable, Deque, Dict, List, Optional, Sequence, Tuple, Union
|
||||
from typing import IO, Any, Callable, Deque, Optional, Sequence, Tuple, Union
|
||||
|
||||
from . import events, futures, protocols, transports
|
||||
|
||||
@@ -13,9 +13,9 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
|
||||
_proc: subprocess.Popen[Any] | None # undocumented
|
||||
_pid: int | None # undocumented
|
||||
_returncode: int | None # undocumented
|
||||
_exit_waiters: List[futures.Future[Any]] # undocumented
|
||||
_exit_waiters: list[futures.Future[Any]] # undocumented
|
||||
_pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
|
||||
_pipes: Dict[int, _File] # undocumented
|
||||
_pipes: dict[int, _File] # undocumented
|
||||
_finished: bool # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import FrameType
|
||||
from typing import Any, List
|
||||
from typing import Any
|
||||
|
||||
from . import tasks
|
||||
|
||||
def _task_repr_info(task: tasks.Task[Any]) -> List[str]: ... # undocumented
|
||||
def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> List[FrameType]: ... # undocumented
|
||||
def _task_repr_info(task: tasks.Task[Any]) -> list[str]: ... # undocumented
|
||||
def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> list[FrameType]: ... # undocumented
|
||||
def _task_print_stack(task: tasks.Task[Any], limit: int | None, file: StrOrBytesPath) -> None: ... # undocumented
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
PY34: bool
|
||||
PY35: bool
|
||||
PY352: bool
|
||||
def flatten_list_bytes(list_of_data: List[bytes]) -> bytes: ...
|
||||
def flatten_list_bytes(list_of_data: list[bytes]) -> bytes: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
from _typeshed import FileDescriptorLike, Self
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Sequence, Tuple, TypeVar, Union, overload
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, Sequence, Tuple, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .base_events import Server
|
||||
@@ -120,7 +120,7 @@ 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]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
@@ -2,7 +2,7 @@ import functools
|
||||
import sys
|
||||
import traceback
|
||||
from types import FrameType, FunctionType
|
||||
from typing import Any, Dict, Iterable, Tuple, Union, overload
|
||||
from typing import Any, Iterable, Tuple, Union, overload
|
||||
|
||||
class _HasWrapper:
|
||||
__wrapper__: _HasWrapper | FunctionType
|
||||
@@ -15,6 +15,6 @@ if sys.version_info >= (3, 7):
|
||||
@overload
|
||||
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: ...
|
||||
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: ...
|
||||
def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> traceback.StackSummary: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from concurrent.futures._base import Error, Future as _ConcurrentFuture
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Tuple, TypeVar
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, Tuple, TypeVar
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
@@ -20,7 +20,7 @@ _S = TypeVar("_S")
|
||||
if sys.version_info < (3, 7):
|
||||
class _TracebackLogger:
|
||||
exc: BaseException
|
||||
tb: List[str]
|
||||
tb: list[str]
|
||||
def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ...
|
||||
def activate(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
@@ -38,11 +38,11 @@ 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
|
||||
def _callbacks(self: _S) -> List[Callable[[_S], Any]]: ...
|
||||
def _callbacks(self: _S) -> list[Callable[[_S], Any]]: ...
|
||||
def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def cancel(self, msg: str | None = ...) -> bool: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Deque, Dict, List, Tuple
|
||||
from typing import Any, Callable, ClassVar, Deque, Tuple
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import constants, events, futures, protocols, transports
|
||||
@@ -35,11 +35,11 @@ class _SSLPipe:
|
||||
def need_ssldata(self) -> bool: ...
|
||||
@property
|
||||
def wrapped(self) -> bool: ...
|
||||
def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> List[bytes]: ...
|
||||
def shutdown(self, callback: Callable[[], None] | None = ...) -> List[bytes]: ...
|
||||
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):
|
||||
|
||||
@@ -49,7 +49,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
|
||||
_ssl_protocol: SSLProtocol
|
||||
_closed: bool
|
||||
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
|
||||
def get_extra_info(self, name: str, default: Any | None = ...) -> Dict[str, Any]: ...
|
||||
def get_extra_info(self, name: str, default: Any | None = ...) -> dict[str, Any]: ...
|
||||
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
|
||||
def get_protocol(self) -> protocols.BaseProtocol: ...
|
||||
def is_closing(self) -> bool: ...
|
||||
@@ -72,7 +72,7 @@ class SSLProtocol(protocols.Protocol):
|
||||
_server_side: bool
|
||||
_server_hostname: str | None
|
||||
_sslcontext: ssl.SSLContext
|
||||
_extra: Dict[str, Any]
|
||||
_extra: dict[str, Any]
|
||||
_write_backlog: Deque[Tuple[bytes, int]]
|
||||
_write_buffer_size: int
|
||||
_waiter: futures.Future[Any]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable, Iterable, List, Tuple
|
||||
from typing import Any, Awaitable, Callable, Iterable, Tuple
|
||||
|
||||
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]]: ...
|
||||
|
||||
@@ -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, List, Optional, Set, TextIO, Tuple, TypeVar, Union, overload
|
||||
from typing import Any, Generic, Optional, Set, TextIO, Tuple, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
@@ -89,7 +89,7 @@ if sys.version_info >= (3, 10):
|
||||
coro_or_future6: _FutureT[Any],
|
||||
*coros_or_futures: _FutureT[Any],
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[List[Any]]: ...
|
||||
) -> Future[list[Any]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: bool = ...) -> Future[Tuple[_T1 | BaseException]]: ...
|
||||
@overload
|
||||
@@ -180,7 +180,7 @@ else:
|
||||
*coros_or_futures: _FutureT[Any],
|
||||
loop: AbstractEventLoop | None = ...,
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[List[Any]]: ...
|
||||
) -> Future[list[Any]]: ...
|
||||
@overload
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: bool = ...
|
||||
@@ -268,7 +268,7 @@ class Task(Future[_T], Generic[_T]):
|
||||
def get_coro(self) -> Generator[_TaskYieldType, None, _T] | Awaitable[_T]: ...
|
||||
def get_name(self) -> str: ...
|
||||
def set_name(self, __value: object) -> None: ...
|
||||
def get_stack(self, *, limit: int | None = ...) -> List[FrameType]: ...
|
||||
def get_stack(self, *, limit: int | None = ...) -> list[FrameType]: ...
|
||||
def print_stack(self, *, limit: int | None = ..., file: TextIO | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def cancel(self, msg: str | None = ...) -> bool: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from socket import _Address
|
||||
from typing import Any, List, Mapping, Tuple
|
||||
from typing import Any, Mapping, Tuple
|
||||
|
||||
class BaseTransport:
|
||||
def __init__(self, extra: Mapping[Any, Any] | None = ...) -> None: ...
|
||||
@@ -22,7 +22,7 @@ class WriteTransport(BaseTransport):
|
||||
def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ...
|
||||
def get_write_buffer_size(self) -> int: ...
|
||||
def write(self, data: Any) -> None: ...
|
||||
def writelines(self, list_of_data: List[Any]) -> None: ...
|
||||
def writelines(self, list_of_data: list[Any]) -> None: ...
|
||||
def write_eof(self) -> None: ...
|
||||
def can_write_eof(self) -> bool: ...
|
||||
def abort(self) -> None: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import socket
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Any, BinaryIO, Iterable, List, NoReturn, Tuple, Type, Union, overload
|
||||
from typing import Any, BinaryIO, Iterable, NoReturn, Tuple, Type, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
# These are based in socket, maybe move them out into _typeshed.pyi or such
|
||||
@@ -73,8 +73,8 @@ if sys.version_info >= (3, 8):
|
||||
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]: ...
|
||||
) -> 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: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import socket
|
||||
import sys
|
||||
from _typeshed import WriteableBuffer
|
||||
from typing import IO, Any, Callable, ClassVar, List, NoReturn, Tuple, Type
|
||||
from typing import IO, Any, Callable, ClassVar, NoReturn, Tuple, Type
|
||||
|
||||
from . import events, futures, proactor_events, selector_events, streams, windows_utils
|
||||
|
||||
@@ -36,14 +36,14 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
|
||||
) -> Tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ...
|
||||
async def start_serving_pipe(
|
||||
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
|
||||
) -> List[PipeServer]: ...
|
||||
) -> list[PipeServer]: ...
|
||||
|
||||
class IocpProactor:
|
||||
def __init__(self, concurrency: int = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __del__(self) -> None: ...
|
||||
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
|
||||
def select(self, timeout: int | None = ...) -> List[futures.Future[Any]]: ...
|
||||
def select(self, timeout: int | None = ...) -> list[futures.Future[Any]]: ...
|
||||
def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ...
|
||||
|
||||
Reference in New Issue
Block a user