mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-19 18:31:14 +08:00
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:
committed by
Jelle Zijlstra
parent
ed6dc176da
commit
fed4e03e53
@@ -88,11 +88,15 @@ class type(object):
|
||||
|
||||
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def __init__(self, x: SupportsInt = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: SupportsInt) -> None: ...
|
||||
def __init__(self, x: Union[str, unicode, bytearray], base: int = ...) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: Union[str, unicode, bytearray], base: int = 10) -> None: ...
|
||||
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: ...
|
||||
@@ -309,7 +313,8 @@ class unicode(basestring, Sequence[unicode]):
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class str(basestring, Sequence[str]):
|
||||
def __init__(self, object: object='') -> None: ...
|
||||
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: ...
|
||||
|
||||
Reference in New Issue
Block a user