From e59c076fa92824b210ab6953ea2c52ecbe048dfe Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 3 Jul 2017 17:28:53 -0700 Subject: [PATCH] Revert "Add `__new__` to `str` and `int` stubs in both Pythons. (#1352)" This reverts commit fed4e03e5370058a1929db8c48ab5e9e93bbd350. --- stdlib/2/__builtin__.pyi | 6 ------ stdlib/3.4/enum.pyi | 5 +---- stdlib/3/builtins.pyi | 10 ---------- third_party/2/enum.pyi | 3 +-- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index bb2eb3a21d78..3ce63f628f50 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -92,11 +92,6 @@ class int(SupportsInt, SupportsFloat, SupportsAbs[int]): @overload def __init__(self, x: Union[str, unicode, bytearray], base: int = ...) -> None: ... - @overload - def __new__(cls: Type[_T1], x: SupportsInt = ...) -> _T1: ... - @overload - def __new__(cls: Type[_T1], x: Union[str, unicode, bytearray], base: int = ...) -> _T1: ... - def bit_length(self) -> int: ... def __add__(self, x: int) -> int: ... @@ -307,7 +302,6 @@ class unicode(basestring, Sequence[unicode]): class str(basestring, Sequence[str]): def __init__(self, object: object = ...) -> None: ... - def __new__(cls: Type[_T1], object: object = ...) -> _T1: ... def capitalize(self) -> str: ... def center(self, width: int, fillchar: str = ...) -> str: ... def count(self, x: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... diff --git a/stdlib/3.4/enum.pyi b/stdlib/3.4/enum.pyi index c2115f17717d..dbb9df3b7532 100644 --- a/stdlib/3.4/enum.pyi +++ b/stdlib/3.4/enum.pyi @@ -24,11 +24,8 @@ class Enum(metaclass=EnumMeta): name = ... # type: str value = ... # type: Any -_T1 = TypeVar('_T1') - -class IntEnum(int, Enum): # type: ignore +class IntEnum(int, Enum): value = ... # type: int - def __new__(cls: Type[_T1], value: Any) -> _T1: ... def unique(enumeration: _S) -> _S: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 19586b75d23f..50d9098e6e59 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -108,11 +108,6 @@ class int(SupportsInt, SupportsFloat, SupportsAbs[int]): @overload def __init__(self, x: Union[str, bytes], base: int = ...) -> None: ... - @overload - def __new__(cls: Type[_T1], x: SupportsInt = ...) -> _T1: ... - @overload - def __new__(cls: Type[_T1], x: Union[str, bytes], base: int = ...) -> _T1: ... - def bit_length(self) -> int: ... def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ... @classmethod @@ -240,11 +235,6 @@ class str(Sequence[str]): @overload def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> None: ... - @overload - def __new__(cls: Type[_T1], o: object = ...) -> _T1: ... - @overload - def __new__(cls: Type[_T1], o: bytes, encoding: str = ..., errors: str = ...) -> _T1: ... - def capitalize(self) -> str: ... def casefold(self) -> str: ... def center(self, width: int, fillchar: str = ' ') -> str: ... diff --git a/third_party/2/enum.pyi b/third_party/2/enum.pyi index c0b4659418e2..ae8a91c62094 100644 --- a/third_party/2/enum.pyi +++ b/third_party/2/enum.pyi @@ -16,7 +16,6 @@ class Enum(metaclass=EnumMeta): name = ... # type: str value = ... # type: Any -class IntEnum(int, Enum): # type: ignore - def __new__(cls: Type[_T], value: Any) -> _T: ... +class IntEnum(int, Enum): ... def unique(enumeration: _T) -> _T: ...