From 53d12c0a6cc73f197494fa05266519e2cd95bda0 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Tue, 23 Oct 2018 00:52:15 -0700 Subject: [PATCH] Makes enums accept objects in the argument type (#2539) Fixes problems with using enums with the --disallow-any-expr flag. --- stdlib/3/enum.pyi | 6 +++--- third_party/2/enum.pyi | 6 +++--- third_party/3/enum.pyi | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stdlib/3/enum.pyi b/stdlib/3/enum.pyi index 6ca467b27..f5b8dd10d 100644 --- a/stdlib/3/enum.pyi +++ b/stdlib/3/enum.pyi @@ -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 diff --git a/third_party/2/enum.pyi b/third_party/2/enum.pyi index 34200894b..a04486162 100644 --- a/third_party/2/enum.pyi +++ b/third_party/2/enum.pyi @@ -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 diff --git a/third_party/3/enum.pyi b/third_party/3/enum.pyi index 6ca467b27..f5b8dd10d 100644 --- a/third_party/3/enum.pyi +++ b/third_party/3/enum.pyi @@ -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