Beispiel #1
0
    def GetPrototype(self, descriptor):
        """Builds a proto2 message class based on the passed in descriptor.

    Passing a descriptor with a fully qualified name matching a previous
    invocation will cause the same class to be returned.

    Args:
      descriptor: The descriptor to build from.

    Returns:
      A class describing the passed in descriptor.
    """
        if descriptor.full_name not in self._classes:
            descriptor_name = descriptor.name
            if sys.version_info[0] < 3:  ##PY25
                ##!PY25      if str is bytes:  # PY2
                descriptor_name = descriptor.name.encode('ascii', 'ignore')
            result_class = reflection.GeneratedProtocolMessageType(
                descriptor_name, (message.Message, ), {
                    'DESCRIPTOR': descriptor,
                    '__module__': None
                })
            # If module not set, it wrongly points to the reflection.py module.
            self._classes[descriptor.full_name] = result_class
            for field in descriptor.fields:
                if field.message_type:
                    self.GetPrototype(field.message_type)
            for extension in result_class.DESCRIPTOR.extensions:
                if extension.containing_type.full_name not in self._classes:
                    self.GetPrototype(extension.containing_type)
                extended_class = self._classes[
                    extension.containing_type.full_name]
                extended_class.RegisterExtension(extension)
        return self._classes[descriptor.full_name]
Beispiel #2
0
_VERIFIERS_SIGNCLAVERIFIER.containing_type = _VERIFIERS
_VERIFIERS.fields_by_name[
    'reviewer_lgtm'].message_type = _VERIFIERS_REVIEWERLGTMVERIFIER
_VERIFIERS.fields_by_name[
    'tree_status'].message_type = _VERIFIERS_TREESTATUSLGTMVERIFIER
_VERIFIERS.fields_by_name['try_job'].message_type = _VERIFIERS_TRYJOBVERIFIER
_VERIFIERS.fields_by_name['sign_cla'].message_type = _VERIFIERS_SIGNCLAVERIFIER
DESCRIPTOR.message_types_by_name['Config'] = _CONFIG
DESCRIPTOR.message_types_by_name['Rietveld'] = _RIETVELD
DESCRIPTOR.message_types_by_name['Gerrit'] = _GERRIT
DESCRIPTOR.message_types_by_name['Verifiers'] = _VERIFIERS

Config = _reflection.GeneratedProtocolMessageType(
    'Config',
    (_message.Message, ),
    dict(DESCRIPTOR=_CONFIG,
         __module__='cq_pb2'
         # @@protoc_insertion_point(class_scope:Config)
         ))
_sym_db.RegisterMessage(Config)

Rietveld = _reflection.GeneratedProtocolMessageType(
    'Rietveld',
    (_message.Message, ),
    dict(DESCRIPTOR=_RIETVELD,
         __module__='cq_pb2'
         # @@protoc_insertion_point(class_scope:Rietveld)
         ))
_sym_db.RegisterMessage(Rietveld)

Gerrit = _reflection.GeneratedProtocolMessageType(
Beispiel #3
0
  extension_ranges=[],
  oneofs=[
  ],
  serialized_start=229,
  serialized_end=399,
)

_CODEGENERATORREQUEST.fields_by_name['proto_file'].message_type = google.protobuf.descriptor_pb2._FILEDESCRIPTORPROTO
_CODEGENERATORRESPONSE_FILE.containing_type = _CODEGENERATORRESPONSE
_CODEGENERATORRESPONSE.fields_by_name['file'].message_type = _CODEGENERATORRESPONSE_FILE
DESCRIPTOR.message_types_by_name['CodeGeneratorRequest'] = _CODEGENERATORREQUEST
DESCRIPTOR.message_types_by_name['CodeGeneratorResponse'] = _CODEGENERATORRESPONSE

CodeGeneratorRequest = _reflection.GeneratedProtocolMessageType('CodeGeneratorRequest', (_message.Message,), dict(
  DESCRIPTOR = _CODEGENERATORREQUEST,
  __module__ = 'google.protobuf.compiler.plugin_pb2'
  # @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest)
  ))
_sym_db.RegisterMessage(CodeGeneratorRequest)

CodeGeneratorResponse = _reflection.GeneratedProtocolMessageType('CodeGeneratorResponse', (_message.Message,), dict(

  File = _reflection.GeneratedProtocolMessageType('File', (_message.Message,), dict(
    DESCRIPTOR = _CODEGENERATORRESPONSE_FILE,
    __module__ = 'google.protobuf.compiler.plugin_pb2'
    # @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File)
    ))
  ,
  DESCRIPTOR = _CODEGENERATORRESPONSE,
  __module__ = 'google.protobuf.compiler.plugin_pb2'
  # @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)