Add __new__ to str and int stubs in both Pythons. (#1352)

* Update default values to `...` in `__init__` and `__new__` in `int` and `str`.
* Add `__new__` to `enum.IntEnum` to override inherited `__new__`.
* Add `type: ignore` comment to `IntEnum`
This commit is contained in:
Semyon Proshev
2017-06-13 06:53:32 +03:00
committed by Jelle Zijlstra
parent ed6dc176da
commit fed4e03e53
4 changed files with 34 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
from typing import List, Any, TypeVar
from typing import List, Any, TypeVar, Type
class Enum:
def __new__(cls, value: Any) -> None: ...
@@ -12,8 +12,9 @@ class Enum:
name = ... # type: str
value = ... # type: Any
class IntEnum(int, Enum): ...
_T = TypeVar('_T')
class IntEnum(int, Enum): # type: ignore
def __new__(cls: Type[_T], value: Any) -> _T: ...
def unique(enumeration: _T) -> _T: ...