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,6 +1,7 @@
import abc
from _typeshed import Incomplete, Self
from _typeshed import Incomplete
from typing import Any
from typing_extensions import Self
ConnectionError: Any
@@ -38,7 +39,7 @@ class _InProcessGlobalCache(GlobalCache):
class RedisCache(GlobalCache):
transient_errors: Any
@classmethod
def from_environment(cls: type[Self], strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
def from_environment(cls, strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
redis: Any
strict_read: Any
strict_write: Any
@@ -60,9 +61,7 @@ class MemcacheCache(GlobalCache):
def __eq__(self, other): ...
transient_errors: Any
@classmethod
def from_environment(
cls: type[Self], max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ...
) -> Self: ...
def from_environment(cls, max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
client: Any
strict_read: Any
strict_write: Any

View File

@@ -1,8 +1,7 @@
import datetime
from _typeshed import Self
from collections.abc import Callable, Iterable, Sequence
from typing import Any, NoReturn
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal, Self, TypeAlias
from google.cloud.ndb import exceptions, key as key_module, query as query_module, tasklets as tasklets_module
@@ -27,7 +26,7 @@ class _NotEqualMixin:
_Direction: TypeAlias = Literal["asc", "desc"]
class IndexProperty(_NotEqualMixin):
def __new__(cls: type[Self], name: str, direction: _Direction) -> Self: ...
def __new__(cls, name: str, direction: _Direction) -> Self: ...
@property
def name(self) -> str: ...
@property
@@ -36,7 +35,7 @@ class IndexProperty(_NotEqualMixin):
def __hash__(self) -> int: ...
class Index(_NotEqualMixin):
def __new__(cls: type[Self], kind: str, properties: list[IndexProperty], ancestor: bool) -> Self: ...
def __new__(cls, kind: str, properties: list[IndexProperty], ancestor: bool) -> Self: ...
@property
def kind(self) -> str: ...
@property
@@ -59,7 +58,7 @@ class IndexState(_NotEqualMixin):
class ModelAdapter:
# This actually returns NoReturn, but mypy can't handle that
def __new__(cls: type[Self], *args, **kwargs) -> Self: ...
def __new__(cls, *args, **kwargs) -> Self: ...
def make_connection(*args, **kwargs) -> NoReturn: ...