mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-26 05:41:11 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
@@ -1,28 +1,78 @@
|
||||
import sys
|
||||
from typing import Type
|
||||
|
||||
from asyncio.base_events import BaseEventLoop as BaseEventLoop
|
||||
from asyncio.coroutines import (
|
||||
coroutine as coroutine,
|
||||
iscoroutinefunction as iscoroutinefunction,
|
||||
iscoroutine as iscoroutine,
|
||||
)
|
||||
from asyncio.coroutines import coroutine as coroutine, iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction
|
||||
from asyncio.events import (
|
||||
AbstractEventLoopPolicy as AbstractEventLoopPolicy,
|
||||
AbstractEventLoop as AbstractEventLoop,
|
||||
AbstractEventLoopPolicy as AbstractEventLoopPolicy,
|
||||
AbstractServer as AbstractServer,
|
||||
Handle as Handle,
|
||||
TimerHandle as TimerHandle,
|
||||
get_event_loop_policy as get_event_loop_policy,
|
||||
set_event_loop_policy as set_event_loop_policy,
|
||||
get_event_loop as get_event_loop,
|
||||
set_event_loop as set_event_loop,
|
||||
new_event_loop as new_event_loop,
|
||||
get_child_watcher as get_child_watcher,
|
||||
set_child_watcher as set_child_watcher,
|
||||
_set_running_loop as _set_running_loop,
|
||||
_get_running_loop as _get_running_loop,
|
||||
_set_running_loop as _set_running_loop,
|
||||
get_child_watcher as get_child_watcher,
|
||||
get_event_loop as get_event_loop,
|
||||
get_event_loop_policy as get_event_loop_policy,
|
||||
new_event_loop as new_event_loop,
|
||||
set_child_watcher as set_child_watcher,
|
||||
set_event_loop as set_event_loop,
|
||||
set_event_loop_policy as set_event_loop_policy,
|
||||
)
|
||||
from asyncio.futures import Future as Future, isfuture as isfuture, wrap_future as wrap_future
|
||||
from asyncio.locks import (
|
||||
BoundedSemaphore as BoundedSemaphore,
|
||||
Condition as Condition,
|
||||
Event as Event,
|
||||
Lock as Lock,
|
||||
Semaphore as Semaphore,
|
||||
)
|
||||
from asyncio.protocols import (
|
||||
BaseProtocol as BaseProtocol,
|
||||
DatagramProtocol as DatagramProtocol,
|
||||
Protocol as Protocol,
|
||||
SubprocessProtocol as SubprocessProtocol,
|
||||
)
|
||||
from asyncio.queues import (
|
||||
LifoQueue as LifoQueue,
|
||||
PriorityQueue as PriorityQueue,
|
||||
Queue as Queue,
|
||||
QueueEmpty as QueueEmpty,
|
||||
QueueFull as QueueFull,
|
||||
)
|
||||
from asyncio.streams import (
|
||||
StreamReader as StreamReader,
|
||||
StreamReaderProtocol as StreamReaderProtocol,
|
||||
StreamWriter as StreamWriter,
|
||||
open_connection as open_connection,
|
||||
start_server as start_server,
|
||||
)
|
||||
from asyncio.subprocess import (
|
||||
create_subprocess_exec as create_subprocess_exec,
|
||||
create_subprocess_shell as create_subprocess_shell,
|
||||
)
|
||||
from asyncio.tasks import (
|
||||
ALL_COMPLETED as ALL_COMPLETED,
|
||||
FIRST_COMPLETED as FIRST_COMPLETED,
|
||||
FIRST_EXCEPTION as FIRST_EXCEPTION,
|
||||
Task as Task,
|
||||
as_completed as as_completed,
|
||||
ensure_future as ensure_future,
|
||||
gather as gather,
|
||||
run_coroutine_threadsafe as run_coroutine_threadsafe,
|
||||
shield as shield,
|
||||
sleep as sleep,
|
||||
wait as wait,
|
||||
wait_for as wait_for,
|
||||
)
|
||||
from asyncio.transports import (
|
||||
BaseTransport as BaseTransport,
|
||||
DatagramTransport as DatagramTransport,
|
||||
ReadTransport as ReadTransport,
|
||||
SubprocessTransport as SubprocessTransport,
|
||||
Transport as Transport,
|
||||
WriteTransport as WriteTransport,
|
||||
)
|
||||
from typing import Type
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio.events import get_running_loop as get_running_loop
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -36,9 +86,7 @@ if sys.version_info >= (3, 8):
|
||||
)
|
||||
else:
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio.events import (
|
||||
SendfileNotAvailableError as SendfileNotAvailableError
|
||||
)
|
||||
from asyncio.events import SendfileNotAvailableError as SendfileNotAvailableError
|
||||
from asyncio.futures import (
|
||||
CancelledError as CancelledError,
|
||||
TimeoutError as TimeoutError,
|
||||
@@ -48,60 +96,13 @@ else:
|
||||
IncompleteReadError as IncompleteReadError,
|
||||
LimitOverrunError as LimitOverrunError,
|
||||
)
|
||||
from asyncio.futures import (
|
||||
Future as Future,
|
||||
isfuture as isfuture,
|
||||
wrap_future as wrap_future,
|
||||
)
|
||||
from asyncio.locks import (
|
||||
Lock as Lock,
|
||||
Event as Event,
|
||||
Condition as Condition,
|
||||
Semaphore as Semaphore,
|
||||
BoundedSemaphore as BoundedSemaphore,
|
||||
)
|
||||
from asyncio.protocols import (
|
||||
BaseProtocol as BaseProtocol,
|
||||
Protocol as Protocol,
|
||||
DatagramProtocol as DatagramProtocol,
|
||||
SubprocessProtocol as SubprocessProtocol,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio.protocols import BufferedProtocol as BufferedProtocol
|
||||
from asyncio.queues import (
|
||||
Queue as Queue,
|
||||
PriorityQueue as PriorityQueue,
|
||||
LifoQueue as LifoQueue,
|
||||
QueueFull as QueueFull,
|
||||
QueueEmpty as QueueEmpty,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio.runners import run as run
|
||||
from asyncio.streams import (
|
||||
StreamReader as StreamReader,
|
||||
StreamWriter as StreamWriter,
|
||||
StreamReaderProtocol as StreamReaderProtocol,
|
||||
open_connection as open_connection,
|
||||
start_server as start_server,
|
||||
)
|
||||
from asyncio.subprocess import (
|
||||
create_subprocess_exec as create_subprocess_exec,
|
||||
create_subprocess_shell as create_subprocess_shell,
|
||||
)
|
||||
from asyncio.tasks import (
|
||||
FIRST_COMPLETED as FIRST_COMPLETED,
|
||||
FIRST_EXCEPTION as FIRST_EXCEPTION,
|
||||
ALL_COMPLETED as ALL_COMPLETED,
|
||||
as_completed as as_completed,
|
||||
ensure_future as ensure_future,
|
||||
gather as gather,
|
||||
run_coroutine_threadsafe as run_coroutine_threadsafe,
|
||||
shield as shield,
|
||||
sleep as sleep,
|
||||
wait as wait,
|
||||
wait_for as wait_for,
|
||||
Task as Task,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio.tasks import (
|
||||
all_tasks as all_tasks,
|
||||
@@ -110,20 +111,12 @@ if sys.version_info >= (3, 7):
|
||||
)
|
||||
if sys.version_info >= (3, 9):
|
||||
from asyncio.threads import to_thread as to_thread
|
||||
from asyncio.transports import (
|
||||
BaseTransport as BaseTransport,
|
||||
ReadTransport as ReadTransport,
|
||||
WriteTransport as WriteTransport,
|
||||
Transport as Transport,
|
||||
DatagramTransport as DatagramTransport,
|
||||
SubprocessTransport as SubprocessTransport,
|
||||
)
|
||||
|
||||
DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy]
|
||||
if sys.platform == 'win32':
|
||||
if sys.platform == "win32":
|
||||
from asyncio.windows_events import *
|
||||
|
||||
if sys.platform != 'win32':
|
||||
if sys.platform != "win32":
|
||||
from asyncio.streams import (
|
||||
open_unix_connection as open_unix_connection,
|
||||
start_unix_server as start_unix_server,
|
||||
@@ -134,5 +127,6 @@ if sys.platform != 'win32':
|
||||
SafeChildWatcher as SafeChildWatcher,
|
||||
SelectorEventLoop as SelectorEventLoop,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from .unix_events import MultiLoopChildWatcher as MultiLoopChildWatcher, ThreadedChildWatcher as ThreadedChildWatcher
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
from socket import socket, _Address, _RetAddress
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable, Dict, Generator, IO, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
from abc import ABCMeta
|
||||
from asyncio.futures import Future
|
||||
from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle
|
||||
from asyncio.futures import Future
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from asyncio.tasks import Task
|
||||
from asyncio.transports import BaseTransport
|
||||
from socket import _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from contextvars import Context
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
_Context = Dict[str, Any]
|
||||
_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any]
|
||||
_ProtocolFactory = Callable[[], BaseProtocol]
|
||||
@@ -25,13 +27,11 @@ class Server(AbstractServer): ...
|
||||
|
||||
class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
def run_forever(self) -> None: ...
|
||||
|
||||
# Can't use a union, see mypy issue # 1873.
|
||||
@overload
|
||||
def run_until_complete(self, future: Generator[Any, None, _T]) -> _T: ...
|
||||
@overload
|
||||
def run_until_complete(self, future: Awaitable[_T]) -> _T: ...
|
||||
|
||||
def stop(self) -> None: ...
|
||||
def is_running(self) -> bool: ...
|
||||
def is_closed(self) -> bool: ...
|
||||
@@ -61,7 +61,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
) -> Task[_T]: ...
|
||||
else:
|
||||
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
|
||||
def set_task_factory(self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]) -> None: ...
|
||||
def set_task_factory(
|
||||
self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]
|
||||
) -> None: ...
|
||||
def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ...
|
||||
# Methods for interacting with threads
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -70,15 +72,26 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
# run_in_executor is defined as a coroutine in AbstractEventLoop but returns a Future in concrete implementation.
|
||||
# Need to ignore mypy Return type error as a result.
|
||||
def run_in_executor(self, executor: Any, # type: ignore
|
||||
func: Callable[..., _T], *args: Any) -> Future[_T]: ...
|
||||
def run_in_executor( # type: ignore
|
||||
self,
|
||||
executor: Any,
|
||||
func: Callable[..., _T],
|
||||
*args: Any,
|
||||
) -> Future[_T]: ...
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
|
||||
# https://github.com/python/mypy/issues/2509
|
||||
async def getaddrinfo(self, host: Optional[str], port: Union[str, int, None], *,
|
||||
family: int = ..., type: int = ..., proto: int = ...,
|
||||
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]: ...
|
||||
async def getaddrinfo(
|
||||
self,
|
||||
host: Optional[str],
|
||||
port: Union[str, int, None],
|
||||
*,
|
||||
family: int = ...,
|
||||
type: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]: ...
|
||||
async def getnameinfo(self, sockaddr: Tuple[Any, ...], flags: int = ...) -> Tuple[str, int]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
@@ -119,74 +132,209 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
) -> _TransProtPair: ...
|
||||
elif sys.version_info >= (3, 7):
|
||||
@overload
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ...,
|
||||
sock: None = ..., local_addr: Optional[Tuple[str, int]] = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
local_addr: Optional[Tuple[str, int]] = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
@overload
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ...,
|
||||
sock: socket, local_addr: None = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket,
|
||||
local_addr: None = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
else:
|
||||
@overload
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: None = ...,
|
||||
local_addr: Optional[Tuple[str, int]] = ..., server_hostname: Optional[str] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
local_addr: Optional[Tuple[str, int]] = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
@overload
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: socket,
|
||||
local_addr: None = ..., server_hostname: Optional[str] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket,
|
||||
local_addr: None = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
async def sock_sendfile(self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
|
||||
fallback: bool = ...) -> int: ...
|
||||
async def sock_sendfile(
|
||||
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: bool = ...
|
||||
) -> int: ...
|
||||
@overload
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ...,
|
||||
port: int = ..., *, family: int = ..., flags: int = ..., sock: None = ..., backlog: int = ...,
|
||||
ssl: _SSLContext = ..., reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ..., start_serving: bool = ...) -> Server: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: Optional[Union[str, Sequence[str]]] = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
start_serving: bool = ...,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
family: int = ..., flags: int = ..., sock: socket = ..., backlog: int = ...,
|
||||
ssl: _SSLContext = ..., reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ..., start_serving: bool = ...) -> Server: ...
|
||||
async def connect_accepted_socket(self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
|
||||
async def sendfile(self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
|
||||
fallback: bool = ...) -> int: ...
|
||||
async def start_tls(self, transport: BaseTransport, protocol: BaseProtocol, sslcontext: ssl.SSLContext, *,
|
||||
server_side: bool = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> BaseTransport: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
start_serving: bool = ...,
|
||||
) -> Server: ...
|
||||
async def connect_accepted_socket(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
sock: socket,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
async def sendfile(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
file: IO[bytes],
|
||||
offset: int = ...,
|
||||
count: Optional[int] = ...,
|
||||
*,
|
||||
fallback: bool = ...,
|
||||
) -> int: ...
|
||||
async def start_tls(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
protocol: BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_side: bool = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> BaseTransport: ...
|
||||
else:
|
||||
@overload
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ..., port: int = ..., *,
|
||||
family: int = ..., flags: int = ...,
|
||||
sock: None = ..., backlog: int = ..., ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...) -> Server: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: Optional[Union[str, Sequence[str]]] = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
family: int = ..., flags: int = ...,
|
||||
sock: socket, backlog: int = ..., ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...) -> Server: ...
|
||||
async def connect_accepted_socket(self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...) -> _TransProtPair: ...
|
||||
async def create_datagram_endpoint(self, protocol_factory: _ProtocolFactory,
|
||||
local_addr: Optional[Tuple[str, int]] = ..., remote_addr: Optional[Tuple[str, int]] = ..., *,
|
||||
family: int = ..., proto: int = ..., flags: int = ...,
|
||||
reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
|
||||
allow_broadcast: Optional[bool] = ...,
|
||||
sock: Optional[socket] = ...) -> _TransProtPair: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
) -> Server: ...
|
||||
async def connect_accepted_socket(
|
||||
self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...
|
||||
) -> _TransProtPair: ...
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
local_addr: Optional[Tuple[str, int]] = ...,
|
||||
remote_addr: Optional[Tuple[str, int]] = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
allow_broadcast: Optional[bool] = ...,
|
||||
sock: Optional[socket] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
# Pipes and subprocesses.
|
||||
async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
||||
async def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
||||
async def subprocess_shell(self, protocol_factory: _ProtocolFactory, cmd: Union[bytes, str], *, stdin: Any = ...,
|
||||
stdout: Any = ..., stderr: Any = ..., universal_newlines: Literal[False] = ...,
|
||||
shell: Literal[True] = ..., bufsize: Literal[0] = ..., encoding: None = ...,
|
||||
errors: None = ..., text: Literal[False, None] = ..., **kwargs: Any) -> _TransProtPair: ...
|
||||
async def subprocess_exec(self, protocol_factory: _ProtocolFactory, *args: Any, stdin: Any = ...,
|
||||
stdout: Any = ..., stderr: Any = ...,
|
||||
**kwargs: Any) -> _TransProtPair: ...
|
||||
async def subprocess_shell(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
cmd: Union[bytes, str],
|
||||
*,
|
||||
stdin: Any = ...,
|
||||
stdout: Any = ...,
|
||||
stderr: Any = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
shell: Literal[True] = ...,
|
||||
bufsize: Literal[0] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
text: Literal[False, None] = ...,
|
||||
**kwargs: Any,
|
||||
) -> _TransProtPair: ...
|
||||
async def subprocess_exec(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
*args: Any,
|
||||
stdin: Any = ...,
|
||||
stdout: Any = ...,
|
||||
stderr: Any = ...,
|
||||
**kwargs: Any,
|
||||
) -> _TransProtPair: ...
|
||||
def add_reader(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ...
|
||||
def remove_reader(self, fd: FileDescriptorLike) -> None: ...
|
||||
def add_writer(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import contextvars
|
||||
from typing import List, Tuple, Callable, Sequence
|
||||
from typing import Callable, List, Sequence, Tuple
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import futures
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
|
||||
from typing import Optional, Union, Sequence, IO, Any, List, Deque, Dict, Tuple, Callable
|
||||
import subprocess
|
||||
from typing import IO, Any, Callable, Deque, Dict, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
from . import events
|
||||
from . import protocols
|
||||
from . import futures
|
||||
from . import transports
|
||||
from . import events, futures, protocols, transports
|
||||
|
||||
_File = Optional[Union[int, IO[Any]]]
|
||||
|
||||
@@ -21,11 +17,30 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
|
||||
_pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
|
||||
_pipes: Dict[int, _File] # undocumented
|
||||
_finished: bool # undocumented
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, protocol: protocols.SubprocessProtocol, args: Union[str, bytes, Sequence[Union[str, bytes]]],
|
||||
shell: bool, stdin: _File, stdout: _File, stderr: _File, bufsize: int, waiter: Optional[futures.Future] = ..., extra: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
def _start(self, args: Union[str, bytes, Sequence[Union[str, bytes]]], shell: bool, stdin: _File, stdout: _File, stderr: _File, bufsize: int, **kwargs: Any): ... # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
protocol: protocols.SubprocessProtocol,
|
||||
args: Union[str, bytes, Sequence[Union[str, bytes]]],
|
||||
shell: bool,
|
||||
stdin: _File,
|
||||
stdout: _File,
|
||||
stderr: _File,
|
||||
bufsize: int,
|
||||
waiter: Optional[futures.Future] = ...,
|
||||
extra: Optional[Any] = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def _start(
|
||||
self,
|
||||
args: Union[str, bytes, Sequence[Union[str, bytes]]],
|
||||
shell: bool,
|
||||
stdin: _File,
|
||||
stdout: _File,
|
||||
stderr: _File,
|
||||
bufsize: int,
|
||||
**kwargs: Any,
|
||||
): ... # undocumented
|
||||
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
|
||||
def get_protocol(self) -> protocols.BaseProtocol: ...
|
||||
def is_closing(self) -> bool: ...
|
||||
@@ -47,7 +62,6 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
|
||||
def _call_connection_lost(self, exc: Optional[BaseException]) -> None: ... # undocumented
|
||||
|
||||
class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented
|
||||
|
||||
def __init__(self, proc: BaseSubprocessTransport, fd: int) -> None: ...
|
||||
def connection_made(self, transport: transports.BaseTransport) -> None: ...
|
||||
def connection_lost(self, exc: Optional[BaseException]) -> None: ...
|
||||
@@ -55,5 +69,4 @@ class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented
|
||||
def resume_writing(self) -> None: ...
|
||||
|
||||
class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): # undocumented
|
||||
|
||||
def data_received(self, data: bytes) -> None: ...
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import List, Optional
|
||||
from types import FrameType
|
||||
from typing import List, Optional
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
from . import tasks
|
||||
|
||||
def _task_repr_info(task: tasks.Task) -> List[str]: ... # undocumented
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
@@ -6,5 +5,4 @@ if sys.version_info < (3, 7):
|
||||
PY34: bool
|
||||
PY35: bool
|
||||
PY352: bool
|
||||
|
||||
def flatten_list_bytes(list_of_data: List[bytes]) -> bytes: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import enum
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
_F = TypeVar('_F', bound=Callable[..., Any])
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
|
||||
def coroutine(func: _F) -> _F: ...
|
||||
def iscoroutinefunction(func: Callable[..., Any]) -> bool: ...
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
from socket import socket, _Address, _RetAddress
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable, Dict, Generator, IO, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from asyncio.futures import Future
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from asyncio.tasks import Task
|
||||
from asyncio.transports import BaseTransport
|
||||
from asyncio.unix_events import AbstractChildWatcher
|
||||
from socket import _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from contextvars import Context
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
_Context = Dict[str, Any]
|
||||
_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any]
|
||||
_ProtocolFactory = Callable[[], BaseProtocol]
|
||||
@@ -24,7 +25,9 @@ class Handle:
|
||||
_cancelled = False
|
||||
_args: Sequence[Any]
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop, context: Optional[Context] = ...) -> None: ...
|
||||
def __init__(
|
||||
self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop, context: Optional[Context] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
@@ -35,11 +38,16 @@ class Handle:
|
||||
|
||||
class TimerHandle(Handle):
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any],
|
||||
loop: AbstractEventLoop, context: Optional[Context] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
when: float,
|
||||
callback: Callable[..., Any],
|
||||
args: Sequence[Any],
|
||||
loop: AbstractEventLoop,
|
||||
context: Optional[Context] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any],
|
||||
loop: AbstractEventLoop) -> None: ...
|
||||
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: ...
|
||||
@@ -60,7 +68,6 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
slow_callback_duration: float = ...
|
||||
@abstractmethod
|
||||
def run_forever(self) -> None: ...
|
||||
|
||||
# Can't use a union, see mypy issue # 1873.
|
||||
@overload
|
||||
@abstractmethod
|
||||
@@ -68,7 +75,6 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@overload
|
||||
@abstractmethod
|
||||
def run_until_complete(self, future: Awaitable[_T]) -> _T: ...
|
||||
|
||||
@abstractmethod
|
||||
def stop(self) -> None: ...
|
||||
@abstractmethod
|
||||
@@ -102,24 +108,32 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
|
||||
@abstractmethod
|
||||
def set_task_factory(self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]) -> None: ...
|
||||
def set_task_factory(
|
||||
self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]
|
||||
) -> None: ...
|
||||
@abstractmethod
|
||||
def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ...
|
||||
# Methods for interacting with threads
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
async def run_in_executor(self, executor: Any,
|
||||
func: Callable[..., _T], *args: Any) -> _T: ...
|
||||
async def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> _T: ...
|
||||
@abstractmethod
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
@abstractmethod
|
||||
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
|
||||
# https://github.com/python/mypy/issues/2509
|
||||
async def getaddrinfo(self, host: Optional[str], port: Union[str, int, None], *,
|
||||
family: int = ..., type: int = ..., proto: int = ...,
|
||||
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]: ...
|
||||
async def getaddrinfo(
|
||||
self,
|
||||
host: Optional[str],
|
||||
port: Union[str, int, None],
|
||||
*,
|
||||
family: int = ...,
|
||||
type: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]: ...
|
||||
@abstractmethod
|
||||
async def getnameinfo(self, sockaddr: Tuple[Any, ...], flags: int = ...) -> Tuple[str, int]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -164,96 +178,246 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
elif sys.version_info >= (3, 7):
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ...,
|
||||
sock: None = ..., local_addr: Optional[Tuple[str, int]] = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
local_addr: Optional[Tuple[str, int]] = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ...,
|
||||
sock: socket, local_addr: None = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket,
|
||||
local_addr: None = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
else:
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: None = ...,
|
||||
local_addr: Optional[Tuple[str, int]] = ..., server_hostname: Optional[str] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
local_addr: Optional[Tuple[str, int]] = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: socket,
|
||||
local_addr: None = ..., server_hostname: Optional[str] = ...) -> _TransProtPair: ...
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket,
|
||||
local_addr: None = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@abstractmethod
|
||||
async def sock_sendfile(self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
|
||||
fallback: bool = ...) -> int: ...
|
||||
async def sock_sendfile(
|
||||
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: bool = ...
|
||||
) -> int: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ...,
|
||||
port: int = ..., *, family: int = ..., flags: int = ..., sock: None = ..., backlog: int = ...,
|
||||
ssl: _SSLContext = ..., reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ..., start_serving: bool = ...) -> AbstractServer: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: Optional[Union[str, Sequence[str]]] = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
start_serving: bool = ...,
|
||||
) -> AbstractServer: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
family: int = ..., flags: int = ..., sock: socket = ..., backlog: int = ...,
|
||||
ssl: _SSLContext = ..., reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ..., start_serving: bool = ...) -> AbstractServer: ...
|
||||
async def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: Optional[str] = ..., *, ssl: _SSLContext = ...,
|
||||
sock: Optional[socket] = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
|
||||
async def create_unix_server(self, protocol_factory: _ProtocolFactory, path: Optional[str] = ..., *, sock: Optional[socket] = ...,
|
||||
backlog: int = ..., ssl: _SSLContext = ..., ssl_handshake_timeout: Optional[float] = ...,
|
||||
start_serving: bool = ...) -> AbstractServer: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
start_serving: bool = ...,
|
||||
) -> AbstractServer: ...
|
||||
async def create_unix_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: Optional[str] = ...,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
sock: Optional[socket] = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
async def create_unix_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: Optional[str] = ...,
|
||||
*,
|
||||
sock: Optional[socket] = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
start_serving: bool = ...,
|
||||
) -> AbstractServer: ...
|
||||
@abstractmethod
|
||||
async def sendfile(self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
|
||||
fallback: bool = ...) -> int: ...
|
||||
async def sendfile(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
file: IO[bytes],
|
||||
offset: int = ...,
|
||||
count: Optional[int] = ...,
|
||||
*,
|
||||
fallback: bool = ...,
|
||||
) -> int: ...
|
||||
@abstractmethod
|
||||
async def start_tls(self, transport: BaseTransport, protocol: BaseProtocol, sslcontext: ssl.SSLContext, *,
|
||||
server_side: bool = ..., server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...) -> BaseTransport: ...
|
||||
async def start_tls(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
protocol: BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_side: bool = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
) -> BaseTransport: ...
|
||||
else:
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ..., port: int = ..., *,
|
||||
family: int = ..., flags: int = ...,
|
||||
sock: None = ..., backlog: int = ..., ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...) -> AbstractServer: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: Optional[Union[str, Sequence[str]]] = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
) -> AbstractServer: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
family: int = ..., flags: int = ...,
|
||||
sock: socket, backlog: int = ..., ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...) -> AbstractServer: ...
|
||||
async def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: str, *,
|
||||
ssl: _SSLContext = ..., sock: Optional[socket] = ...,
|
||||
server_hostname: Optional[str] = ...) -> _TransProtPair: ...
|
||||
async def create_unix_server(self, protocol_factory: _ProtocolFactory, path: str, *,
|
||||
sock: Optional[socket] = ..., backlog: int = ..., ssl: _SSLContext = ...) -> AbstractServer: ...
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = ...,
|
||||
port: None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
) -> AbstractServer: ...
|
||||
async def create_unix_connection(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: str,
|
||||
*,
|
||||
ssl: _SSLContext = ...,
|
||||
sock: Optional[socket] = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
async def create_unix_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: str,
|
||||
*,
|
||||
sock: Optional[socket] = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
) -> AbstractServer: ...
|
||||
@abstractmethod
|
||||
async def create_datagram_endpoint(self, protocol_factory: _ProtocolFactory,
|
||||
local_addr: Optional[Tuple[str, int]] = ..., remote_addr: Optional[Tuple[str, int]] = ..., *,
|
||||
family: int = ..., proto: int = ..., flags: int = ...,
|
||||
reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
|
||||
allow_broadcast: Optional[bool] = ...,
|
||||
sock: Optional[socket] = ...) -> _TransProtPair: ...
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
local_addr: Optional[Tuple[str, int]] = ...,
|
||||
remote_addr: Optional[Tuple[str, int]] = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...,
|
||||
allow_broadcast: Optional[bool] = ...,
|
||||
sock: Optional[socket] = ...,
|
||||
) -> _TransProtPair: ...
|
||||
# Pipes and subprocesses.
|
||||
@abstractmethod
|
||||
async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
||||
@abstractmethod
|
||||
async def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
||||
@abstractmethod
|
||||
async def subprocess_shell(self, protocol_factory: _ProtocolFactory, cmd: Union[bytes, str], *, stdin: Any = ...,
|
||||
stdout: Any = ..., stderr: Any = ...,
|
||||
**kwargs: Any) -> _TransProtPair: ...
|
||||
async def subprocess_shell(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
cmd: Union[bytes, str],
|
||||
*,
|
||||
stdin: Any = ...,
|
||||
stdout: Any = ...,
|
||||
stderr: Any = ...,
|
||||
**kwargs: Any,
|
||||
) -> _TransProtPair: ...
|
||||
@abstractmethod
|
||||
async def subprocess_exec(self, protocol_factory: _ProtocolFactory, *args: Any, stdin: Any = ...,
|
||||
stdout: Any = ..., stderr: Any = ...,
|
||||
**kwargs: Any) -> _TransProtPair: ...
|
||||
async def subprocess_exec(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
*args: Any,
|
||||
stdin: Any = ...,
|
||||
stdout: Any = ...,
|
||||
stderr: Any = ...,
|
||||
**kwargs: Any,
|
||||
) -> _TransProtPair: ...
|
||||
@abstractmethod
|
||||
def add_reader(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ...
|
||||
@abstractmethod
|
||||
@@ -327,14 +491,11 @@ class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta):
|
||||
|
||||
def get_event_loop_policy() -> AbstractEventLoopPolicy: ...
|
||||
def set_event_loop_policy(policy: Optional[AbstractEventLoopPolicy]) -> None: ...
|
||||
|
||||
def get_event_loop() -> AbstractEventLoop: ...
|
||||
def set_event_loop(loop: Optional[AbstractEventLoop]) -> None: ...
|
||||
def new_event_loop() -> AbstractEventLoop: ...
|
||||
|
||||
def get_child_watcher() -> AbstractChildWatcher: ...
|
||||
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...
|
||||
|
||||
def _set_running_loop(__loop: Optional[AbstractEventLoop]) -> None: ...
|
||||
def _get_running_loop() -> AbstractEventLoop: ...
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
import sys
|
||||
import functools
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from typing import Optional, Tuple, Union, Iterable, Dict, Any, overload
|
||||
from types import FunctionType, FrameType
|
||||
from types import FrameType, FunctionType
|
||||
from typing import Any, Dict, Iterable, Optional, Tuple, Union, overload
|
||||
|
||||
class _HasWrapper:
|
||||
__wrapper__: Union[_HasWrapper, FunctionType]
|
||||
@@ -12,14 +10,11 @@ class _HasWrapper:
|
||||
_FuncType = Union[FunctionType, _HasWrapper, functools.partial, functools.partialmethod]
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
@overload
|
||||
def _get_function_source(func: _FuncType) -> Tuple[str, int]: ...
|
||||
@overload
|
||||
def _get_function_source(func: object) -> Optional[Tuple[str, int]]: ...
|
||||
|
||||
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 extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> traceback.StackSummary: ...
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import sys
|
||||
from typing import Any, Union, Callable, TypeVar, Type, List, Iterable, Generator, Awaitable, Optional, Tuple
|
||||
from concurrent.futures._base import Error, Future as _ConcurrentFuture
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional, Tuple, Type, TypeVar, Union
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
from concurrent.futures._base import (
|
||||
Future as _ConcurrentFuture,
|
||||
Error,
|
||||
)
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
from concurrent.futures import CancelledError as CancelledError
|
||||
@@ -14,8 +12,8 @@ if sys.version_info < (3, 8):
|
||||
if sys.version_info >= (3, 7):
|
||||
from contextvars import Context
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S")
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
class _TracebackLogger:
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Iterable, Generator, Type, TypeVar, Union, Optional, Awaitable
|
||||
from types import TracebackType
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, Optional, Type, TypeVar, Union
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
from types import TracebackType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
class _ContextManagerMixin:
|
||||
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
|
||||
def __aenter__(self) -> Awaitable[None]: ...
|
||||
def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...
|
||||
def __aexit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
|
||||
) -> Awaitable[None]: ...
|
||||
|
||||
else:
|
||||
class _ContextManager:
|
||||
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
|
||||
def __enter__(self) -> object: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
|
||||
class _ContextManagerMixin:
|
||||
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
|
||||
# Apparently this exists to *prohibit* use as a context manager.
|
||||
@@ -27,8 +28,9 @@ else:
|
||||
def __iter__(self) -> Generator[Any, None, _ContextManager]: ...
|
||||
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
|
||||
def __aenter__(self) -> Awaitable[None]: ...
|
||||
def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...
|
||||
|
||||
def __aexit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
|
||||
) -> Awaitable[None]: ...
|
||||
|
||||
class Lock(_ContextManagerMixin):
|
||||
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import logging
|
||||
|
||||
logger: logging.Logger
|
||||
|
||||
@@ -1,35 +1,71 @@
|
||||
from socket import socket
|
||||
from typing import Any, Mapping, Optional
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import base_events, constants, events, futures, streams, transports
|
||||
|
||||
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: Optional[futures.Future[Any]] = ..., extra: Optional[Mapping[Any, Any]] = ..., server: Optional[events.AbstractServer] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: Optional[futures.Future[Any]] = ...,
|
||||
extra: Optional[Mapping[Any, Any]] = ...,
|
||||
server: Optional[events.AbstractServer] = ...,
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __del__(self) -> None: ...
|
||||
def get_write_buffer_size(self) -> int: ...
|
||||
|
||||
class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport):
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: Optional[futures.Future[Any]] = ..., extra: Optional[Mapping[Any, Any]] = ..., server: Optional[events.AbstractServer] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: Optional[futures.Future[Any]] = ...,
|
||||
extra: Optional[Mapping[Any, Any]] = ...,
|
||||
server: Optional[events.AbstractServer] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport):
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: Optional[futures.Future[Any]] = ..., extra: Optional[Mapping[Any, Any]] = ..., server: Optional[events.AbstractServer] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: Optional[futures.Future[Any]] = ...,
|
||||
extra: Optional[Mapping[Any, Any]] = ...,
|
||||
server: Optional[events.AbstractServer] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport):
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: Optional[futures.Future[Any]] = ..., extra: Optional[Mapping[Any, Any]] = ..., server: Optional[events.AbstractServer] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: Optional[futures.Future[Any]] = ...,
|
||||
extra: Optional[Mapping[Any, Any]] = ...,
|
||||
server: Optional[events.AbstractServer] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ...
|
||||
|
||||
class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport):
|
||||
|
||||
_sendfile_compatible: constants._SendfileMode = ...
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: Optional[futures.Future[Any]] = ..., extra: Optional[Mapping[Any, Any]] = ..., server: Optional[events.AbstractServer] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: Optional[futures.Future[Any]] = ...,
|
||||
extra: Optional[Mapping[Any, Any]] = ...,
|
||||
server: Optional[events.AbstractServer] = ...,
|
||||
) -> None: ...
|
||||
def _set_extra(self, sock: socket) -> None: ...
|
||||
def can_write_eof(self) -> Literal[True]: ...
|
||||
def write_eof(self) -> None: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from typing import Generic, TypeVar, Optional
|
||||
from typing import Generic, Optional, TypeVar
|
||||
|
||||
class QueueEmpty(Exception): ...
|
||||
class QueueFull(Exception): ...
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class Queue(Generic[_T]):
|
||||
def __init__(self, maxsize: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
||||
@@ -26,8 +26,5 @@ class Queue(Generic[_T]):
|
||||
async def join(self) -> bool: ...
|
||||
def task_done(self) -> None: ...
|
||||
|
||||
|
||||
class PriorityQueue(Queue[_T]): ...
|
||||
|
||||
|
||||
class LifoQueue(Queue[_T]): ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import sys
|
||||
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from typing import Awaitable, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
_T = TypeVar("_T")
|
||||
def run(main: Awaitable[_T], *, debug: bool = ...) -> _T: ...
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
|
||||
import sys
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Deque, Dict, List, Optional, Tuple
|
||||
|
||||
from typing import ClassVar, Optional, List, Tuple, Callable, Dict, Any, Deque
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import transports
|
||||
from . import constants
|
||||
from . import events
|
||||
from . import protocols
|
||||
from . import futures
|
||||
from . import constants, events, futures, protocols, transports
|
||||
|
||||
def _create_transport_context(server_side: bool, server_hostname: Optional[str]) -> ssl.SSLContext: ...
|
||||
|
||||
@@ -32,9 +27,7 @@ class _SSLPipe:
|
||||
_need_ssldata: bool
|
||||
_handshake_cb: Optional[Callable[[Optional[BaseException]], None]]
|
||||
_shutdown_cb: Optional[Callable[[], None]]
|
||||
|
||||
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: Optional[str] = ...) -> None: ...
|
||||
|
||||
@property
|
||||
def context(self) -> ssl.SSLContext: ...
|
||||
@property
|
||||
@@ -43,7 +36,6 @@ class _SSLPipe:
|
||||
def need_ssldata(self) -> bool: ...
|
||||
@property
|
||||
def wrapped(self) -> bool: ...
|
||||
|
||||
def do_handshake(self, callback: Optional[Callable[[Optional[BaseException]], None]] = ...) -> List[bytes]: ...
|
||||
def shutdown(self, callback: Optional[Callable[[], None]] = ...) -> List[bytes]: ...
|
||||
def feed_eof(self) -> None: ...
|
||||
@@ -61,8 +53,9 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
|
||||
else:
|
||||
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol, app_protocol: protocols.BaseProtocol) -> None: ...
|
||||
|
||||
def __init__(
|
||||
self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol, app_protocol: protocols.BaseProtocol
|
||||
) -> None: ...
|
||||
def get_extra_info(self, name: str, default: Optional[Any] = ...) -> Dict[str, Any]: ...
|
||||
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
|
||||
def get_protocol(self) -> protocols.BaseProtocol: ...
|
||||
@@ -103,12 +96,28 @@ class SSLProtocol(protocols.Protocol):
|
||||
_app_protocol_is_buffer: bool
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, loop: events.AbstractEventLoop, app_protocol: protocols.BaseProtocol, sslcontext: ssl.SSLContext, waiter: futures.Future,
|
||||
server_side: bool = ..., server_hostname: Optional[str] = ..., call_connection_made: bool = ..., ssl_handshake_timeout: Optional[int] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
app_protocol: protocols.BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
waiter: futures.Future,
|
||||
server_side: bool = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
call_connection_made: bool = ...,
|
||||
ssl_handshake_timeout: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, loop: events.AbstractEventLoop, app_protocol: protocols.BaseProtocol, sslcontext: ssl.SSLContext, waiter: futures.Future,
|
||||
server_side: bool = ..., server_hostname: Optional[str] = ..., call_connection_made: bool = ...) -> None: ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
app_protocol: protocols.BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
waiter: futures.Future,
|
||||
server_side: bool = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
call_connection_made: bool = ...,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
|
||||
def _wakeup_waiter(self, exc: Optional[BaseException] = ...) -> None: ...
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
|
||||
import sys
|
||||
from typing import Iterable, Callable, Awaitable, Optional, Tuple, Any, List
|
||||
from typing import Any, Awaitable, Callable, Iterable, List, Optional, Tuple
|
||||
|
||||
from . import events
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
async def staggered_race(coro_fns: Iterable[Callable[[], Awaitable]], delay: Optional[float], *, loop: Optional[events.AbstractEventLoop] = ...) -> Tuple[Any, Optional[int], List[Optional[Exception]]]: ...
|
||||
async def staggered_race(
|
||||
coro_fns: Iterable[Callable[[], Awaitable]], delay: Optional[float], *, loop: Optional[events.AbstractEventLoop] = ...
|
||||
) -> Tuple[Any, Optional[int], List[Optional[Exception]]]: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import sys
|
||||
from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Optional, Tuple, Union
|
||||
|
||||
from . import events
|
||||
from . import protocols
|
||||
from . import transports
|
||||
from . import events, protocols, transports
|
||||
|
||||
_ClientConnectedCallback = Callable[[StreamReader, StreamWriter], Optional[Awaitable[None]]]
|
||||
|
||||
@@ -12,7 +10,6 @@ if sys.version_info < (3, 8):
|
||||
expected: Optional[int]
|
||||
partial: bytes
|
||||
def __init__(self, partial: bytes, expected: Optional[int]) -> None: ...
|
||||
|
||||
class LimitOverrunError(Exception):
|
||||
consumed: int
|
||||
def __init__(self, message: str, consumed: int) -> None: ...
|
||||
@@ -24,9 +21,8 @@ async def open_connection(
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
limit: int = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
**kwds: Any
|
||||
**kwds: Any,
|
||||
) -> Tuple[StreamReader, StreamWriter]: ...
|
||||
|
||||
async def start_server(
|
||||
client_connected_cb: _ClientConnectedCallback,
|
||||
host: Optional[str] = ...,
|
||||
@@ -35,50 +31,50 @@ async def start_server(
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
limit: int = ...,
|
||||
ssl_handshake_timeout: Optional[float] = ...,
|
||||
**kwds: Any
|
||||
**kwds: Any,
|
||||
) -> events.AbstractServer: ...
|
||||
|
||||
if sys.platform != 'win32':
|
||||
if sys.platform != "win32":
|
||||
if sys.version_info >= (3, 7):
|
||||
from os import PathLike
|
||||
|
||||
_PathType = Union[str, PathLike[str]]
|
||||
else:
|
||||
_PathType = str
|
||||
|
||||
async def open_unix_connection(
|
||||
path: Optional[_PathType] = ...,
|
||||
*,
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
path: Optional[_PathType] = ..., *, loop: Optional[events.AbstractEventLoop] = ..., limit: int = ..., **kwds: Any
|
||||
) -> Tuple[StreamReader, StreamWriter]: ...
|
||||
|
||||
async def start_unix_server(
|
||||
client_connected_cb: _ClientConnectedCallback,
|
||||
path: Optional[_PathType] = ...,
|
||||
*,
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any) -> events.AbstractServer: ...
|
||||
**kwds: Any,
|
||||
) -> events.AbstractServer: ...
|
||||
|
||||
class FlowControlMixin(protocols.Protocol): ...
|
||||
|
||||
class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
|
||||
def __init__(self,
|
||||
stream_reader: StreamReader,
|
||||
client_connected_cb: Optional[_ClientConnectedCallback] = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
stream_reader: StreamReader,
|
||||
client_connected_cb: Optional[_ClientConnectedCallback] = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
) -> None: ...
|
||||
def connection_made(self, transport: transports.BaseTransport) -> None: ...
|
||||
def connection_lost(self, exc: Optional[Exception]) -> None: ...
|
||||
def data_received(self, data: bytes) -> None: ...
|
||||
def eof_received(self) -> bool: ...
|
||||
|
||||
class StreamWriter:
|
||||
def __init__(self,
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
reader: Optional[StreamReader],
|
||||
loop: events.AbstractEventLoop) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
reader: Optional[StreamReader],
|
||||
loop: events.AbstractEventLoop,
|
||||
) -> None: ...
|
||||
@property
|
||||
def transport(self) -> transports.BaseTransport: ...
|
||||
def write(self, data: bytes) -> None: ...
|
||||
@@ -93,9 +89,7 @@ class StreamWriter:
|
||||
async def drain(self) -> None: ...
|
||||
|
||||
class StreamReader:
|
||||
def __init__(self,
|
||||
limit: int = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
def __init__(self, limit: int = ..., loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
def exception(self) -> Exception: ...
|
||||
def set_exception(self, exc: Exception) -> None: ...
|
||||
def set_transport(self, transport: transports.BaseTransport) -> None: ...
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import sys
|
||||
from asyncio import events
|
||||
from asyncio import protocols
|
||||
from asyncio import streams
|
||||
from asyncio import transports
|
||||
from typing import Any, Optional, Tuple, Union, IO
|
||||
from asyncio import events, protocols, streams, transports
|
||||
from typing import IO, Any, Optional, Tuple, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from os import PathLike
|
||||
|
||||
_ExecArg = Union[str, bytes, PathLike[str], PathLike[bytes]]
|
||||
else:
|
||||
_ExecArg = Union[str, bytes] # Union used instead of AnyStr due to mypy issue #1236
|
||||
@@ -15,8 +13,7 @@ PIPE: int
|
||||
STDOUT: int
|
||||
DEVNULL: int
|
||||
|
||||
class SubprocessStreamProtocol(streams.FlowControlMixin,
|
||||
protocols.SubprocessProtocol):
|
||||
class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessProtocol):
|
||||
stdin: Optional[streams.StreamWriter]
|
||||
stdout: Optional[streams.StreamReader]
|
||||
stderr: Optional[streams.StreamReader]
|
||||
@@ -26,16 +23,14 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
|
||||
def pipe_connection_lost(self, fd: int, exc: Optional[Exception]) -> None: ...
|
||||
def process_exited(self) -> None: ...
|
||||
|
||||
|
||||
class Process:
|
||||
stdin: Optional[streams.StreamWriter]
|
||||
stdout: Optional[streams.StreamReader]
|
||||
stderr: Optional[streams.StreamReader]
|
||||
pid: int
|
||||
def __init__(self,
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
loop: events.AbstractEventLoop) -> None: ...
|
||||
def __init__(
|
||||
self, transport: transports.BaseTransport, protocol: protocols.BaseProtocol, loop: events.AbstractEventLoop
|
||||
) -> None: ...
|
||||
@property
|
||||
def returncode(self) -> Optional[int]: ...
|
||||
async def wait(self) -> int: ...
|
||||
@@ -44,7 +39,6 @@ class Process:
|
||||
def kill(self) -> None: ...
|
||||
async def communicate(self, input: Optional[bytes] = ...) -> Tuple[bytes, bytes]: ...
|
||||
|
||||
|
||||
async def create_subprocess_shell(
|
||||
cmd: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
|
||||
stdin: Union[int, IO[Any], None] = ...,
|
||||
@@ -52,9 +46,8 @@ async def create_subprocess_shell(
|
||||
stderr: Union[int, IO[Any], None] = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
**kwds: Any,
|
||||
) -> Process: ...
|
||||
|
||||
async def create_subprocess_exec(
|
||||
program: _ExecArg,
|
||||
*args: _ExecArg,
|
||||
@@ -63,5 +56,5 @@ async def create_subprocess_exec(
|
||||
stderr: Union[int, IO[Any], None] = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
**kwds: Any,
|
||||
) -> Process: ...
|
||||
|
||||
@@ -1,29 +1,45 @@
|
||||
import concurrent.futures
|
||||
import sys
|
||||
from typing import (
|
||||
Any, TypeVar, Set, List, TextIO, Union, Tuple, Generic, Generator, Iterable, Awaitable, overload, Iterator, Optional,
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
from types import FrameType
|
||||
from typing import (
|
||||
Any,
|
||||
Awaitable,
|
||||
Generator,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
TextIO,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T1 = TypeVar('_T1')
|
||||
_T2 = TypeVar('_T2')
|
||||
_T3 = TypeVar('_T3')
|
||||
_T4 = TypeVar('_T4')
|
||||
_T5 = TypeVar('_T5')
|
||||
_T = TypeVar("_T")
|
||||
_T1 = TypeVar("_T1")
|
||||
_T2 = TypeVar("_T2")
|
||||
_T3 = TypeVar("_T3")
|
||||
_T4 = TypeVar("_T4")
|
||||
_T5 = TypeVar("_T5")
|
||||
_FutureT = Union[Future[_T], Generator[Any, None, _T], Awaitable[_T]]
|
||||
|
||||
FIRST_EXCEPTION: str
|
||||
FIRST_COMPLETED: str
|
||||
ALL_COMPLETED: str
|
||||
|
||||
def as_completed(fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ...,
|
||||
timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ...
|
||||
def ensure_future(coro_or_future: _FutureT[_T],
|
||||
*, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
def as_completed(
|
||||
fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ...
|
||||
) -> Iterator[Future[_T]]: ...
|
||||
def ensure_future(coro_or_future: _FutureT[_T], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
|
||||
# Prior to Python 3.7 'async' was an alias for 'ensure_future'.
|
||||
# It became a keyword in 3.7.
|
||||
|
||||
@@ -32,60 +48,118 @@ def ensure_future(coro_or_future: _FutureT[_T],
|
||||
# zip() because typing does not support variadic type variables. See
|
||||
# typing PR #1550 for discussion.
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1],
|
||||
*, loop: Optional[AbstractEventLoop] = ..., return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1], *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: Literal[False] = ...
|
||||
) -> Future[Tuple[_T1]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2],
|
||||
*, loop: Optional[AbstractEventLoop] = ..., return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1, _T2]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...,
|
||||
) -> Future[Tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
|
||||
*, loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1, _T2, _T3]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
coro_or_future3: _FutureT[_T3],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...,
|
||||
) -> Future[Tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4],
|
||||
*, loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...,
|
||||
) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4], coro_or_future5: _FutureT[_T5],
|
||||
*, loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4],
|
||||
coro_or_future5: _FutureT[_T5],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: Literal[False] = ...,
|
||||
) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[Any], coro_or_future2: _FutureT[Any], coro_or_future3: _FutureT[Any],
|
||||
coro_or_future4: _FutureT[Any], coro_or_future5: _FutureT[Any], coro_or_future6: _FutureT[Any],
|
||||
*coros_or_futures: _FutureT[Any],
|
||||
loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[List[Any]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[Any],
|
||||
coro_or_future2: _FutureT[Any],
|
||||
coro_or_future3: _FutureT[Any],
|
||||
coro_or_future4: _FutureT[Any],
|
||||
coro_or_future5: _FutureT[Any],
|
||||
coro_or_future6: _FutureT[Any],
|
||||
*coros_or_futures: _FutureT[Any],
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[List[Any]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1],
|
||||
*, loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...) -> Future[Tuple[Union[_T1, BaseException]]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1], *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...
|
||||
) -> Future[Tuple[Union[_T1, BaseException]]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2],
|
||||
*, loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...) -> Future[Tuple[Union[_T1, BaseException], Union[_T2, BaseException]]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[Tuple[Union[_T1, BaseException], Union[_T2, BaseException]]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
|
||||
*, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[
|
||||
Tuple[Union[_T1, BaseException], Union[_T2, BaseException], Union[_T3, BaseException]]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
coro_or_future3: _FutureT[_T3],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[Tuple[Union[_T1, BaseException], Union[_T2, BaseException], Union[_T3, BaseException]]]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4],
|
||||
*, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[
|
||||
Tuple[Union[_T1, BaseException], Union[_T2, BaseException], Union[_T3, BaseException], Union[_T4, BaseException]]]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[
|
||||
Tuple[Union[_T1, BaseException], Union[_T2, BaseException], Union[_T3, BaseException], Union[_T4, BaseException]]
|
||||
]: ...
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4], coro_or_future5: _FutureT[_T5],
|
||||
*, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[
|
||||
Tuple[Union[_T1, BaseException], Union[_T2, BaseException], Union[_T3, BaseException], Union[_T4, BaseException], Union[_T5, BaseException]]]: ...
|
||||
def run_coroutine_threadsafe(coro: _FutureT[_T],
|
||||
loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
|
||||
def gather(
|
||||
coro_or_future1: _FutureT[_T1],
|
||||
coro_or_future2: _FutureT[_T2],
|
||||
coro_or_future3: _FutureT[_T3],
|
||||
coro_or_future4: _FutureT[_T4],
|
||||
coro_or_future5: _FutureT[_T5],
|
||||
*,
|
||||
loop: Optional[AbstractEventLoop] = ...,
|
||||
return_exceptions: bool = ...,
|
||||
) -> Future[
|
||||
Tuple[
|
||||
Union[_T1, BaseException],
|
||||
Union[_T2, BaseException],
|
||||
Union[_T3, BaseException],
|
||||
Union[_T4, BaseException],
|
||||
Union[_T5, BaseException],
|
||||
]
|
||||
]: ...
|
||||
def run_coroutine_threadsafe(coro: _FutureT[_T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
|
||||
def shield(arg: _FutureT[_T], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
def sleep(delay: float, result: _T = ..., *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
def wait(fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ...,
|
||||
return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
|
||||
def wait_for(fut: _FutureT[_T], timeout: Optional[float],
|
||||
*, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
def wait(
|
||||
fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ..., return_when: str = ...
|
||||
) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
|
||||
def wait_for(fut: _FutureT[_T], timeout: Optional[float], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
|
||||
class Task(Future[_T], Generic[_T]):
|
||||
@classmethod
|
||||
@@ -119,9 +193,7 @@ class Task(Future[_T], Generic[_T]):
|
||||
if sys.version_info >= (3, 7):
|
||||
def all_tasks(loop: Optional[AbstractEventLoop] = ...) -> Set[Task[Any]]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def create_task(
|
||||
coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, name: Optional[str] = ...,
|
||||
) -> Task[_T]: ...
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, name: Optional[str] = ...,) -> Task[_T]: ...
|
||||
else:
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task[_T]: ...
|
||||
def current_task(loop: Optional[AbstractEventLoop] = ...) -> Optional[Task[Any]]: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
async def to_thread(__func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import sys
|
||||
from socket import _Address
|
||||
from typing import Any, Mapping, List, Optional, Tuple
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from socket import _Address
|
||||
from typing import Any, List, Mapping, Optional, Tuple
|
||||
|
||||
class BaseTransport:
|
||||
def __init__(self, extra: Optional[Mapping[Any, Any]] = ...) -> None: ...
|
||||
@@ -20,9 +20,7 @@ class ReadTransport(BaseTransport):
|
||||
def resume_reading(self) -> None: ...
|
||||
|
||||
class WriteTransport(BaseTransport):
|
||||
def set_write_buffer_limits(
|
||||
self, high: Optional[int] = ..., low: Optional[int] = ...
|
||||
) -> None: ...
|
||||
def set_write_buffer_limits(self, high: Optional[int] = ..., low: Optional[int] = ...) -> None: ...
|
||||
def get_write_buffer_size(self) -> int: ...
|
||||
def write(self, data: Any) -> None: ...
|
||||
def writelines(self, list_of_data: List[Any]) -> None: ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
import sys
|
||||
import socket
|
||||
from typing import Union, NoReturn, Tuple, Optional, Iterable, List, Any, BinaryIO, Type, overload
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Any, BinaryIO, Iterable, List, NoReturn, Optional, Tuple, Type, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
# These are based in socket, maybe move them out into _typeshed.pyi or such
|
||||
@@ -10,7 +9,6 @@ if sys.version_info >= (3, 8):
|
||||
_RetAddress = Any
|
||||
_WriteBuffer = Union[bytearray, memoryview]
|
||||
_CMSG = Tuple[int, int, bytes]
|
||||
|
||||
class TransportSocket:
|
||||
def __init__(self, sock: socket.socket) -> None: ...
|
||||
def _na(self, what: str) -> None: ...
|
||||
@@ -40,7 +38,7 @@ if sys.version_info >= (3, 8):
|
||||
def connect(self, address: Union[_Address, bytes]) -> None: ...
|
||||
def connect_ex(self, address: Union[_Address, bytes]) -> int: ...
|
||||
def bind(self, address: Union[_Address, bytes]) -> None: ...
|
||||
if sys.platform == 'win32':
|
||||
if sys.platform == "win32":
|
||||
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> None: ...
|
||||
else:
|
||||
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> NoReturn: ...
|
||||
@@ -53,7 +51,9 @@ if sys.version_info >= (3, 8):
|
||||
def sendmsg_afalg(self, msg=..., *, op, iv=..., assoclen=..., flags=...) -> int: ...
|
||||
else:
|
||||
def sendmsg_afalg(self, msg=..., *, op, iv=..., assoclen=..., flags=...) -> NoReturn: ...
|
||||
def sendmsg(self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ...) -> int: ...
|
||||
def sendmsg(
|
||||
self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ...
|
||||
) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: bytes, address: _Address) -> int: ...
|
||||
@overload
|
||||
@@ -61,13 +61,15 @@ if sys.version_info >= (3, 8):
|
||||
def send(self, data: bytes, flags: int = ...) -> int: ...
|
||||
def sendall(self, data: bytes, flags: int = ...) -> None: ...
|
||||
def set_inheritable(self, inheritable: bool) -> None: ...
|
||||
if sys.platform == 'win32':
|
||||
if sys.platform == "win32":
|
||||
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(self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ...) -> Tuple[int, List[_CMSG], int, Any]: ...
|
||||
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]: ...
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
@@ -75,4 +77,6 @@ if sys.version_info >= (3, 8):
|
||||
def gettimeout(self) -> Optional[float]: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def __enter__(self) -> socket.socket: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
@@ -5,9 +5,9 @@ from typing import Any, Callable, Optional, Type, TypeVar
|
||||
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy
|
||||
from .selector_events import BaseSelectorEventLoop
|
||||
|
||||
_T1 = TypeVar('_T1', bound=AbstractChildWatcher)
|
||||
_T2 = TypeVar('_T2', bound=SafeChildWatcher)
|
||||
_T3 = TypeVar('_T3', bound=FastChildWatcher)
|
||||
_T1 = TypeVar("_T1", bound=AbstractChildWatcher)
|
||||
_T2 = TypeVar("_T2", bound=SafeChildWatcher)
|
||||
_T3 = TypeVar("_T3", bound=FastChildWatcher)
|
||||
|
||||
class AbstractChildWatcher:
|
||||
def add_child_handler(self, pid: int, callback: Callable[..., Any], *args: Any) -> None: ...
|
||||
@@ -44,8 +44,8 @@ if sys.version_info >= (3, 8):
|
||||
|
||||
from typing import Protocol
|
||||
|
||||
_T4 = TypeVar('_T4', bound=MultiLoopChildWatcher)
|
||||
_T5 = TypeVar('_T5', bound=ThreadedChildWatcher)
|
||||
_T4 = TypeVar("_T4", bound=MultiLoopChildWatcher)
|
||||
_T5 = TypeVar("_T5", bound=ThreadedChildWatcher)
|
||||
class _Warn(Protocol):
|
||||
def __call__(
|
||||
self, message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
|
||||
import sys
|
||||
from typing import Tuple, Callable, Optional, Type, Protocol
|
||||
from types import TracebackType
|
||||
|
||||
from typing import Callable, Optional, Protocol, Tuple, Type
|
||||
|
||||
class _WarnFunction(Protocol):
|
||||
def __call__(self, message: str, category: Type[Warning], source: PipeHandle): ...
|
||||
|
||||
|
||||
BUFSIZE: int
|
||||
PIPE: int
|
||||
STDOUT: int
|
||||
@@ -15,7 +12,6 @@ STDOUT: int
|
||||
def pipe(*, duplex: bool = ..., overlapped: Tuple[bool, bool] = ..., bufsize: int = ...) -> Tuple[int, int]: ...
|
||||
|
||||
class PipeHandle:
|
||||
|
||||
def __init__(self, handle: int) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
Reference in New Issue
Block a user