Skip to content

Commit 43c48cc

Browse files
committed
enum: add sunder methods that were new in 3.6
1 parent a778704 commit 43c48cc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

stdlib/3.4/enum.pyi

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# FIXME: Stub incomplete, ommissions include:
22
# * the metaclass
3-
# * _sunder_ methods with their transformations
43

54
import sys
65
from typing import List, Any, TypeVar, Union
76

7+
_T = TypeVar('_T')
8+
89
class Enum:
910
def __new__(cls, value: Any) -> None: ...
1011
def __repr__(self) -> str: ...
@@ -14,14 +15,21 @@ class Enum:
1415
def __hash__(self) -> Any: ...
1516
def __reduce_ex__(self, proto: Any) -> Any: ...
1617

18+
if sys.version_info >= (3, 6):
19+
# mypy complains here that the type of the first argument is not 'self', but that is correct
20+
# because this is an implicit staticmethod. Making it an explicit staticmethod silences
21+
# mypy, but does not actually work at runtime.
22+
def _generate_next_value_(name: str, start: int, count: int, last_values: List[Any]) -> Any: ... # type: ignore
23+
@classmethod
24+
def _missing_(self, value: Any) -> Any: ...
25+
_order_ = ... # type: Union[str, List[str]]
26+
1727
name = ... # type: str
1828
value = ... # type: Any
1929

2030
class IntEnum(int, Enum):
2131
value = ... # type: int
2232

23-
_T = TypeVar('_T')
24-
2533
def unique(enumeration: _T) -> _T: ...
2634

2735
if sys.version_info >= (3, 6):

0 commit comments

Comments
 (0)