mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-12 10:52:31 +08:00
Bump ruff to 0.11.2 (#13757)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
|
||||
from typing import Any, Protocol, SupportsIndex, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
|
||||
from google.protobuf.descriptor import Descriptor
|
||||
from google.protobuf.internal.message_listener import MessageListener
|
||||
@@ -10,7 +11,6 @@ _T = TypeVar("_T")
|
||||
_K = TypeVar("_K", bound=bool | int | str)
|
||||
_ScalarV = TypeVar("_ScalarV", bound=bool | int | float | str | bytes)
|
||||
_MessageV = TypeVar("_MessageV", bound=Message)
|
||||
_M = TypeVar("_M")
|
||||
|
||||
class _ValueChecker(Protocol[_T]):
|
||||
def CheckValue(self, proposed_value: _T) -> _T: ...
|
||||
@@ -33,7 +33,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]):
|
||||
def append(self, value: _ScalarV) -> None: ...
|
||||
def insert(self, key: int, value: _ScalarV) -> None: ...
|
||||
def extend(self, elem_seq: Iterable[_ScalarV] | None) -> None: ...
|
||||
def MergeFrom(self: _M, other: _M | Iterable[_ScalarV]) -> None: ...
|
||||
def MergeFrom(self, other: Self | Iterable[_ScalarV]) -> None: ...
|
||||
def remove(self, elem: _ScalarV) -> None: ...
|
||||
def pop(self, key: int = -1) -> _ScalarV: ...
|
||||
@overload
|
||||
@@ -49,7 +49,7 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]):
|
||||
def append(self, value: _MessageV) -> None: ...
|
||||
def insert(self, key: int, value: _MessageV) -> None: ...
|
||||
def extend(self, elem_seq: Iterable[_MessageV]) -> None: ...
|
||||
def MergeFrom(self: _M, other: _M | Iterable[_MessageV]) -> None: ...
|
||||
def MergeFrom(self, other: Self | Iterable[_MessageV]) -> None: ...
|
||||
def remove(self, elem: _MessageV) -> None: ...
|
||||
def pop(self, key: int = -1) -> _MessageV: ...
|
||||
def __delitem__(self, key: int | slice) -> None: ...
|
||||
@@ -73,7 +73,7 @@ class ScalarMap(MutableMapping[_K, _ScalarV]):
|
||||
def get(self, key: _K, default: None = None) -> _ScalarV | None: ...
|
||||
@overload
|
||||
def get(self, key: _K, default: _ScalarV | _T) -> _ScalarV | _T: ...
|
||||
def MergeFrom(self: _M, other: _M): ...
|
||||
def MergeFrom(self, other: Self): ...
|
||||
def InvalidateIterators(self) -> None: ...
|
||||
def GetEntryClass(self) -> GeneratedProtocolMessageType: ...
|
||||
|
||||
@@ -96,6 +96,6 @@ class MessageMap(MutableMapping[_K, _MessageV]):
|
||||
@overload
|
||||
def get(self, key: _K, default: _MessageV | _T) -> _MessageV | _T: ...
|
||||
def get_or_create(self, key: _K) -> _MessageV: ...
|
||||
def MergeFrom(self: _M, other: _M): ...
|
||||
def MergeFrom(self, other: Self): ...
|
||||
def InvalidateIterators(self) -> None: ...
|
||||
def GetEntryClass(self) -> GeneratedProtocolMessageType: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, TypeVar
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
from .descriptor import Descriptor, FieldDescriptor
|
||||
@@ -9,8 +9,6 @@ class Error(Exception): ...
|
||||
class DecodeError(Error): ...
|
||||
class EncodeError(Error): ...
|
||||
|
||||
_M = TypeVar("_M", bound=Message) # message type (of self)
|
||||
|
||||
class Message:
|
||||
DESCRIPTOR: Descriptor
|
||||
def __deepcopy__(self, memo: Any = None) -> Self: ...
|
||||
@@ -26,12 +24,11 @@ class Message:
|
||||
def SerializeToString(self, *, deterministic: bool = ...) -> bytes: ...
|
||||
def SerializePartialToString(self, *, deterministic: bool = ...) -> bytes: ...
|
||||
def ListFields(self) -> Sequence[tuple[FieldDescriptor, Any]]: ...
|
||||
# The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `HasExtension` & `ClearExtension`
|
||||
def HasExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> bool: ...
|
||||
def ClearExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> None: ...
|
||||
def HasExtension(self, field_descriptor: _ExtensionFieldDescriptor[Self, Any]) -> bool: ...
|
||||
def ClearExtension(self, field_descriptor: _ExtensionFieldDescriptor[Self, Any]) -> None: ...
|
||||
# The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `Extensions`
|
||||
@property
|
||||
def Extensions(self: _M) -> _ExtensionDict[_M]: ...
|
||||
def Extensions(self) -> _ExtensionDict[Self]: ...
|
||||
def ByteSize(self) -> int: ...
|
||||
@classmethod
|
||||
def FromString(cls, s: bytes) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user