Upgrade black version (#7089)

This commit is contained in:
Shantanu
2022-01-30 16:27:06 -08:00
committed by GitHub
parent 9854926289
commit b88a6f19cd
173 changed files with 496 additions and 2 deletions

View File

@@ -69,6 +69,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ...
def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ...
def time(self) -> float: ...
# Future methods
def create_future(self) -> Future[Any]: ...
@@ -77,6 +78,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T], *, name: object = ...) -> Task[_T]: ...
else:
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T]) -> Task[_T]: ...
def set_task_factory(self, factory: Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None) -> None: ...
def get_task_factory(self) -> Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None: ...
# Methods for interacting with threads
@@ -84,6 +86,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ...
else:
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ...
def set_default_executor(self, executor: Any) -> None: ...
# Network I/O methods returning Futures.

View File

@@ -32,6 +32,7 @@ class Handle:
) -> None: ...
else:
def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
def cancel(self) -> None: ...
def _run(self) -> None: ...
if sys.version_info >= (3, 7):
@@ -49,6 +50,7 @@ class TimerHandle(Handle):
) -> None: ...
else:
def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 7):
def when(self) -> float: ...
@@ -62,6 +64,7 @@ class AbstractServer:
def is_serving(self) -> bool: ...
async def start_serving(self) -> None: ...
async def serve_forever(self) -> None: ...
async def wait_closed(self) -> None: ...
class AbstractEventLoop(metaclass=ABCMeta):
@@ -104,6 +107,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
else:
@abstractmethod
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T]) -> Task[_T]: ...
@abstractmethod
def set_task_factory(self, factory: Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None) -> None: ...
@abstractmethod
@@ -357,6 +361,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
backlog: int = ...,
ssl: _SSLContext = ...,
) -> Server: ...
@abstractmethod
async def create_datagram_endpoint(
self,

View File

@@ -6,6 +6,7 @@ from .events import AbstractEventLoop
if sys.version_info < (3, 8):
from concurrent.futures import CancelledError as CancelledError, TimeoutError as TimeoutError
class InvalidStateError(Error): ...
if sys.version_info >= (3, 7):
@@ -48,6 +49,7 @@ class Future(Awaitable[_T], Iterable[_T]):
def cancel(self, msg: Any | None = ...) -> bool: ...
else:
def cancel(self) -> bool: ...
def cancelled(self) -> bool: ...
def done(self) -> bool: ...
def result(self) -> _T: ...

View File

@@ -21,6 +21,7 @@ else:
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
class _ContextManagerMixin:
def __init__(self, lock: Lock | Semaphore) -> None: ...
# Apparently this exists to *prohibit* use as a context manager.

View File

@@ -25,6 +25,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr
def __del__(self, _warn: _WarnCallbackProtocol = ...) -> None: ...
else:
def __del__(self) -> None: ...
def get_write_buffer_size(self) -> int: ...
class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport):

View File

@@ -57,6 +57,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
def close(self) -> None: ...
if sys.version_info >= (3, 7):
def is_reading(self) -> bool: ...
def pause_reading(self) -> None: ...
def resume_reading(self) -> None: ...
def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ...
@@ -64,6 +65,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
if sys.version_info >= (3, 7):
@property
def _protocol_paused(self) -> bool: ...
def write(self, data: bytes) -> None: ...
def can_write_eof(self) -> Literal[False]: ...
def abort(self) -> None: ...
@@ -114,6 +116,7 @@ class SSLProtocol(protocols.Protocol):
) -> None: ...
if sys.version_info >= (3, 7):
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: BaseException | None) -> None: ...
@@ -127,6 +130,7 @@ class SSLProtocol(protocols.Protocol):
def _start_handshake(self) -> None: ...
if sys.version_info >= (3, 7):
def _check_handshake_timeout(self) -> None: ...
def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ...
def _process_write_backlog(self) -> None: ...
def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ...

View File

@@ -12,6 +12,7 @@ if sys.version_info < (3, 8):
expected: int | None
partial: bytes
def __init__(self, partial: bytes, expected: int | None) -> None: ...
class LimitOverrunError(Exception):
consumed: int
def __init__(self, message: str, consumed: int) -> None: ...
@@ -114,6 +115,7 @@ class StreamWriter:
if sys.version_info >= (3, 7):
def is_closing(self) -> bool: ...
async def wait_closed(self) -> None: ...
def get_extra_info(self, name: str, default: Any = ...) -> Any: ...
async def drain(self) -> None: ...

