From 0f2b66906a7e64ee45125487917ee38bae41a9b5 Mon Sep 17 00:00:00 2001 From: Anoop Joseph Babu Date: Wed, 8 Jun 2022 22:02:32 +0530 Subject: [PATCH] Fix protobuf 4 compatibility issue --- bernhard/__init__.py | 4 +- bernhard/proto4_pb2.py | 87 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 bernhard/proto4_pb2.py diff --git a/bernhard/__init__.py b/bernhard/__init__.py index 0a8d3e6..abd8e44 100644 --- a/bernhard/__init__.py +++ b/bernhard/__init__.py @@ -14,7 +14,9 @@ except pkg_resources.DistributionNotFound: PROTOBUF_VERSION = 'unknown' -if PROTOBUF_VERSION.startswith('3'): +if PROTOBUF_VERSION.startswith('4'): + from . import proto4_pb2 as pb +elif PROTOBUF_VERSION.startswith('3'): from . import proto_pb2 as pb else: from . import pb diff --git a/bernhard/proto4_pb2.py b/bernhard/proto4_pb2.py new file mode 100644 index 0000000..9544d5f --- /dev/null +++ b/bernhard/proto4_pb2.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\x0bproto.proto\"\x81\x01\n\x05State\x12\x0c\n\x04time\x18\x01 \x01(\x03\x12\r\n\x05state\x18\x02 \x01(\t\x12\x0f\n\x07service\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x0c\n\x04once\x18\x06 \x01(\x08\x12\x0c\n\x04tags\x18\x07 \x03(\t\x12\x0b\n\x03ttl\x18\x08 \x01(\x02\"\xce\x01\n\x05\x45vent\x12\x0c\n\x04time\x18\x01 \x01(\x03\x12\r\n\x05state\x18\x02 \x01(\t\x12\x0f\n\x07service\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x0c\n\x04tags\x18\x07 \x03(\t\x12\x0b\n\x03ttl\x18\x08 \x01(\x02\x12\x1e\n\nattributes\x18\t \x03(\x0b\x32\n.Attribute\x12\x15\n\rmetric_sint64\x18\r \x01(\x12\x12\x10\n\x08metric_d\x18\x0e \x01(\x01\x12\x10\n\x08metric_f\x18\x0f \x01(\x02\"\x17\n\x05Query\x12\x0e\n\x06string\x18\x01 \x01(\t\"g\n\x03Msg\x12\n\n\x02ok\x18\x02 \x01(\x08\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12\x16\n\x06states\x18\x04 \x03(\x0b\x32\x06.State\x12\x15\n\x05query\x18\x05 \x01(\x0b\x32\x06.Query\x12\x16\n\x06\x65vents\x18\x06 \x03(\x0b\x32\x06.Event\"\'\n\tAttribute\x12\x0b\n\x03key\x18\x01 \x02(\t\x12\r\n\x05value\x18\x02 \x01(\tB\x1a\n\x11\x63om.aphyr.riemannB\x05Proto' +) + +_STATE = DESCRIPTOR.message_types_by_name['State'] +_EVENT = DESCRIPTOR.message_types_by_name['Event'] +_QUERY = DESCRIPTOR.message_types_by_name['Query'] +_MSG = DESCRIPTOR.message_types_by_name['Msg'] +_ATTRIBUTE = DESCRIPTOR.message_types_by_name['Attribute'] +State = _reflection.GeneratedProtocolMessageType( + 'State', + (_message.Message, ), + { + 'DESCRIPTOR': _STATE, + '__module__': 'proto_pb2' + # @@protoc_insertion_point(class_scope:State) + }) +_sym_db.RegisterMessage(State) + +Event = _reflection.GeneratedProtocolMessageType( + 'Event', + (_message.Message, ), + { + 'DESCRIPTOR': _EVENT, + '__module__': 'proto_pb2' + # @@protoc_insertion_point(class_scope:Event) + }) +_sym_db.RegisterMessage(Event) + +Query = _reflection.GeneratedProtocolMessageType( + 'Query', + (_message.Message, ), + { + 'DESCRIPTOR': _QUERY, + '__module__': 'proto_pb2' + # @@protoc_insertion_point(class_scope:Query) + }) +_sym_db.RegisterMessage(Query) + +Msg = _reflection.GeneratedProtocolMessageType( + 'Msg', + (_message.Message, ), + { + 'DESCRIPTOR': _MSG, + '__module__': 'proto_pb2' + # @@protoc_insertion_point(class_scope:Msg) + }) +_sym_db.RegisterMessage(Msg) + +Attribute = _reflection.GeneratedProtocolMessageType( + 'Attribute', + (_message.Message, ), + { + 'DESCRIPTOR': _ATTRIBUTE, + '__module__': 'proto_pb2' + # @@protoc_insertion_point(class_scope:Attribute) + }) +_sym_db.RegisterMessage(Attribute) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\021com.aphyr.riemannB\005Proto' + _STATE._serialized_start = 16 + _STATE._serialized_end = 145 + _EVENT._serialized_start = 148 + _EVENT._serialized_end = 354 + _QUERY._serialized_start = 356 + _QUERY._serialized_end = 379 + _MSG._serialized_start = 381 + _MSG._serialized_end = 484 + _ATTRIBUTE._serialized_start = 486 + _ATTRIBUTE._serialized_end = 525 +# @@protoc_insertion_point(module_scope)