mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
Use structural inference for enum34 EnumMeta. (#2490)
Fixes python/mypy#5577.
This commit is contained in:
committed by
Jelle Zijlstra
parent
25c9fdc20d
commit
a8cfde79c4
5
third_party/2/enum.pyi
vendored
5
third_party/2/enum.pyi
vendored
@@ -8,10 +8,11 @@ _S = TypeVar('_S', bound=Type[Enum])
|
||||
# This is a temporary workaround to allow multiple creation of enums with builtins
|
||||
# such as str as mixins, which due to the handling of ABCs of builtin types, cause
|
||||
# spurious inconsistent metaclass structure. See #1595.
|
||||
class EnumMeta(ABCMeta, Iterable[Enum], Sized, Reversible[Enum], Container[Enum]):
|
||||
# Structurally: Iterable[T], Reversible[T], Container[T] where T is the enum itself
|
||||
class EnumMeta(ABCMeta):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self, member: Any) -> bool: ...
|
||||
def __contains__(self: Type[_T], member: Any) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
@property
|
||||
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
|
||||
|
||||
Reference in New Issue
Block a user