Files
typeshed/stdlib/@python2/timeit.pyi
Sebastian Rittau 5b739e0ccb Split stdlib into Python 2 and 3 versions (#5442)
All new files in stdlib/@python2 are straight copies of the
corresponding files in stdlib.
2021-05-14 12:04:12 -07:00

45 lines
1.7 KiB
Python

import sys
from typing import IO, Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, Union
_str = Union[str, Text]
_Timer = Callable[[], float]
_stmt = Union[_str, Callable[[], Any]]
default_timer: _Timer
class Timer:
if sys.version_info >= (3, 5):
def __init__(
self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., globals: Optional[Dict[str, Any]] = ...
) -> None: ...
else:
def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...) -> None: ...
def print_exc(self, file: Optional[IO[str]] = ...) -> None: ...
def timeit(self, number: int = ...) -> float: ...
def repeat(self, repeat: int = ..., number: int = ...) -> List[float]: ...
if sys.version_info >= (3, 6):
def autorange(self, callback: Optional[Callable[[int, float], Any]] = ...) -> Tuple[int, float]: ...
if sys.version_info >= (3, 5):
def timeit(
stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ..., globals: Optional[Dict[str, Any]] = ...
) -> float: ...
def repeat(
stmt: _stmt = ...,
setup: _stmt = ...,
timer: _Timer = ...,
repeat: int = ...,
number: int = ...,
globals: Optional[Dict[str, Any]] = ...,
) -> List[float]: ...
else:
def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ...) -> float: ...
def repeat(
stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ...
) -> List[float]: ...
_timerFunc = Callable[[], float]
def main(args: Optional[Sequence[str]] = ..., *, _wrap_timer: Optional[Callable[[_timerFunc], _timerFunc]] = ...) -> None: ...