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,8 +1,7 @@
import sys
from _typeshed import Self
from collections.abc import Callable
from typing import Any, Generic, TypeVar, overload
from typing_extensions import final
from typing_extensions import Self, final
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -21,7 +20,7 @@ class ProxyType(Generic[_T]): # "weakproxy"
class ReferenceType(Generic[_T]):
__callback__: Callable[[ReferenceType[_T]], Any]
def __new__(cls: type[Self], o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
def __new__(cls, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
def __call__(self) -> _T | None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...