[stdlib][asyncio] Accept optional context in (Timer)Handle (#4190)

This commit is contained in:
Jaromir Latal
2020-06-07 14:33:46 +01:00
committed by GitHub
parent 948c1a63e6
commit c36e4517f7

View File

@@ -8,6 +8,8 @@ from asyncio.protocols import BaseProtocol
from asyncio.tasks import Task
from asyncio.transports import BaseTransport
from asyncio.unix_events import AbstractChildWatcher
if sys.version_info >= (3, 7):
from contextvars import Context
from _types import FileDescriptorLike
@@ -21,7 +23,10 @@ _TransProtPair = Tuple[BaseTransport, BaseProtocol]
class Handle:
_cancelled = False
_args: Sequence[Any]
def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
if sys.version_info >= (3, 7):
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: ...
def cancel(self) -> None: ...
def _run(self) -> None: ...
@@ -29,8 +34,12 @@ class Handle:
def cancelled(self) -> bool: ...
class TimerHandle(Handle):
def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any],
loop: AbstractEventLoop) -> None: ...
if sys.version_info >= (3, 7):
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 __hash__(self) -> int: ...
if sys.version_info >= (3, 7):
def when(self) -> float: ...