Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down Expand Up @@ -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: ...
Expand Down
5 changes: 1 addition & 4 deletions stdlib/3.4/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Expand Down
10 changes: 0 additions & 10 deletions stdlib/3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ...
Expand Down
3 changes: 1 addition & 2 deletions third_party/2/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're removing the explicit __new__, would it make sense to make the base class order "Enum, int" so that __new__ is inherited from Enum, not int?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also removed __new__ from int, so I don't think that makes a difference. Int comes first at runtime (https://github.com/python/cpython/blob/master/Lib/enum.py#L639), so putting Enum first here will probably break something.


def unique(enumeration: _T) -> _T: ...