mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-21 03:11:16 +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
@@ -103,7 +103,16 @@ class super:
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
|
||||
def __init__(self, x: Union[SupportsInt, str, bytes] = ..., base: int = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: SupportsInt = ...) -> None: ...
|
||||
@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
|
||||
@@ -227,11 +236,15 @@ class complex(SupportsAbs[float]):
|
||||
|
||||
class str(Sequence[str]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, o: object) -> None: ...
|
||||
def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, o: bytes, encoding: str = ..., errors: str = 'strict') -> None: ...
|
||||
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: ...
|
||||
|
||||
Reference in New Issue
Block a user