builtins: Fix from_bytes() and fromhex() return type (#6842)

This commit is contained in:
Alex Waygood
2022-01-06 22:43:04 +00:00
committed by GitHub
parent c78107132c
commit df6f701ba4

View File

@@ -206,8 +206,12 @@ class int:
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
@classmethod
def from_bytes(
cls, bytes: Iterable[SupportsIndex] | SupportsBytes, byteorder: Literal["little", "big"], *, signed: bool = ...
) -> int: ... # TODO buffer object argument
cls: Type[Self],
bytes: Iterable[SupportsIndex] | SupportsBytes, # TODO buffer object argument
byteorder: Literal["little", "big"],
*,
signed: bool = ...,
) -> Self: ...
def __add__(self, __x: int) -> int: ...
def __sub__(self, __x: int) -> int: ...
def __mul__(self, __x: int) -> int: ...
@@ -273,7 +277,7 @@ class float:
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@classmethod
def fromhex(cls, __s: str) -> float: ...
def fromhex(cls: Type[Self], __s: str) -> Self: ...
@property
def real(self) -> float: ...
@property
@@ -518,7 +522,7 @@ class bytes(ByteString):
def upper(self) -> bytes: ...
def zfill(self, __width: SupportsIndex) -> bytes: ...
@classmethod
def fromhex(cls: Type[_T], __s: str) -> _T: ...
def fromhex(cls: Type[Self], __s: str) -> Self: ...
@staticmethod
def maketrans(__frm: bytes, __to: bytes) -> bytes: ...
def __len__(self) -> int: ...
@@ -622,7 +626,7 @@ class bytearray(MutableSequence[int], ByteString):
def upper(self) -> bytearray: ...
def zfill(self, __width: SupportsIndex) -> bytearray: ...
@classmethod
def fromhex(cls, __string: str) -> bytearray: ...
def fromhex(cls: Type[Self], __string: str) -> Self: ...
@staticmethod
def maketrans(__frm: bytes, __to: bytes) -> bytes: ...
def __len__(self) -> int: ...