mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
stdlib: audit more callback annotations (#8209)
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from typing import Any, NamedTuple
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["scheduler"]
|
||||
|
||||
_ActionCallback: TypeAlias = Callable[..., Any]
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
class Event(NamedTuple):
|
||||
time: float
|
||||
priority: Any
|
||||
sequence: int
|
||||
action: Callable[..., Any]
|
||||
action: _ActionCallback
|
||||
argument: tuple[Any, ...]
|
||||
kwargs: dict[str, Any]
|
||||
|
||||
@@ -17,7 +20,7 @@ else:
|
||||
class Event(NamedTuple):
|
||||
time: float
|
||||
priority: Any
|
||||
action: Callable[..., Any]
|
||||
action: _ActionCallback
|
||||
argument: tuple[Any, ...]
|
||||
kwargs: dict[str, Any]
|
||||
|
||||
@@ -27,20 +30,10 @@ class scheduler:
|
||||
|
||||
def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], object] = ...) -> None: ...
|
||||
def enterabs(
|
||||
self,
|
||||
time: float,
|
||||
priority: Any,
|
||||
action: Callable[..., Any],
|
||||
argument: tuple[Any, ...] = ...,
|
||||
kwargs: dict[str, Any] = ...,
|
||||
self, time: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ...
|
||||
) -> Event: ...
|
||||
def enter(
|
||||
self,
|
||||
delay: float,
|
||||
priority: Any,
|
||||
action: Callable[..., Any],
|
||||
argument: tuple[Any, ...] = ...,
|
||||
kwargs: dict[str, Any] = ...,
|
||||
self, delay: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ...
|
||||
) -> Event: ...
|
||||
def run(self, blocking: bool = ...) -> float | None: ...
|
||||
def cancel(self, event: Event) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user