Support iteration over enums with enum34 (#1412)

* Support iteration over enums in python 2

* fix lint
This commit is contained in:
Svyatoslav Ilinskiy
2017-06-19 06:39:56 -07:00
committed by Matthias Kramm
parent a8dea5e05c
commit d5eb32d67e

View File

@@ -1,7 +1,11 @@
from typing import List, Any, TypeVar, Type
from typing import List, Any, TypeVar, Type, Iterable, Iterator
class Enum:
def __new__(cls, value: Any) -> None: ...
_T = TypeVar('_T', bound=Enum)
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]: ...
@@ -12,8 +16,6 @@ class Enum:
name = ... # type: str
value = ... # type: Any
_T = TypeVar('_T')
class IntEnum(int, Enum): # type: ignore
def __new__(cls: Type[_T], value: Any) -> _T: ...