Fix some errors with --disallow-any-generics (#3276)

See #3267. Covers all of stdlib/2and3.
This commit is contained in:
Guido van Rossum
2019-09-29 09:15:27 -07:00
committed by GitHub
parent 1e881ad156
commit b336182b69
27 changed files with 85 additions and 92 deletions

View File

@@ -53,30 +53,30 @@ class object:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> tuple: ...
def __reduce_ex__(self, protocol: int) -> tuple: ...
def __reduce__(self) -> Tuple[Any, ...]: ...
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
if sys.version_info >= (3,):
def __dir__(self) -> Iterable[str]: ...
if sys.version_info >= (3, 6):
def __init_subclass__(cls) -> None: ...
class staticmethod(object): # Special, only valid as a decorator.
__func__: Callable
__func__: Callable[..., Any]
if sys.version_info >= (3,):
__isabstractmethod__: bool
def __init__(self, f: Callable) -> None: ...
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
class classmethod(object): # Special, only valid as a decorator.
__func__: Callable
__func__: Callable[..., Any]
if sys.version_info >= (3,):
__isabstractmethod__: bool
def __init__(self, f: Callable) -> None: ...
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
class type(object):
__base__: type
@@ -1130,7 +1130,7 @@ if sys.version_info >= (3, 6):
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
class _PathLike(Generic[AnyStr]):
def __fspath__(self) -> AnyStr: ...
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
elif sys.version_info >= (3,):
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
else:
@@ -1187,8 +1187,8 @@ else:
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def len(__o: Sized) -> int: ...
if sys.version_info >= (3,):
def license() -> None: ...
@@ -1324,7 +1324,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
if sys.version_info >= (3, 6):
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
elif sys.version_info >= (3,):