bytes, bytearray constructors: support buffers (#8924)

This commit is contained in:
Jelle Zijlstra
2022-10-18 11:20:20 -07:00
committed by GitHub
parent a1a245b3ab
commit 1b04ef2673

View File

@@ -587,15 +587,11 @@ class str(Sequence[str]):
class bytes(ByteString):
@overload
def __new__(cls: type[Self], __ints: Iterable[SupportsIndex]) -> Self: ...
def __new__(cls: type[Self], __o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer) -> Self: ...
@overload
def __new__(cls: type[Self], __string: str, encoding: str, errors: str = ...) -> Self: ...
@overload
def __new__(cls: type[Self], __length: SupportsIndex) -> Self: ...
@overload
def __new__(cls: type[Self]) -> Self: ...
@overload
def __new__(cls: type[Self], __o: SupportsBytes) -> Self: ...
def capitalize(self) -> bytes: ...
def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
def count(
@@ -696,11 +692,9 @@ class bytearray(MutableSequence[int], ByteString):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, __ints: Iterable[SupportsIndex]) -> None: ...
def __init__(self, __ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer) -> None: ...
@overload
def __init__(self, __string: str, encoding: str, errors: str = ...) -> None: ...
@overload
def __init__(self, __length: SupportsIndex) -> None: ...
def append(self, __item: SupportsIndex) -> None: ...
def capitalize(self) -> bytearray: ...
def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ...