mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
add stubs for timeit (#1064)
This commit is contained in:
committed by
Guido van Rossum
parent
e97da0687d
commit
9e39eb6368
33
stdlib/2and3/timeit.pyi
Normal file
33
stdlib/2and3/timeit.pyi
Normal file
@@ -0,0 +1,33 @@
|
||||
# Stubs for timeit (Python 2 and 3)
|
||||
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, IO, List, Optional, Text, Tuple, Union
|
||||
|
||||
_str = Union[str, Text]
|
||||
_Timer = Callable[[], float]
|
||||
_stmt = Union[_str, Callable[[], Any]]
|
||||
|
||||
default_timer = ... # type: _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]: ...
|
||||
Reference in New Issue
Block a user