| 1 | import time |
| 2 | from collections.abc import Callable, Sequence |
| 3 | from typing import IO, Any |
| 4 | from typing_extensions import TypeAlias |
| 5 | |
| 6 | __all__ = ["Timer", "timeit", "repeat", "default_timer"] |
| 7 | |
| 8 | _Timer: TypeAlias = Callable[[], float] |
| 9 | _Stmt: TypeAlias = str | Callable[[], object] |
| 10 | |
| 11 | default_timer: _Timer |
| 12 | |
| 13 | class Timer: |
| 14 | def __init__( |
| 15 | self, |
| 16 | stmt: _Stmt = "pass", |
| 17 | setup: _Stmt = "pass", |
| 18 | timer: _Timer = time.perf_counter, |
| 19 | globals: dict[str, Any] | None = None, |
| 20 | ) -> None: ... |
| 21 | def print_exc(self, file: IO[str] | None = None) -> None: ... |
| 22 | def timeit(self, number: int = 1000000) -> float: ... |
| 23 | def repeat(self, repeat: int = 5, number: int = 1000000) -> list[float]: ... |
| 24 | def autorange(self, callback: Callable[[int, float], object] | None = None) -> tuple[int, float]: ... |
| 25 | |
| 26 | def timeit( |
| 27 | stmt: _Stmt = "pass", |
| 28 | setup: _Stmt = "pass", |
| 29 | timer: _Timer = time.perf_counter, |
| 30 | number: int = 1000000, |
| 31 | globals: dict[str, Any] | None = None, |
| 32 | ) -> float: ... |
| 33 | def repeat( |
| 34 | stmt: _Stmt = "pass", |
| 35 | setup: _Stmt = "pass", |
| 36 | timer: _Timer = time.perf_counter, |
| 37 | repeat: int = 5, |
| 38 | number: int = 1000000, |
| 39 | globals: dict[str, Any] | None = None, |
| 40 | ) -> list[float]: ... |
| 41 | def main(args: Sequence[str] | None = None, *, _wrap_timer: Callable[[_Timer], _Timer] | None = None) -> None: ... |