diff --git a/stdlib/3.4/enum.pyi b/stdlib/3.4/enum.pyi index 3b97e1be8337..4f27d33f2f08 100644 --- a/stdlib/3.4/enum.pyi +++ b/stdlib/3.4/enum.pyi @@ -1,12 +1,13 @@ -# FIXME: Stub incomplete, ommissions include: -# * the metaclass -# * _sunder_ methods with their transformations - import sys -from typing import List, Any, TypeVar, Union +from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type + +_T = TypeVar('_T', bound=Enum) -class Enum: - def __new__(cls, value: Any) -> None: ... +class EnumMeta(type, Iterable[Enum]): + def __iter__(self: Type[_T]) -> Iterator[_T]: ... # type: ignore + +class Enum(metaclass=EnumMeta): + def __new__(cls: Type[_T], value: Any) -> _T: ... def __repr__(self) -> str: ... def __str__(self) -> str: ... def __dir__(self) -> List[str]: ... @@ -20,8 +21,6 @@ class Enum: class IntEnum(int, Enum): value = ... # type: int -_T = TypeVar('_T') - def unique(enumeration: _T) -> _T: ... if sys.version_info >= (3, 6):