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:
Michael Lee
2018-10-23 00:52:15 -07:00
committed by Sebastian Rittau
parent 167f72dbac
commit 53d12c0a6c
3 changed files with 9 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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