From 9b479fd07e8ffad2cb1f333279379f4fdbf3dc56 Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Tue, 8 May 2018 19:39:45 -0700 Subject: [PATCH] Have Python 2 IntEnum values be ints (#2104) Currently the Python 2 stub for `IntEnum` just inherits from `Enum` without changing anything, meaning that its `value` has type `Any`. This changes it such that, if you know you have an `IntEnum` you get the more specific `int` type for the `value`. Note that this has already been done for Python 3 `IntEnum` (both in `third_party/3/enum.pyi` and `stdlib/3.4/enum.pyi`). --- third_party/2/enum.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/2/enum.pyi b/third_party/2/enum.pyi index 6fb5960e3..9b7b7cbfb 100644 --- a/third_party/2/enum.pyi +++ b/third_party/2/enum.pyi @@ -28,6 +28,7 @@ class Enum(metaclass=EnumMeta): name = ... # type: str value = ... # type: Any -class IntEnum(int, Enum): ... +class IntEnum(int, Enum): + value = ... # type: int def unique(enumeration: _S) -> _S: ...