Skip to content

Commit e3f495b

Browse files
JelleZijlstraambv
authored andcommitted
Add missing enum attributes (#1195)
Fixes #854 (unless there's more I'm missing).
1 parent 6f5c6b5 commit e3f495b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stdlib/3.4/enum.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import sys
2-
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized
2+
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized, Reversible, Container, Mapping
33

44
_T = TypeVar('_T', bound=Enum)
55
_S = TypeVar('_S', bound=Type[Enum])
66

7-
class EnumMeta(type, Iterable[Enum], Sized):
7+
class EnumMeta(type, Iterable[Enum], Sized, Reversible[Enum], Container[Enum]):
88
def __iter__(self: Type[_T]) -> Iterator[_T]: ... # type: ignore
9+
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
10+
def __contains__(self, member: Any) -> bool: ...
11+
def __getitem__(self: Type[_T], name: str) -> _T: ...
12+
@property
13+
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
914

1015
class Enum(metaclass=EnumMeta):
1116
def __new__(cls: Type[_T], value: Any) -> _T: ...

0 commit comments

Comments
 (0)