From f43ee406f155b563856551fb7215cb03fdef8e2d Mon Sep 17 00:00:00 2001 From: Nipunn Koorapati Date: Thu, 20 Oct 2022 17:26:57 -0700 Subject: [PATCH] Bump mypy-protobuf to 3.4.0 (#8951) --- scripts/generate_proto_stubs.sh | 2 +- stubs/protobuf/METADATA.toml | 2 +- stubs/protobuf/google/protobuf/any_pb2.pyi | 1 + stubs/protobuf/google/protobuf/api_pb2.pyi | 3 +++ .../google/protobuf/compiler/plugin_pb2.pyi | 4 +++ .../google/protobuf/descriptor_pb2.pyi | 27 +++++++++++++++++++ .../protobuf/google/protobuf/duration_pb2.pyi | 1 + stubs/protobuf/google/protobuf/empty_pb2.pyi | 7 +++++ .../google/protobuf/field_mask_pb2.pyi | 1 + .../google/protobuf/source_context_pb2.pyi | 1 + stubs/protobuf/google/protobuf/struct_pb2.pyi | 6 ++++- .../google/protobuf/timestamp_pb2.pyi | 1 + stubs/protobuf/google/protobuf/type_pb2.pyi | 7 ++++- .../protobuf/google/protobuf/wrappers_pb2.pyi | 9 +++++++ 14 files changed, 68 insertions(+), 4 deletions(-) diff --git a/scripts/generate_proto_stubs.sh b/scripts/generate_proto_stubs.sh index 0d4a04909..f1315b8a4 100755 --- a/scripts/generate_proto_stubs.sh +++ b/scripts/generate_proto_stubs.sh @@ -13,7 +13,7 @@ set -ex -o pipefail # Update these two variables when rerunning script PROTOBUF_VERSION=21.8 PYTHON_PROTOBUF_VERSION=4.21.8 -MYPY_PROTOBUF_VERSION=v3.3.0 +MYPY_PROTOBUF_VERSION=v3.4.0 if uname -a | grep Darwin; then # brew install coreutils wget diff --git a/stubs/protobuf/METADATA.toml b/stubs/protobuf/METADATA.toml index 6967a3b44..06628e4dc 100644 --- a/stubs/protobuf/METADATA.toml +++ b/stubs/protobuf/METADATA.toml @@ -1,2 +1,2 @@ version = "3.20.*" -extra_description = "Generated with aid from mypy-protobuf v3.3.0" +extra_description = "Generated with aid from mypy-protobuf v3.4.0" diff --git a/stubs/protobuf/google/protobuf/any_pb2.pyi b/stubs/protobuf/google/protobuf/any_pb2.pyi index 060b28cdf..398a9abad 100644 --- a/stubs/protobuf/google/protobuf/any_pb2.pyi +++ b/stubs/protobuf/google/protobuf/any_pb2.pyi @@ -44,6 +44,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class Any(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Any): """`Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. diff --git a/stubs/protobuf/google/protobuf/api_pb2.pyi b/stubs/protobuf/google/protobuf/api_pb2.pyi index 7c8a56033..4cedb0da9 100644 --- a/stubs/protobuf/google/protobuf/api_pb2.pyi +++ b/stubs/protobuf/google/protobuf/api_pb2.pyi @@ -47,6 +47,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class Api(google.protobuf.message.Message): """Api is a light-weight descriptor for an API Interface. @@ -125,6 +126,7 @@ class Api(google.protobuf.message.Message): global___Api = Api +@typing_extensions.final class Method(google.protobuf.message.Message): """Method represents a method of an API interface.""" @@ -167,6 +169,7 @@ class Method(google.protobuf.message.Message): global___Method = Method +@typing_extensions.final class Mixin(google.protobuf.message.Message): """Declares an API Interface to be included in this interface. The including interface must redeclare all the methods from the included interface, but diff --git a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi index 5cdccb792..2c54ee220 100644 --- a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi +++ b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi @@ -34,6 +34,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class Version(google.protobuf.message.Message): """The version number of protocol compiler.""" @@ -63,6 +64,7 @@ class Version(google.protobuf.message.Message): global___Version = Version +@typing_extensions.final class CodeGeneratorRequest(google.protobuf.message.Message): """An encoded CodeGeneratorRequest is written to the plugin's stdin.""" @@ -113,6 +115,7 @@ class CodeGeneratorRequest(google.protobuf.message.Message): global___CodeGeneratorRequest = CodeGeneratorRequest +@typing_extensions.final class CodeGeneratorResponse(google.protobuf.message.Message): """The plugin writes an encoded CodeGeneratorResponse to stdout.""" @@ -133,6 +136,7 @@ class CodeGeneratorResponse(google.protobuf.message.Message): FEATURE_NONE: CodeGeneratorResponse.Feature.ValueType # 0 FEATURE_PROTO3_OPTIONAL: CodeGeneratorResponse.Feature.ValueType # 1 + @typing_extensions.final class File(google.protobuf.message.Message): """Represents a single generated file.""" diff --git a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi index 4201fc470..e37479b5c 100644 --- a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +++ b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi @@ -25,6 +25,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class FileDescriptorSet(google.protobuf.message.Message): """The protocol compiler can output a FileDescriptorSet containing the .proto files it parses. @@ -44,6 +45,7 @@ class FileDescriptorSet(google.protobuf.message.Message): global___FileDescriptorSet = FileDescriptorSet +@typing_extensions.final class FileDescriptorProto(google.protobuf.message.Message): """Describes a complete .proto file.""" @@ -119,11 +121,13 @@ class FileDescriptorProto(google.protobuf.message.Message): global___FileDescriptorProto = FileDescriptorProto +@typing_extensions.final class DescriptorProto(google.protobuf.message.Message): """Describes a message type.""" DESCRIPTOR: google.protobuf.descriptor.Descriptor + @typing_extensions.final class ExtensionRange(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -146,6 +150,7 @@ class DescriptorProto(google.protobuf.message.Message): def HasField(self, field_name: typing_extensions.Literal["end", b"end", "options", b"options", "start", b"start"]) -> builtins.bool: ... def ClearField(self, field_name: typing_extensions.Literal["end", b"end", "options", b"options", "start", b"start"]) -> None: ... + @typing_extensions.final class ReservedRange(google.protobuf.message.Message): """Range of reserved tag numbers. Reserved tag numbers may not be used by fields or extension ranges in the same message. Reserved ranges may @@ -220,6 +225,7 @@ class DescriptorProto(google.protobuf.message.Message): global___DescriptorProto = DescriptorProto +@typing_extensions.final class ExtensionRangeOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -236,6 +242,7 @@ class ExtensionRangeOptions(google.protobuf.message.Message): global___ExtensionRangeOptions = ExtensionRangeOptions +@typing_extensions.final class FieldDescriptorProto(google.protobuf.message.Message): """Describes a field within a message.""" @@ -429,6 +436,7 @@ class FieldDescriptorProto(google.protobuf.message.Message): global___FieldDescriptorProto = FieldDescriptorProto +@typing_extensions.final class OneofDescriptorProto(google.protobuf.message.Message): """Describes a oneof.""" @@ -450,11 +458,13 @@ class OneofDescriptorProto(google.protobuf.message.Message): global___OneofDescriptorProto = OneofDescriptorProto +@typing_extensions.final class EnumDescriptorProto(google.protobuf.message.Message): """Describes an enum type.""" DESCRIPTOR: google.protobuf.descriptor.Descriptor + @typing_extensions.final class EnumReservedRange(google.protobuf.message.Message): """Range of reserved numeric values. Reserved values may not be used by entries in the same enum. Reserved ranges may not overlap. @@ -516,6 +526,7 @@ class EnumDescriptorProto(google.protobuf.message.Message): global___EnumDescriptorProto = EnumDescriptorProto +@typing_extensions.final class EnumValueDescriptorProto(google.protobuf.message.Message): """Describes a value within an enum.""" @@ -540,6 +551,7 @@ class EnumValueDescriptorProto(google.protobuf.message.Message): global___EnumValueDescriptorProto = EnumValueDescriptorProto +@typing_extensions.final class ServiceDescriptorProto(google.protobuf.message.Message): """Describes a service.""" @@ -565,6 +577,7 @@ class ServiceDescriptorProto(google.protobuf.message.Message): global___ServiceDescriptorProto = ServiceDescriptorProto +@typing_extensions.final class MethodDescriptorProto(google.protobuf.message.Message): """Describes a method of a service.""" @@ -603,6 +616,7 @@ class MethodDescriptorProto(google.protobuf.message.Message): global___MethodDescriptorProto = MethodDescriptorProto +@typing_extensions.final class FileOptions(google.protobuf.message.Message): """Each of the definitions above may have "options" attached. These are just annotations which may cause code to be generated slightly differently @@ -814,6 +828,7 @@ class FileOptions(google.protobuf.message.Message): global___FileOptions = FileOptions +@typing_extensions.final class MessageOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -893,6 +908,7 @@ class MessageOptions(google.protobuf.message.Message): global___MessageOptions = MessageOptions +@typing_extensions.final class FieldOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1037,6 +1053,7 @@ class FieldOptions(google.protobuf.message.Message): global___FieldOptions = FieldOptions +@typing_extensions.final class OneofOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1053,6 +1070,7 @@ class OneofOptions(google.protobuf.message.Message): global___OneofOptions = OneofOptions +@typing_extensions.final class EnumOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1084,6 +1102,7 @@ class EnumOptions(google.protobuf.message.Message): global___EnumOptions = EnumOptions +@typing_extensions.final class EnumValueOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1109,6 +1128,7 @@ class EnumValueOptions(google.protobuf.message.Message): global___EnumValueOptions = EnumValueOptions +@typing_extensions.final class ServiceOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1139,6 +1159,7 @@ class ServiceOptions(google.protobuf.message.Message): global___ServiceOptions = ServiceOptions +@typing_extensions.final class MethodOptions(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1196,6 +1217,7 @@ class MethodOptions(google.protobuf.message.Message): global___MethodOptions = MethodOptions +@typing_extensions.final class UninterpretedOption(google.protobuf.message.Message): """A message representing a option the parser does not recognize. This only appears in options protos created by the compiler::Parser class. @@ -1207,6 +1229,7 @@ class UninterpretedOption(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor + @typing_extensions.final class NamePart(google.protobuf.message.Message): """The name of the uninterpreted option. Each string represents a segment in a dot-separated name. is_extension is true iff a segment represents an @@ -1264,6 +1287,7 @@ class UninterpretedOption(google.protobuf.message.Message): global___UninterpretedOption = UninterpretedOption +@typing_extensions.final class SourceCodeInfo(google.protobuf.message.Message): """=================================================================== Optional source code info @@ -1274,6 +1298,7 @@ class SourceCodeInfo(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor + @typing_extensions.final class Location(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1436,6 +1461,7 @@ class SourceCodeInfo(google.protobuf.message.Message): global___SourceCodeInfo = SourceCodeInfo +@typing_extensions.final class GeneratedCodeInfo(google.protobuf.message.Message): """Describes the relationship between generated code and its original source file. A GeneratedCodeInfo message is associated with only one generated @@ -1444,6 +1470,7 @@ class GeneratedCodeInfo(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor + @typing_extensions.final class Annotation(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/protobuf/google/protobuf/duration_pb2.pyi b/stubs/protobuf/google/protobuf/duration_pb2.pyi index 1f7536ec4..d8f7931a7 100644 --- a/stubs/protobuf/google/protobuf/duration_pb2.pyi +++ b/stubs/protobuf/google/protobuf/duration_pb2.pyi @@ -44,6 +44,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class Duration(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Duration): """A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond diff --git a/stubs/protobuf/google/protobuf/empty_pb2.pyi b/stubs/protobuf/google/protobuf/empty_pb2.pyi index b58448ea1..22ef26b7d 100644 --- a/stubs/protobuf/google/protobuf/empty_pb2.pyi +++ b/stubs/protobuf/google/protobuf/empty_pb2.pyi @@ -33,9 +33,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import google.protobuf.descriptor import google.protobuf.message +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class Empty(google.protobuf.message.Message): """A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request diff --git a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi index 95419b83b..1721c1bc6 100644 --- a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi +++ b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi @@ -46,6 +46,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class FieldMask(google.protobuf.message.Message, google.protobuf.internal.well_known_types.FieldMask): """`FieldMask` represents a set of symbolic field paths, for example: diff --git a/stubs/protobuf/google/protobuf/source_context_pb2.pyi b/stubs/protobuf/google/protobuf/source_context_pb2.pyi index ad6fc42ee..cb4fb572e 100644 --- a/stubs/protobuf/google/protobuf/source_context_pb2.pyi +++ b/stubs/protobuf/google/protobuf/source_context_pb2.pyi @@ -43,6 +43,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class SourceContext(google.protobuf.message.Message): """`SourceContext` represents information about the source of a protobuf element, like the file in which it is defined. diff --git a/stubs/protobuf/google/protobuf/struct_pb2.pyi b/stubs/protobuf/google/protobuf/struct_pb2.pyi index 8d0756b1e..bf2771ec0 100644 --- a/stubs/protobuf/google/protobuf/struct_pb2.pyi +++ b/stubs/protobuf/google/protobuf/struct_pb2.pyi @@ -52,7 +52,7 @@ class _NullValue: ValueType = typing.NewType("ValueType", builtins.int) V: typing_extensions.TypeAlias = ValueType -class _NullValueEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_NullValue.ValueType], builtins.type): # noqa: F821 +class _NullValueEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_NullValue.ValueType], builtins.type): DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor NULL_VALUE: _NullValue.ValueType # 0 """Null value.""" @@ -68,6 +68,7 @@ NULL_VALUE: NullValue.ValueType # 0 """Null value.""" global___NullValue = NullValue +@typing_extensions.final class Struct(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Struct): """`Struct` represents a structured data value, consisting of fields which map to dynamically typed values. In some languages, `Struct` @@ -81,6 +82,7 @@ class Struct(google.protobuf.message.Message, google.protobuf.internal.well_know DESCRIPTOR: google.protobuf.descriptor.Descriptor + @typing_extensions.final class FieldsEntry(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -111,6 +113,7 @@ class Struct(google.protobuf.message.Message, google.protobuf.internal.well_know global___Struct = Struct +@typing_extensions.final class Value(google.protobuf.message.Message): """`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a @@ -158,6 +161,7 @@ class Value(google.protobuf.message.Message): global___Value = Value +@typing_extensions.final class ListValue(google.protobuf.message.Message, google.protobuf.internal.well_known_types.ListValue): """`ListValue` is a wrapper around a repeated field of values. diff --git a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi index cefde9085..b8f5b636e 100644 --- a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi +++ b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi @@ -44,6 +44,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class Timestamp(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Timestamp): """A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at diff --git a/stubs/protobuf/google/protobuf/type_pb2.pyi b/stubs/protobuf/google/protobuf/type_pb2.pyi index cbb60b40b..5071cdf65 100644 --- a/stubs/protobuf/google/protobuf/type_pb2.pyi +++ b/stubs/protobuf/google/protobuf/type_pb2.pyi @@ -53,7 +53,7 @@ class _Syntax: ValueType = typing.NewType("ValueType", builtins.int) V: typing_extensions.TypeAlias = ValueType -class _SyntaxEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Syntax.ValueType], builtins.type): # noqa: F821 +class _SyntaxEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Syntax.ValueType], builtins.type): DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor SYNTAX_PROTO2: _Syntax.ValueType # 0 """Syntax `proto2`.""" @@ -69,6 +69,7 @@ SYNTAX_PROTO3: Syntax.ValueType # 1 """Syntax `proto3`.""" global___Syntax = Syntax +@typing_extensions.final class Type(google.protobuf.message.Message): """A protocol buffer message type.""" @@ -111,6 +112,7 @@ class Type(google.protobuf.message.Message): global___Type = Type +@typing_extensions.final class Field(google.protobuf.message.Message): """A single field of a message type.""" @@ -283,6 +285,7 @@ class Field(google.protobuf.message.Message): global___Field = Field +@typing_extensions.final class Enum(google.protobuf.message.Message): """Enum type definition.""" @@ -320,6 +323,7 @@ class Enum(google.protobuf.message.Message): global___Enum = Enum +@typing_extensions.final class EnumValue(google.protobuf.message.Message): """Enum value definition.""" @@ -346,6 +350,7 @@ class EnumValue(google.protobuf.message.Message): global___EnumValue = EnumValue +@typing_extensions.final class Option(google.protobuf.message.Message): """A protocol buffer option, which can be attached to a message, field, enumeration, etc. diff --git a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi index c3155f65b..201b9258a 100644 --- a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi +++ b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi @@ -23,6 +23,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor +@typing_extensions.final class DoubleValue(google.protobuf.message.Message): """Wrapper message for `double`. @@ -43,6 +44,7 @@ class DoubleValue(google.protobuf.message.Message): global___DoubleValue = DoubleValue +@typing_extensions.final class FloatValue(google.protobuf.message.Message): """Wrapper message for `float`. @@ -63,6 +65,7 @@ class FloatValue(google.protobuf.message.Message): global___FloatValue = FloatValue +@typing_extensions.final class Int64Value(google.protobuf.message.Message): """Wrapper message for `int64`. @@ -83,6 +86,7 @@ class Int64Value(google.protobuf.message.Message): global___Int64Value = Int64Value +@typing_extensions.final class UInt64Value(google.protobuf.message.Message): """Wrapper message for `uint64`. @@ -103,6 +107,7 @@ class UInt64Value(google.protobuf.message.Message): global___UInt64Value = UInt64Value +@typing_extensions.final class Int32Value(google.protobuf.message.Message): """Wrapper message for `int32`. @@ -123,6 +128,7 @@ class Int32Value(google.protobuf.message.Message): global___Int32Value = Int32Value +@typing_extensions.final class UInt32Value(google.protobuf.message.Message): """Wrapper message for `uint32`. @@ -143,6 +149,7 @@ class UInt32Value(google.protobuf.message.Message): global___UInt32Value = UInt32Value +@typing_extensions.final class BoolValue(google.protobuf.message.Message): """Wrapper message for `bool`. @@ -163,6 +170,7 @@ class BoolValue(google.protobuf.message.Message): global___BoolValue = BoolValue +@typing_extensions.final class StringValue(google.protobuf.message.Message): """Wrapper message for `string`. @@ -183,6 +191,7 @@ class StringValue(google.protobuf.message.Message): global___StringValue = StringValue +@typing_extensions.final class BytesValue(google.protobuf.message.Message): """Wrapper message for `bytes`.