mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Support iteration over enums with enum34 (#1412)
* Support iteration over enums in python 2 * fix lint
This commit is contained in:
committed by
Matthias Kramm
parent
a8dea5e05c
commit
d5eb32d67e
12
third_party/2/enum.pyi
vendored
12
third_party/2/enum.pyi
vendored
@@ -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: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user