From 08866f2701bf1dda083c281b35e5589363e0e791 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Wed, 3 Aug 2022 19:02:36 +0300 Subject: [PATCH 1/2] Simplify `Enum` definition --- stdlib/enum.pyi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 2ec13714c99e..608b27718fd4 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -174,10 +174,6 @@ class Enum(metaclass=EnumMeta): # (see #7752, #2539, mypy/#5788), # and in practice using `object` here has the same effect as using `Any`. def __new__(cls: type[Self], value: object) -> Self: ... - def __dir__(self) -> list[str]: ... - def __format__(self, format_spec: str) -> str: ... - def __hash__(self) -> Any: ... - def __reduce_ex__(self, proto: object) -> Any: ... if sys.version_info >= (3, 11): class ReprEnum(Enum): ... From 362fe62dd471b095c7e3357652fe616c939dcd08 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Wed, 3 Aug 2022 20:08:05 +0300 Subject: [PATCH 2/2] Address review --- stdlib/enum.pyi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 608b27718fd4..b7ebff887acb 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -174,6 +174,9 @@ class Enum(metaclass=EnumMeta): # (see #7752, #2539, mypy/#5788), # and in practice using `object` here has the same effect as using `Any`. def __new__(cls: type[Self], value: object) -> Self: ... + def __dir__(self) -> list[str]: ... + def __format__(self, format_spec: str) -> str: ... + def __reduce_ex__(self, proto: object) -> tuple[Any, ...]: ... if sys.version_info >= (3, 11): class ReprEnum(Enum): ...