def MakeDescriptor(desc_proto, package=''):
 full_message_name = [desc_proto.name]
 if package:
  full_message_name.insert(0, package)
 fields = []
 for field_proto in desc_proto.field:
  full_name = '.'.join((full_message_name + [field_proto.name]))
  field = FieldDescriptor(field_proto.name, full_name, (field_proto.number - 1), field_proto.number, field_proto.type, FieldDescriptor.ProtoTypeToCppProtoType(field_proto.type), field_proto.label, None, None, None, None, False, None, has_default_value=False)
  fields.append(field)
 desc_name = '.'.join(full_message_name)
 return Descriptor(desc_proto.name, desc_name, None, None, fields, [], [], [])

def MakeDescriptor ( desc_proto , package = '' ) : full_message_name = [ desc_proto . name ] if package : full_message_name . insert ( 0 , package ) fields = [ ] for field_proto in desc_proto . field : full_name = '.' . join ( ( full_message_name + [ field_proto . name ] ) ) field = FieldDescriptor ( field_proto . name , full_name , ( field_proto . number - 1 ) , field_proto . number , field_proto . type , FieldDescriptor . ProtoTypeToCppProtoType ( field_proto . type ) , field_proto . label , None , None , None , None , False , None , has_default_value = False ) fields . append ( field ) desc_name = '.' . join ( full_message_name ) return Descriptor ( desc_proto . name , desc_name , None , None , fields , [ ] , [ ] , [ ] )
make a protobuf descriptor given a descriptorproto protobuf .