mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
[stdlib][asyncio] Accept optional context in (Timer)Handle (#4190)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user