from __future__ import annotations

from typing import Any, Callable, Iterable

TIMEOUT_MAX: float

def cpu_count() -> int: ...
def physical_cpu_count() -> int: ...
def set_default_pool_size(n: int) -> None: ...
def get_default_pool() -> ThreadPool: ...
def parallel_map(fn: Callable[[Any], Any], items: Iterable[Any], num_workers: int = 0) -> list[Any]: ...
def parallel_starmap(fn: Callable[..., Any], items: Iterable[tuple[Any, ...]], num_workers: int = 0) -> list[Any]: ...
def pool_map(fn: Callable[[Any], Any], items: Iterable[Any], num_workers: int = 0) -> list[Any]: ...
def pool_starmap(fn: Callable[..., Any], items: Iterable[tuple[Any, ...]], num_workers: int = 0) -> list[Any]: ...
def active_count() -> int: ...
def current_thread() -> Thread: ...
def main_thread() -> Thread: ...
def enumerate() -> list[Thread]: ...
def get_ident() -> int: ...
def get_native_id() -> int: ...
def stack_size(size: int = 0) -> int: ...

class ThreadPool:
    num_workers: int
    def __init__(self, num_workers: int = 0) -> None: ...
    def submit(self, fn: Callable[..., Any], args: tuple[Any, ...] | None = None, kwargs: dict[str, Any] | None = None, priority: int = 0, group: int = 0) -> None: ...
    def wrap(self, fn: Callable[..., Any], args: tuple[Any, ...] | None = None) -> None: ...
    def shutdown(self, wait: bool = True) -> None: ...
    def stats(self) -> dict[str, Any]: ...
    def map(self, fn: Callable[[Any], Any], items: Iterable[Any]) -> list[Any]: ...
    def starmap(self, fn: Callable[..., Any], items: Iterable[tuple[Any, ...]]) -> list[Any]: ...

class auto_thread:
    def __init__(self, fn: Callable[..., Any]) -> None: ...
    def __call__(self, *args: Any, **kwargs: Any) -> None: ...

class Thread:
    def __init__(
        self,
        target: Callable[..., Any] | None = None,
        args: tuple[Any, ...] | None = None,
        kwargs: dict[str, Any] | None = None,
        name: str | None = None,
        daemon: bool = False,
    ) -> None: ...
    def start(self) -> None: ...
    def run(self) -> None: ...
    def join(self, timeout: float | None = None) -> None: ...
    def is_alive(self) -> bool: ...
    @property
    def name(self) -> str: ...
    @name.setter
    def name(self, value: str) -> None: ...
    @property
    def ident(self) -> int | None: ...
    @property
    def native_id(self) -> int | None: ...
    @property
    def daemon(self) -> bool: ...
    @daemon.setter
    def daemon(self, value: bool) -> None: ...

class Timer:
    def __init__(
        self,
        interval: float,
        function: Callable[..., Any],
        args: tuple[Any, ...] | None = None,
        kwargs: dict[str, Any] | None = None,
    ) -> None: ...
    def start(self) -> None: ...
    def cancel(self) -> None: ...
    def join(self, timeout: float | None = None) -> None: ...
    def is_alive(self) -> bool: ...
    @property
    def name(self) -> str: ...
    @property
    def daemon(self) -> bool: ...
