mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-25 11:07:17 +08:00
protobuf: Bring back Message.Extensions (#7154)
This commit is contained in:
@@ -2,7 +2,7 @@ from _typeshed import Self
|
||||
from typing import Any, Sequence, TypeVar
|
||||
|
||||
from .descriptor import Descriptor, FieldDescriptor
|
||||
from .internal.extension_dict import _ExtensionFieldDescriptor
|
||||
from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor
|
||||
|
||||
class Error(Exception): ...
|
||||
class DecodeError(Error): ...
|
||||
@@ -28,6 +28,9 @@ class Message:
|
||||
# The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `HasExtension` & `ClearExtension`
|
||||
def HasExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> bool: ...
|
||||
def ClearExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, 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 ByteSize(self) -> int: ...
|
||||
@classmethod
|
||||
def FromString(cls: type[Self], s: bytes) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user