Use typing_extensions.Self instead of _typeshed.Self (#9702)

This commit is contained in:
Alex Waygood
2023-02-15 11:32:43 +01:00
committed by GitHub
parent 8cd6d81f15
commit 7180d0223b
140 changed files with 597 additions and 610 deletions

View File

@@ -1,9 +1,9 @@
from _typeshed import Incomplete, Self
from _typeshed import Incomplete
from collections.abc import Callable, Coroutine, Mapping, Sequence
from contextlib import AbstractContextManager
from types import TracebackType
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Literal
from typing_extensions import Literal, Self
_F = TypeVar("_F", bound=Callable[..., Any])
_AF = TypeVar("_AF", bound=Callable[..., Coroutine[Any, Any, Any]])
@@ -45,7 +45,7 @@ DEFAULT: _SentinelObject
class _Call(tuple[Any, ...]):
def __new__(
cls: type[Self],
cls,
value: Any = ...,
name: Incomplete | None = ...,
parent: Incomplete | None = ...,
@@ -85,7 +85,7 @@ class Base:
# something that can't be expressed with our static type system.
class NonCallableMock(Base, Any):
def __new__(
cls: type[Self],
cls,
spec: list[str] | object | type[object] | None = ...,
wraps: Incomplete | None = ...,
name: str | None = ...,
@@ -373,7 +373,7 @@ class _SpecState:
def mock_open(mock: Incomplete | None = ..., read_data: Any = ...) -> Any: ...
class PropertyMock(Mock):
def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ...
def __get__(self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ...
def __set__(self, obj: Any, value: Any) -> None: ...
def seal(mock: Any) -> None: ...