add several NamedTuple base classes (#12987)

This commit is contained in:
Stephen Morton
2024-11-21 01:52:31 -08:00
committed by GitHub
parent 0fb3a092c7
commit 32f48a5eae
11 changed files with 47 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
import sys
from collections.abc import Callable
from typing import Any, NamedTuple
from typing import Any, NamedTuple, type_check_only
from typing_extensions import TypeAlias
__all__ = ["scheduler"]
@@ -17,13 +17,16 @@ if sys.version_info >= (3, 10):
kwargs: dict[str, Any]
else:
class Event(NamedTuple):
@type_check_only
class _EventBase(NamedTuple):
time: float
priority: Any
action: _ActionCallback
argument: tuple[Any, ...]
kwargs: dict[str, Any]
class Event(_EventBase): ...
class scheduler:
timefunc: Callable[[], float]
delayfunc: Callable[[float], object]