Use typing_extensions.Self in the stdlib (#9694)

This commit is contained in:
Alex Waygood
2023-02-09 09:12:13 +00:00
committed by GitHub
parent 10086c06a1
commit 9ed39d8796
98 changed files with 627 additions and 654 deletions

View File

@@ -1,10 +1,10 @@
import sys
from _typeshed import ReadableBuffer, Self, SupportsRead, SupportsWrite
from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite
from collections.abc import Iterable
# pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence
from typing import Any, Generic, MutableSequence, TypeVar, overload # noqa: Y022
from typing_extensions import Literal, SupportsIndex, TypeAlias
from typing_extensions import Literal, Self, SupportsIndex, TypeAlias
_IntTypeCode: TypeAlias = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
_FloatTypeCode: TypeAlias = Literal["f", "d"]
@@ -72,8 +72,8 @@ class array(MutableSequence[_T], Generic[_T]):
def __add__(self, __x: array[_T]) -> array[_T]: ...
def __ge__(self, __other: array[_T]) -> bool: ...
def __gt__(self, __other: array[_T]) -> bool: ...
def __iadd__(self: Self, __x: array[_T]) -> Self: ... # type: ignore[override]
def __imul__(self: Self, __n: int) -> Self: ...
def __iadd__(self, __x: array[_T]) -> Self: ... # type: ignore[override]
def __imul__(self, __n: int) -> Self: ...
def __le__(self, __other: array[_T]) -> bool: ...
def __lt__(self, __other: array[_T]) -> bool: ...
def __mul__(self, __n: int) -> array[_T]: ...