mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add missing enum attributes (#1195)
Fixes #854 (unless there's more I'm missing).
This commit is contained in:
committed by
Łukasz Langa
parent
6f5c6b5078
commit
e3f495b7e9
@@ -1,11 +1,16 @@
|
||||
import sys
|
||||
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized
|
||||
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized, Reversible, Container, Mapping
|
||||
|
||||
_T = TypeVar('_T', bound=Enum)
|
||||
_S = TypeVar('_S', bound=Type[Enum])
|
||||
|
||||
class EnumMeta(type, Iterable[Enum], Sized):
|
||||
class EnumMeta(type, Iterable[Enum], Sized, Reversible[Enum], Container[Enum]):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ... # type: ignore
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self, member: Any) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
@property
|
||||
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
|
||||
|
||||
class Enum(metaclass=EnumMeta):
|
||||
def __new__(cls: Type[_T], value: Any) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user