mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
Makes enums accept objects in the argument type (#2539)
Fixes problems with using enums with the --disallow-any-expr flag.
This commit is contained in:
committed by
Sebastian Rittau
parent
167f72dbac
commit
53d12c0a6c
@@ -14,20 +14,20 @@ _S = TypeVar('_S', bound=Type[Enum])
|
||||
class EnumMeta(ABCMeta):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self: Type[_T], member: Any) -> bool: ...
|
||||
def __contains__(self: Type[_T], member: object) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
@property
|
||||
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Enum(metaclass=EnumMeta):
|
||||
def __new__(cls: Type[_T], value: Any) -> _T: ...
|
||||
def __new__(cls: Type[_T], value: object) -> _T: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __dir__(self) -> List[str]: ...
|
||||
def __format__(self, format_spec: str) -> str: ...
|
||||
def __hash__(self) -> Any: ...
|
||||
def __reduce_ex__(self, proto: Any) -> Any: ...
|
||||
def __reduce_ex__(self, proto: object) -> Any: ...
|
||||
|
||||
name = ... # type: str
|
||||
value = ... # type: Any
|
||||
|
||||
6
third_party/2/enum.pyi
vendored
6
third_party/2/enum.pyi
vendored
@@ -12,20 +12,20 @@ _S = TypeVar('_S', bound=Type[Enum])
|
||||
class EnumMeta(ABCMeta):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self: Type[_T], member: Any) -> bool: ...
|
||||
def __contains__(self: Type[_T], member: object) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
@property
|
||||
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Enum(metaclass=EnumMeta):
|
||||
def __new__(cls: Type[_T], value: Any) -> _T: ...
|
||||
def __new__(cls: Type[_T], value: object) -> _T: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __dir__(self) -> List[str]: ...
|
||||
def __format__(self, format_spec: str) -> str: ...
|
||||
def __hash__(self) -> Any: ...
|
||||
def __reduce_ex__(self, proto: Any) -> Any: ...
|
||||
def __reduce_ex__(self, proto: object) -> Any: ...
|
||||
|
||||
name = ... # type: str
|
||||
value = ... # type: Any
|
||||
|
||||
6
third_party/3/enum.pyi
vendored
6
third_party/3/enum.pyi
vendored
@@ -14,20 +14,20 @@ _S = TypeVar('_S', bound=Type[Enum])
|
||||
class EnumMeta(ABCMeta):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self: Type[_T], member: Any) -> bool: ...
|
||||
def __contains__(self: Type[_T], member: object) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
@property
|
||||
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Enum(metaclass=EnumMeta):
|
||||
def __new__(cls: Type[_T], value: Any) -> _T: ...
|
||||
def __new__(cls: Type[_T], value: object) -> _T: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __dir__(self) -> List[str]: ...
|
||||
def __format__(self, format_spec: str) -> str: ...
|
||||
def __hash__(self) -> Any: ...
|
||||
def __reduce_ex__(self, proto: Any) -> Any: ...
|
||||
def __reduce_ex__(self, proto: object) -> Any: ...
|
||||
|
||||
name = ... # type: str
|
||||
value = ... # type: Any
|
||||
|
||||
Reference in New Issue
Block a user