Debian Codegraph @

jedi/third_party/typeshed/stdlib/sched.pyi

raw symbols SCIP
1 import sys
2 import time
3 from collections.abc import Callable
4 from typing import Any, ClassVar, NamedTuple, type_check_only
5 from typing_extensions import TypeAlias
6
7 __all__ = ["scheduler"]
8
9 _ActionCallback: TypeAlias = Callable[..., Any]
10
11 if sys.version_info >= (3, 10):
12 class Event(NamedTuple):
13 time: float
14 priority: Any
15 sequence: int
16 action: _ActionCallback
17 argument: tuple[Any, ...]
18 kwargs: dict[str, Any]
19
20 else:
21 @type_check_only
22 class _EventBase(NamedTuple):
23 time: float
24 priority: Any
25 action: _ActionCallback
26 argument: tuple[Any, ...]
27 kwargs: dict[str, Any]
28
29 class Event(_EventBase):
30 __hash__: ClassVar[None] # type: ignore[assignment]
31
32 class scheduler:
33 timefunc: Callable[[], float]
34 delayfunc: Callable[[float], object]
35
36 def __init__(
37 self, timefunc: Callable[[], float] = time.monotonic, delayfunc: Callable[[float], object] = time.sleep
38 ) -> None: ...
39 def enterabs(
40 self, time: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = (), kwargs: dict[str, Any] = ...
41 ) -> Event: ...
42 def enter(
43 self, delay: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = (), kwargs: dict[str, Any] = ...
44 ) -> Event: ...
45 def run(self, blocking: bool = True) -> float | None: ...
46 def cancel(self, event: Event) -> None: ...
47 def empty(self) -> bool: ...
48 @property
49 def queue(self) -> list[Event]: ...