Enable --disallow-any-generics for stubs (#3288)

This commit is contained in:
Sebastian Rittau
2019-10-01 14:31:34 +02:00
committed by Jelle Zijlstra
parent 23b353303b
commit c32e1e2280
77 changed files with 386 additions and 329 deletions

View File

@@ -1,5 +1,5 @@
# These are not exported.
from typing import Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
from typing import Any, Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
# These are exported.
from typing import (
@@ -28,7 +28,7 @@ _VT = TypeVar('_VT')
# namedtuple is special-cased in the type checker; the initializer is ignored.
def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
verbose: bool = ..., rename: bool = ...) -> Type[Tuple[Any, ...]]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...,
@@ -56,8 +56,6 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __reversed__(self) -> Iterator[_T]: ...
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
_CounterT = TypeVar('_CounterT', bound=Counter)
class Counter(Dict[_T, int], Generic[_T]):
@overload
def __init__(self, **kwargs: int) -> None: ...
@@ -65,7 +63,7 @@ class Counter(Dict[_T, int], Generic[_T]):
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def copy(self: _CounterT) -> _CounterT: ...
def copy(self: _S) -> _S: ...
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
@overload
@@ -93,15 +91,11 @@ class Counter(Dict[_T, int], Generic[_T]):
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict)
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
def copy(self: _OrderedDictT) -> _OrderedDictT: ...
def copy(self: _S) -> _S: ...
def __reversed__(self) -> Iterator[_KT]: ...
_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict)
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
default_factory: Callable[[], _VT]
@overload
@@ -123,4 +117,4 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, default_factory: Optional[Callable[[], _VT]],
iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __missing__(self, key: _KT) -> _VT: ...
def copy(self: _DefaultDictT) -> _DefaultDictT: ...
def copy(self: _S) -> _S: ...