diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 73b88899c..5d0acc7dd 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -6,7 +6,7 @@ import sys from typing import ( Any, Awaitable, Callable, Dict, Generic, Iterator, Mapping, Optional, Tuple, TypeVar, - Union, overload, Type + Union, overload, Type, Iterable ) # ModuleType is exported from this module, but for circular import @@ -156,6 +156,38 @@ class BuiltinFunctionType: def __call__(self, *args: Any, **kwargs: Any) -> Any: ... BuiltinMethodType = BuiltinFunctionType +if sys.version_info >= (3, 7): + class WrapperDescriptorType: + __name__: str + __qualname__: str + __objclass__: type + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __get__(self, obj: Any, type: type = ...) -> Any: ... + + class MethodWrapperType: + __self__: object + __name__: str + __qualname__: str + __objclass__: type + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __eq__(self, other: Any) -> bool: ... + def __ne__(self, other: Any) -> bool: ... + + class MethodDescriptorType: + __name__: str + __qualname__: str + __objclass__: type + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __get__(self, obj: Any, type: type = ...) -> Any: ... + + class ClassMethodDescriptorType: + __name__: str + __qualname__: str + __objclass__: type + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __get__(self, obj: Any, type: type = ...) -> Any: ... + + class TracebackType: if sys.version_info >= (3, 7): def __init__(self, tb_next: Optional[TracebackType], tb_frame: FrameType, tb_lasti: int, tb_lineno: int) -> None: ... @@ -199,7 +231,11 @@ class MemberDescriptorType: def __set__(self, obj: Any) -> None: ... def __delete__(self, obj: Any) -> None: ... -def new_class(name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ..., exec_body: Callable[[Dict[str, Any]], None] = ...) -> type: ... +if sys.version_info >= (3, 7): + def new_class(name: str, bases: Iterable[object] = ..., kwds: Dict[str, Any] = ..., exec_body: Callable[[Dict[str, Any]], None] = ...) -> type: ... + def resolve_bases(bases: Iterable[object]) -> Tuple[Any, ...]: ... +else: + def new_class(name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ..., exec_body: Callable[[Dict[str, Any]], None] = ...) -> type: ... def prepare_class(name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ...) -> Tuple[type, Dict[str, Any], Dict[str, Any]]: ... # Actually a different type, but `property` is special and we want that too.