From f81e4798619f790f1691e8aa8ab2910812d07fda Mon Sep 17 00:00:00 2001 From: Ethan Pronovost Date: Tue, 27 Oct 2020 01:14:48 -0700 Subject: [PATCH] Annotate extension methods in protobuf message (#4706) --- third_party/2and3/google/protobuf/message.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/2and3/google/protobuf/message.pyi b/third_party/2and3/google/protobuf/message.pyi index 60bcf8a67..62e9a329f 100644 --- a/third_party/2and3/google/protobuf/message.pyi +++ b/third_party/2and3/google/protobuf/message.pyi @@ -2,7 +2,7 @@ import sys from typing import Any, ByteString, Sequence, Tuple, Type, TypeVar, Union from .descriptor import Descriptor, FieldDescriptor -from .internal.extension_dict import _ExtensionDict +from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor class Error(Exception): ... class DecodeError(Error): ... @@ -30,8 +30,8 @@ class Message: def SerializeToString(self, deterministic: bool = ...) -> bytes: ... def SerializePartialToString(self, deterministic: bool = ...) -> bytes: ... def ListFields(self) -> Sequence[Tuple[FieldDescriptor, Any]]: ... - def HasExtension(self, extension_handle): ... - def ClearExtension(self, extension_handle): ... + def HasExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> bool: ... + def ClearExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> None: ... def ByteSize(self) -> int: ... @classmethod def FromString(cls: Type[_M], s: _Serialized) -> _M: ...