mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-25 04:16:44 +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: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
asyncio.unix_events._UnixSelectorEventLoop.create_unix_server
|
||||
ctypes.wintypes
|
||||
pwd.getpwnam
|
||||
ssl.PROTOCOL_SSLv3
|
||||
|
||||
@@ -2,12 +2,12 @@ _collections_abc.AsyncGenerator.ag_await
|
||||
_collections_abc.AsyncGenerator.ag_code
|
||||
_collections_abc.AsyncGenerator.ag_frame
|
||||
_collections_abc.AsyncGenerator.ag_running
|
||||
asyncio.Future.__init__
|
||||
asyncio.Future.__init__ # Usually initialized from c object
|
||||
asyncio.exceptions # Added in Python 3.8
|
||||
asyncio.format_helpers # Added in Python 3.7
|
||||
asyncio.futures.Future.__init__
|
||||
asyncio.futures.Future.__init__ # Usually initialized from c object
|
||||
asyncio.futures._TracebackLogger.__init__
|
||||
asyncio.runners
|
||||
asyncio.runners # Added in Python 3.7
|
||||
asyncio.staggered # Added in Python 3.8
|
||||
asyncio.threads # Added in Python 3.9
|
||||
asyncio.trsock # Added in Python 3.8
|
||||
|
||||
@@ -2,14 +2,12 @@ _collections_abc.AsyncGenerator.ag_await
|
||||
_collections_abc.AsyncGenerator.ag_code
|
||||
_collections_abc.AsyncGenerator.ag_frame
|
||||
_collections_abc.AsyncGenerator.ag_running
|
||||
asyncio.AbstractEventLoop.sock_sendfile
|
||||
asyncio.compat # Removed in 3.7
|
||||
asyncio.Future.__init__
|
||||
asyncio.Future._callbacks
|
||||
asyncio.events.AbstractEventLoop.sock_sendfile
|
||||
asyncio.Future.__init__ # Usually initialized from c object
|
||||
asyncio.Future._callbacks # Usually initialized from c object
|
||||
asyncio.exceptions # Added in Python 3.8
|
||||
asyncio.futures.Future.__init__
|
||||
asyncio.futures.Future._callbacks
|
||||
asyncio.futures.Future.__init__ # Usually initialized from c object
|
||||
asyncio.futures.Future._callbacks # Usually initialized from c object
|
||||
asyncio.staggered # Added in Python 3.8
|
||||
asyncio.threads # Added in Python 3.9
|
||||
asyncio.trsock # Added in Python 3.8
|
||||
|
||||
@@ -14,14 +14,11 @@ ast.Ellipsis.__new__
|
||||
ast.NameConstant.__new__
|
||||
ast.Num.__new__
|
||||
ast.Str.__new__
|
||||
asyncio.AbstractEventLoop.sock_sendfile
|
||||
asyncio.compat # removed in 3.7
|
||||
asyncio.Future.__init__
|
||||
asyncio.Future._callbacks
|
||||
asyncio.events.AbstractEventLoop.sock_sendfile
|
||||
asyncio.futures.Future.__init__
|
||||
asyncio.futures.Future._callbacks
|
||||
asyncio.proactor_events._ProactorBasePipeTransport.__del__
|
||||
asyncio.Future.__init__ # Usually initialized from c object
|
||||
asyncio.Future._callbacks # Usually initialized from c object
|
||||
asyncio.futures.Future.__init__ # Usually initialized from c object
|
||||
asyncio.futures.Future._callbacks # Usually initialized from c object
|
||||
asyncio.run # Bugfix involving this was backported to 3.8
|
||||
asyncio.runners.run # It just hasn't been released yet
|
||||
asyncio.threads # Added in Python 3.9
|
||||
|
||||
@@ -24,13 +24,11 @@ ast.Index.__new__
|
||||
ast.NameConstant.__new__
|
||||
ast.Num.__new__
|
||||
ast.Str.__new__
|
||||
asyncio.AbstractEventLoop.sock_sendfile
|
||||
asyncio.compat # module removed in 3.7
|
||||
asyncio.Future.__init__
|
||||
asyncio.Future._callbacks
|
||||
asyncio.events.AbstractEventLoop.sock_sendfile
|
||||
asyncio.futures.Future.__init__
|
||||
asyncio.futures.Future._callbacks
|
||||
asyncio.Future.__init__ # Usually initialized from c object
|
||||
asyncio.Future._callbacks # Usually initialized from c object
|
||||
asyncio.futures.Future.__init__ # Usually initialized from c object
|
||||
asyncio.futures.Future._callbacks # Usually initialized from c object
|
||||
asyncio.proactor_events._ProactorBasePipeTransport.__del__
|
||||
builtins.dict.get
|
||||
collections.AsyncGenerator.ag_await
|
||||
|
||||
@@ -35,22 +35,18 @@ abc.abstractclassmethod
|
||||
abc.abstractmethod
|
||||
abc.abstractstaticmethod
|
||||
argparse.Namespace.__getattr__ # The whole point of this class is its attributes are dynamic
|
||||
asyncio.BaseEventLoop.subprocess_exec
|
||||
asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
|
||||
# Condition functions are exported in __init__
|
||||
asyncio.Condition.acquire
|
||||
asyncio.Condition.locked
|
||||
asyncio.Condition.release
|
||||
asyncio.Task.get_stack
|
||||
asyncio.Task.print_stack
|
||||
asyncio.base_events.BaseEventLoop.subprocess_exec
|
||||
asyncio.base_events.Server.__init__
|
||||
asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
|
||||
# Condition functions are exported in __init__
|
||||
asyncio.locks.Condition.acquire
|
||||
asyncio.locks.Condition.locked
|
||||
asyncio.locks.Condition.release
|
||||
asyncio.proactor_events.BaseProactorEventLoop.sock_recv
|
||||
asyncio.selector_events.BaseSelectorEventLoop.sock_recv
|
||||
asyncio.streams.FlowControlMixin.__init__
|
||||
asyncio.tasks.Task.get_stack
|
||||
asyncio.tasks.Task.print_stack
|
||||
asyncio.proactor_events.BaseProactorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
|
||||
asyncio.selector_events.BaseSelectorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
|
||||
builtins.bytearray.__float__
|
||||
builtins.bytearray.__int__
|
||||
builtins.bytearray.append
|
||||
|
||||
Reference in New Issue
Block a user