Add several Python 3.8 annotations (#3347)

This commit is contained in:
Sebastian Rittau
2019-10-12 19:36:56 +02:00
committed by GitHub
parent 8ec25708d9
commit 62bbdf856c
11 changed files with 115 additions and 32 deletions

View File

@@ -1,9 +1,11 @@
import sys
from typing import Any, Callable, Generic, Dict, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
@@ -25,10 +27,13 @@ class _lru_cache_wrapper(Generic[_T]):
def cache_info(self) -> _CacheInfo: ...
def cache_clear(self) -> None: ...
class lru_cache():
def __init__(self, maxsize: Optional[int] = ..., typed: bool = ...) -> None: ...
def __call__(self, f: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ...
if sys.version_info >= (3, 8):
@overload
def lru_cache(maxsize: Optional[int] = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
@overload
def lru_cache(maxsize: Callable[..., _T], typed: bool = ...) -> _lru_cache_wrapper[_T]: ...
else:
def lru_cache(maxsize: Optional[int] = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
WRAPPER_ASSIGNMENTS: Sequence[str]
WRAPPER_UPDATES: Sequence[str]