from threading import Condition, Thread
from typing import Any, Callable, Mapping, Sequence

Callback = Callable[[], Any]
CallableList = Sequence[tuple[Callback, int]]
ExceptionHandler = Callable[[Callback, Exception], None]

SCHEDULING_MAX: float

class Scheduler(Thread):
    running_flag: bool
    continue_flag: bool
    busy_flag: bool
    timestamp_queue: Sequence[float]
    timestamp_map: Mapping[float, CallableList]
    tasks: set[int]
    waits: set[int]
    condition: Condition
    waits_condition: Condition
    exception_handler: ExceptionHandler
    _counter: int
    daemon: bool

    def __init__(self): ...
    def run(self): ...
    def start_scheduler(self): ...
    def stop_scheduler(self): ...
    def reset_scheduler(self, notify: bool = ...): ...
    def add_callable(
        self, callable: Callback, timestamp: float | None = ..., verify: bool = ...
    ) -> int: ...
    def wait_callable(self, identifier: int): ...
    def set_exception_handler(self, exception_handler: ExceptionHandler): ...
    def is_busy(self) -> bool: ...
    def is_running(self, pedantic: bool = ...) -> bool: ...
    def _handle_callables(self, callable_list: CallableList): ...
