Make args positional-only for `str, bytes and bytearray` (#6248)

This commit is contained in:
Alex Waygood
2021-11-05 19:53:22 +00:00
committed by GitHub
parent ac9b0746ec
commit e7b4b73102

View File

@@ -335,7 +335,7 @@ class _FormatMapMapping(Protocol):
class str(Sequence[str]):
@overload
def __new__(cls: Type[_T], o: object = ...) -> _T: ...
def __new__(cls: Type[_T], object: object = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
def capitalize(self) -> str: ...
@@ -399,21 +399,21 @@ class str(Sequence[str]):
@staticmethod
@overload
def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ...
def __add__(self, s: str) -> str: ...
def __add__(self, __s: str) -> str: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: str) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ge__(self, x: str) -> bool: ...
def __getitem__(self, i: int | slice) -> str: ...
def __gt__(self, x: str) -> bool: ...
def __contains__(self, __o: str) -> bool: ... # type: ignore
def __eq__(self, __x: object) -> bool: ...
def __ge__(self, __x: str) -> bool: ...
def __getitem__(self, __i: int | slice) -> str: ...
def __gt__(self, __x: str) -> bool: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
def __le__(self, x: str) -> bool: ...
def __le__(self, __x: str) -> bool: ...
def __len__(self) -> int: ...
def __lt__(self, x: str) -> bool: ...
def __mod__(self, x: Any) -> str: ...
def __mul__(self, n: SupportsIndex) -> str: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, __x: str) -> bool: ...
def __mod__(self, __x: Any) -> str: ...
def __mul__(self, __n: SupportsIndex) -> str: ...
def __ne__(self, __x: object) -> bool: ...
def __repr__(self) -> str: ...
def __rmul__(self, n: SupportsIndex) -> str: ...
def __str__(self) -> str: ...
@@ -421,15 +421,15 @@ class str(Sequence[str]):
class bytes(ByteString):
@overload
def __new__(cls: Type[_T], ints: Iterable[SupportsIndex]) -> _T: ...
def __new__(cls: Type[_T], __ints: Iterable[SupportsIndex]) -> _T: ...
@overload
def __new__(cls: Type[_T], string: str, encoding: str, errors: str = ...) -> _T: ...
def __new__(cls: Type[_T], __string: str, encoding: str, errors: str = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], length: SupportsIndex) -> _T: ...
def __new__(cls: Type[_T], __length: SupportsIndex) -> _T: ...
@overload
def __new__(cls: Type[_T]) -> _T: ...
@overload
def __new__(cls: Type[_T], o: SupportsBytes) -> _T: ...
def __new__(cls: Type[_T], __o: SupportsBytes) -> _T: ...
def capitalize(self) -> bytes: ...
def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
def count(
@@ -502,32 +502,32 @@ class bytes(ByteString):
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: SupportsIndex) -> int: ...
def __getitem__(self, __i: SupportsIndex) -> int: ...
@overload
def __getitem__(self, s: slice) -> bytes: ...
def __add__(self, s: bytes) -> bytes: ...
def __mul__(self, n: SupportsIndex) -> bytes: ...
def __rmul__(self, n: SupportsIndex) -> bytes: ...
def __mod__(self, value: Any) -> bytes: ...
def __getitem__(self, __s: slice) -> bytes: ...
def __add__(self, __s: bytes) -> bytes: ...
def __mul__(self, __n: SupportsIndex) -> bytes: ...
def __rmul__(self, __n: SupportsIndex) -> bytes: ...
def __mod__(self, __value: Any) -> bytes: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: SupportsIndex | bytes) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
def __contains__(self, __o: SupportsIndex | bytes) -> bool: ... # type: ignore
def __eq__(self, __x: object) -> bool: ...
def __ne__(self, __x: object) -> bool: ...
def __lt__(self, __x: bytes) -> bool: ...
def __le__(self, __x: bytes) -> bool: ...
def __gt__(self, __x: bytes) -> bool: ...
def __ge__(self, __x: bytes) -> bool: ...
def __getnewargs__(self) -> tuple[bytes]: ...
class bytearray(MutableSequence[int], ByteString):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, ints: Iterable[SupportsIndex]) -> None: ...
def __init__(self, __ints: Iterable[SupportsIndex]) -> None: ...
@overload
def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ...
def __init__(self, __string: str, encoding: str, errors: str = ...) -> None: ...
@overload
def __init__(self, length: SupportsIndex) -> None: ...
def __init__(self, __length: SupportsIndex) -> None: ...
def append(self, __item: SupportsIndex) -> None: ...
def capitalize(self) -> bytearray: ...
def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ...
@@ -604,28 +604,28 @@ class bytearray(MutableSequence[int], ByteString):
def __repr__(self) -> str: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: SupportsIndex) -> int: ...
def __getitem__(self, __i: SupportsIndex) -> int: ...
@overload
def __getitem__(self, s: slice) -> bytearray: ...
def __getitem__(self, __s: slice) -> bytearray: ...
@overload
def __setitem__(self, i: SupportsIndex, x: SupportsIndex) -> None: ...
def __setitem__(self, __i: SupportsIndex, x: SupportsIndex) -> None: ...
@overload
def __setitem__(self, s: slice, x: Iterable[SupportsIndex] | bytes) -> None: ...
def __delitem__(self, i: SupportsIndex | slice) -> None: ...
def __add__(self, s: bytes) -> bytearray: ...
def __iadd__(self, s: Iterable[int]) -> bytearray: ...
def __mul__(self, n: SupportsIndex) -> bytearray: ...
def __rmul__(self, n: SupportsIndex) -> bytearray: ...
def __imul__(self, n: SupportsIndex) -> bytearray: ...
def __mod__(self, value: Any) -> bytes: ...
def __setitem__(self, __s: slice, __x: Iterable[SupportsIndex] | bytes) -> None: ...
def __delitem__(self, __i: SupportsIndex | slice) -> None: ...
def __add__(self, __s: bytes) -> bytearray: ...
def __iadd__(self, __s: Iterable[int]) -> bytearray: ...
def __mul__(self, __n: SupportsIndex) -> bytearray: ...
def __rmul__(self, __n: SupportsIndex) -> bytearray: ...
def __imul__(self, __n: SupportsIndex) -> bytearray: ...
def __mod__(self, __value: Any) -> bytes: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: SupportsIndex | bytes) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
def __contains__(self, __o: SupportsIndex | bytes) -> bool: ... # type: ignore
def __eq__(self, __x: object) -> bool: ...
def __ne__(self, __x: object) -> bool: ...
def __lt__(self, __x: bytes) -> bool: ...
def __le__(self, __x: bytes) -> bool: ...
def __gt__(self, __x: bytes) -> bool: ...
def __ge__(self, __x: bytes) -> bool: ...
class memoryview(Sized, Sequence[int]):
format: str