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,6 @@
from _typeshed import Self
from collections.abc import Sequence
from typing import Any, TypeVar
from typing_extensions import Self
from .descriptor import Descriptor, FieldDescriptor
from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor
@@ -13,11 +13,11 @@ _M = TypeVar("_M", bound=Message) # message type (of self)
class Message:
DESCRIPTOR: Descriptor
def __deepcopy__(self: Self, memo: Any = ...) -> Self: ...
def __deepcopy__(self, memo: Any = ...) -> Self: ...
def __eq__(self, other_msg): ...
def __ne__(self, other_msg): ...
def MergeFrom(self: Self, other_msg: Self) -> None: ...
def CopyFrom(self: Self, other_msg: Self) -> None: ...
def MergeFrom(self, other_msg: Self) -> None: ...
def CopyFrom(self, other_msg: Self) -> None: ...
def Clear(self) -> None: ...
def SetInParent(self) -> None: ...
def IsInitialized(self) -> bool: ...
@@ -34,7 +34,7 @@ class Message:
def Extensions(self: _M) -> _ExtensionDict[_M]: ...
def ByteSize(self) -> int: ...
@classmethod
def FromString(cls: type[Self], s: bytes) -> Self: ...
def FromString(cls, s: bytes) -> Self: ...
# Intentionally left out typing on these three methods, because they are
# stringly typed and it is not useful to call them on a Message directly.
# We prefer more specific typing on individual subclasses of Message