mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Explaining/Fixing asyncio allowlist exceptions (#5132)
This commit is contained in:
@@ -21,7 +21,23 @@ _ProtocolFactory = Callable[[], BaseProtocol]
|
||||
_SSLContext = Union[bool, None, ssl.SSLContext]
|
||||
_TransProtPair = Tuple[BaseTransport, BaseProtocol]
|
||||
|
||||
class Server(AbstractServer): ...
|
||||
class Server(AbstractServer):
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(
|
||||
self,
|
||||
loop: AbstractEventLoop,
|
||||
sockets: List[socket],
|
||||
protocol_factory: _ProtocolFactory,
|
||||
ssl_context: _SSLContext,
|
||||
backlog: int,
|
||||
ssl_handshake_timeout: Optional[float],
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
loop: AbstractEventLoop,
|
||||
sockets: List[socket],
|
||||
) -> None: ...
|
||||
|
||||
class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
def run_forever(self) -> None: ...
|
||||
@@ -184,7 +200,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
) -> _TransProtPair: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
async def sock_sendfile(
|
||||
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: bool = ...
|
||||
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: Optional[bool] = ...
|
||||
) -> int: ...
|
||||
@overload
|
||||
async def create_server(
|
||||
|
||||
@@ -242,7 +242,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
if sys.version_info >= (3, 7):
|
||||
@abstractmethod
|
||||
async def sock_sendfile(
|
||||
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: bool = ...
|
||||
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: Optional[bool] = ...
|
||||
) -> int: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
import sys
|
||||
from socket import socket
|
||||
from typing import Any, Mapping, Optional
|
||||
from typing_extensions import Literal
|
||||
from typing import Any, Mapping, Optional, Type
|
||||
from typing_extensions import Literal, Protocol
|
||||
|
||||
from . import base_events, constants, events, futures, streams, transports
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class _WarnCallbackProtocol(Protocol):
|
||||
def __call__(
|
||||
self, message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
|
||||
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -15,7 +22,10 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr
|
||||
server: Optional[events.AbstractServer] = ...,
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __del__(self) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def __del__(self, _warn: _WarnCallbackProtocol = ...) -> None: ...
|
||||
else:
|
||||
def __del__(self) -> None: ...
|
||||
def get_write_buffer_size(self) -> int: ...
|
||||
|
||||
class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport):
|
||||
|
||||
@@ -53,7 +53,8 @@ if sys.platform != "win32":
|
||||
**kwds: Any,
|
||||
) -> events.AbstractServer: ...
|
||||
|
||||
class FlowControlMixin(protocols.Protocol): ...
|
||||
class FlowControlMixin(protocols.Protocol):
|
||||
def __init__(self, loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
|
||||
class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
|
||||
def __init__(
|
||||
|
||||
@@ -182,8 +182,8 @@ class Task(Future[_T], Generic[_T]):
|
||||
def get_coro(self) -> Any: ...
|
||||
def get_name(self) -> str: ...
|
||||
def set_name(self, __value: object) -> None: ...
|
||||
def get_stack(self, *, limit: int = ...) -> List[FrameType]: ...
|
||||
def print_stack(self, *, limit: int = ..., file: TextIO = ...) -> None: ...
|
||||
def get_stack(self, *, limit: Optional[int] = ...) -> List[FrameType]: ...
|
||||
def print_stack(self, *, limit: Optional[int] = ..., file: Optional[TextIO] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def cancel(self, msg: Optional[str] = ...) -> bool: ...
|
||||
else:
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import sys
|
||||
import types
|
||||
from socket import socket
|
||||
from typing import Any, Callable, Optional, Type, TypeVar
|
||||
|
||||
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy
|
||||
from .events import AbstractEventLoop, AbstractServer, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
|
||||
from .selector_events import BaseSelectorEventLoop
|
||||
|
||||
_T1 = TypeVar("_T1", bound=AbstractChildWatcher)
|
||||
@@ -30,7 +31,17 @@ class SafeChildWatcher(BaseChildWatcher):
|
||||
class FastChildWatcher(BaseChildWatcher):
|
||||
def __enter__(self: _T3) -> _T3: ...
|
||||
|
||||
class _UnixSelectorEventLoop(BaseSelectorEventLoop): ...
|
||||
class _UnixSelectorEventLoop(BaseSelectorEventLoop):
|
||||
if sys.version_info < (3, 7):
|
||||
async def create_unix_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: Optional[str] = ...,
|
||||
*,
|
||||
sock: Optional[socket] = ...,
|
||||
backlog: int = ...,
|
||||
ssl: _SSLContext = ...,
|
||||
) -> AbstractServer: ...
|
||||
|
||||
class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
|
||||
def get_child_watcher(self) -> AbstractChildWatcher: ...
|
||||
|
||||
Reference in New Issue
Block a user