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,11 +1,11 @@
import queue
import sys
import threading
from _typeshed import Self, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
from _typeshed import SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence
from types import TracebackType
from typing import Any, AnyStr, ClassVar, Generic, TypeVar, overload
from typing_extensions import SupportsIndex, TypeAlias
from typing_extensions import Self, SupportsIndex, TypeAlias
from .connection import Connection
from .context import BaseContext
@@ -116,8 +116,8 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ...
class ListProxy(BaseListProxy[_T]):
def __iadd__(self: Self, __x: Iterable[_T]) -> Self: ... # type: ignore[override]
def __imul__(self: Self, __n: SupportsIndex) -> Self: ... # type: ignore[override]
def __iadd__(self, __x: Iterable[_T]) -> Self: ... # type: ignore[override]
def __imul__(self, __n: SupportsIndex) -> Self: ... # type: ignore[override]
# Returned by BaseManager.get_server()
class Server:
@@ -165,7 +165,7 @@ class BaseManager:
method_to_typeid: Mapping[str, str] | None = None,
create_method: bool = True,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...