Skip to content

Commit

Permalink
remove Any from enum
Browse files Browse the repository at this point in the history
Summary: `Any` is awful, and we can do a better job annotating. In particular, `object` is a better receiver in function parameters.

Reviewed By: yoney

Differential Revision: D64160650

fbshipit-source-id: c19ac185a7bd1b1c807f80c9f40b0caf90851f6b
  • Loading branch information
ahilger authored and facebook-github-bot committed Oct 11, 2024
1 parent 42ed612 commit d9789ed
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions thrift/lib/py3/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ class Set(Container): ...
class Map(Container): ...

class EnumMeta(type):
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
# pyre-ignore[2]: it can be anything
def __contains__(self: Type[_T], item: Any) -> bool: ...
def __getitem__(self: Type[_T], name: str) -> _T: ...
def __len__(self) -> int: ...
def __iter__(cls: Type[_T]) -> Iterator[_T]: ...
def __reversed__(cls: Type[_T]) -> Iterator[_T]: ...
def __contains__(cls: Type[_T], item: object) -> bool: ...
def __getitem__(cls: Type[_T], name: str) -> _T: ...
def __len__(cls) -> int: ...
@property
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...

Expand All @@ -91,12 +90,9 @@ class Enum(metaclass=EnumMeta):
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
def __index__(self) -> int: ...
# pyre-ignore[2]: it can be anything
def __eq__(self, other: Any) -> bool: ...
def __eq__(self, other: object) -> bool: ...

class Flag(Enum):
# pyre-fixme[14]: `__contains__` overrides method defined in `EnumMeta`
# inconsistently.
# pyre-fixme[14]: `__contains__` overrides method defined in `EnumMeta`
# inconsistently.
def __contains__(self: eT, other: eT) -> bool: ...
Expand Down

0 comments on commit d9789ed

Please sign in to comment.