Improve collections.UserString (#7189)

This commit is contained in:
Alex Waygood
2022-02-14 01:09:06 +00:00
committed by GitHub
parent 63489c305d
commit 7f472e94e5

View File

@@ -112,7 +112,7 @@ class UserList(MutableSequence[_T]):
def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ...
def extend(self, other: Iterable[_T]) -> None: ...
class UserString(Sequence[str]):
class UserString(Sequence[UserString]):
data: str
def __init__(self, seq: object) -> None: ...
def __int__(self) -> int: ...
@@ -125,10 +125,9 @@ class UserString(Sequence[str]):
def __ge__(self, string: str | UserString) -> bool: ...
def __contains__(self, char: object) -> bool: ...
def __len__(self) -> int: ...
# It should return a str to implement Sequence correctly, but it doesn't.
def __getitem__(self: Self, i: SupportsIndex | slice) -> Self: ... # type: ignore[override]
def __iter__(self: Self) -> Iterator[Self]: ... # type: ignore[override]
def __reversed__(self: Self) -> Iterator[Self]: ... # type: ignore[override]
def __getitem__(self: Self, i: SupportsIndex | slice) -> Self: ...
def __iter__(self: Self) -> Iterator[Self]: ...
def __reversed__(self: Self) -> Iterator[Self]: ...
def __add__(self: Self, other: object) -> Self: ...
def __mul__(self: Self, n: int) -> Self: ...
def __mod__(self: Self, args: Any) -> Self: ...