View File

@@ -269,6 +269,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 print_stack(self, *, limit: int | None = ..., file: TextIO | None = ...) -> None: ...
if sys.version_info >= (3, 9):
@@ -291,6 +292,7 @@ if sys.version_info >= (3, 7):
def create_task(coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T], *, name: str | None = ...) -> Task[_T]: ...
else:
def create_task(coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T]) -> Task[_T]: ...
def current_task(loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ...
def _enter_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ...
def _leave_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ...

View File

@@ -15,6 +15,7 @@ class BaseTransport:
class ReadTransport(BaseTransport):
if sys.version_info >= (3, 7):
def is_reading(self) -> bool: ...
def pause_reading(self) -> None: ...
def resume_reading(self) -> None: ...

View File

@@ -43,6 +43,7 @@ class TransportSocket:
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 listen(self, __backlog: int = ...) -> None: ...
def makefile(self) -> BinaryIO: ...
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
@@ -56,6 +57,7 @@ class TransportSocket:
def sendmsg_afalg(
self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> NoReturn: ...
def sendmsg(
self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ...
) -> int: ...
@@ -70,6 +72,7 @@ class TransportSocket:
def share(self, process_id: int) -> bytes: ...
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 recvmsg_into(

View File

@@ -24,10 +24,13 @@ class AbstractChildWatcher:
if sys.platform != "win32":
class BaseChildWatcher(AbstractChildWatcher):
def __init__(self) -> None: ...
class SafeChildWatcher(BaseChildWatcher):
def __enter__(self: Self) -> Self: ...
class FastChildWatcher(BaseChildWatcher):
def __enter__(self: Self) -> Self: ...
class _UnixSelectorEventLoop(BaseSelectorEventLoop):
if sys.version_info < (3, 7):
async def create_unix_server(
@@ -39,6 +42,7 @@ if sys.platform != "win32":
backlog: int = ...,
ssl: _SSLContext = ...,
) -> Server: ...
class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
def get_child_watcher(self) -> AbstractChildWatcher: ...
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
@@ -49,12 +53,15 @@ if sys.platform != "win32":
if sys.version_info >= (3, 8):
from typing import Protocol
class _Warn(Protocol):
def __call__(
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> None: ...
class MultiLoopChildWatcher(AbstractChildWatcher):
def __enter__(self: Self) -> Self: ...
class ThreadedChildWatcher(AbstractChildWatcher):
def __enter__(self: Self) -> Self: ...
def __del__(self, _warn: _Warn = ...) -> None: ...

View File

@@ -25,12 +25,15 @@ if sys.platform == "win32":
ERROR_CONNECTION_ABORTED: Literal[1236]
CONNECT_PIPE_INIT_DELAY: float
CONNECT_PIPE_MAX_DELAY: float
class PipeServer:
def __init__(self, address: str) -> None: ...
def __del__(self) -> None: ...
def closed(self) -> bool: ...
def close(self) -> None: ...
class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ...
class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
def __init__(self, proactor: IocpProactor | None = ...) -> None: ...
async def create_pipe_connection(
@@ -39,6 +42,7 @@ if sys.platform == "win32":
async def start_serving_pipe(
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
) -> list[PipeServer]: ...
class IocpProactor:
def __init__(self, concurrency: int = ...) -> None: ...
def __del__(self) -> None: ...
@@ -47,11 +51,13 @@ if sys.platform == "win32":
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]: ...
def send(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ...
def accept(self, listener: socket.socket) -> futures.Future[Any]: ...
def connect(self, conn: socket.socket, address: bytes) -> futures.Future[Any]: ...
if sys.version_info >= (3, 7):
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ...
async def connect_pipe(self, address: bytes) -> windows_utils.PipeHandle: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = ...) -> bool: ...
@@ -63,6 +69,7 @@ if sys.platform == "win32":
_loop_factory: ClassVar[type[SelectorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[type[ProactorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...

View File

@@ -14,12 +14,14 @@ if sys.platform == "win32":
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
def pipe(*, duplex: bool = ..., overlapped: tuple[bool, bool] = ..., bufsize: int = ...) -> tuple[int, int]: ...
class PipeHandle:
def __init__(self, handle: int) -> None: ...
if sys.version_info >= (3, 8):
def __del__(self, _warn: _WarnFunction = ...) -> None: ...
else:
def __del__(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, t: type | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
@property