Example #1
0
    def _ConvertFileProtoToFileDescriptor(self, file_proto):
        """Creates a FileDescriptor from a proto or returns a cached copy.

    This method also has the side effect of loading all the symbols found in
    the file into the appropriate dictionaries in the pool.

    Args:
      file_proto: The proto to convert.

    Returns:
      A FileDescriptor matching the passed in proto.
    """

        if file_proto.name not in self._file_descriptors:
            built_deps = list(self._GetDeps(file_proto.dependency))
            direct_deps = [
                self.FindFileByName(n) for n in file_proto.dependency
            ]

            file_descriptor = descriptor.FileDescriptor(
                name=file_proto.name,
                package=file_proto.package,
                options=file_proto.options,
                serialized_pb=file_proto.SerializeToString(),
                dependencies=direct_deps)
            scope = {}

            # This loop extracts all the message and enum types from all the
            # dependencoes of the file_proto. This is necessary to create the
            # scope of available message types when defining the passed in
            # file proto.
            for dependency in built_deps:
                scope.update(
                    self._ExtractSymbols(
                        dependency.message_types_by_name.values()))
                scope.update(
                    (_PrefixWithDot(enum.full_name), enum)
                    for enum in dependency.enum_types_by_name.values())

            for message_type in file_proto.message_type:
                message_desc = self._ConvertMessageDescriptor(
                    message_type, file_proto.package, file_descriptor, scope)
                file_descriptor.message_types_by_name[
                    message_desc.name] = message_desc

            for enum_type in file_proto.enum_type:
                file_descriptor.enum_types_by_name[enum_type.name] = (
                    self._ConvertEnumDescriptor(enum_type, file_proto.package,
                                                file_descriptor, None, scope))

            for index, extension_proto in enumerate(file_proto.extension):
                extension_desc = self.MakeFieldDescriptor(extension_proto,
                                                          file_proto.package,
                                                          index,
                                                          is_extension=True)
                extension_desc.containing_type = self._GetTypeFromScope(
                    file_descriptor.package, extension_proto.extendee, scope)
                self.SetFieldType(extension_proto, extension_desc,
                                  file_descriptor.package, scope)
                file_descriptor.extensions_by_name[
                    extension_desc.name] = extension_desc

            for desc_proto in file_proto.message_type:
                self.SetAllFieldTypes(file_proto.package, desc_proto, scope)

            if file_proto.package:
                desc_proto_prefix = _PrefixWithDot(file_proto.package)
            else:
                desc_proto_prefix = ''

            for desc_proto in file_proto.message_type:
                desc = self._GetTypeFromScope(desc_proto_prefix,
                                              desc_proto.name, scope)
                file_descriptor.message_types_by_name[desc_proto.name] = desc
            self.Add(file_proto)
            self._file_descriptors[file_proto.name] = file_descriptor

        return self._file_descriptors[file_proto.name]
Example #2
0
from protobuf26 import descriptor as _descriptor
from protobuf26 import message as _message
from protobuf26 import reflection as _reflection
from protobuf26 import symbol_database as _symbol_database
from protobuf26 import descriptor_pb2
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()


import protobuf26.descriptor_pb2


DESCRIPTOR = _descriptor.FileDescriptor(
  name='google/protobuf/compiler/plugin.proto',
  package='google.protobuf.compiler',
  serialized_pb=_b('\n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\x1a google/protobuf/descriptor.proto\"}\n\x14\x43odeGeneratorRequest\x12\x18\n\x10\x66ile_to_generate\x18\x01 \x03(\t\x12\x11\n\tparameter\x18\x02 \x01(\t\x12\x38\n\nproto_file\x18\x0f \x03(\x0b\x32$.google.protobuf.FileDescriptorProto\"\xaa\x01\n\x15\x43odeGeneratorResponse\x12\r\n\x05\x65rror\x18\x01 \x01(\t\x12\x42\n\x04\x66ile\x18\x0f \x03(\x0b\x32\x34.google.protobuf.compiler.CodeGeneratorResponse.File\x1a>\n\x04\x46ile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\x0finsertion_point\x18\x02 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x0f \x01(\tB,\n\x1c\x63om.google.protobuf.compilerB\x0cPluginProtos')
  ,
  dependencies=[google.protobuf.descriptor_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)




_CODEGENERATORREQUEST = _descriptor.Descriptor(
  name='CodeGeneratorRequest',
  full_name='google.protobuf.compiler.CodeGeneratorRequest',
  filename=None,
  file=DESCRIPTOR,
  containing_type=None,
  fields=[
    _descriptor.FieldDescriptor(
Example #3
0
import sys

_b = sys.version_info[0] < 3 and (lambda x: x) or (
    lambda x: x.encode('latin1'))
from protobuf26 import descriptor as _descriptor
from protobuf26 import message as _message
from protobuf26 import reflection as _reflection
from protobuf26 import symbol_database as _symbol_database
from protobuf26 import descriptor_pb2
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()

DESCRIPTOR = _descriptor.FileDescriptor(
    name='cq.proto',
    package='',
    serialized_pb=_b(
        '\n\x08\x63q.proto\"\xc6\x02\n\x06\x43onfig\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x0f\n\x07\x63q_name\x18\x02 \x01(\t\x12\x1d\n\tverifiers\x18\x03 \x01(\x0b\x32\n.Verifiers\x12\x15\n\rcq_status_url\x18\x04 \x01(\t\x12!\n\x19hide_ref_in_committed_msg\x18\x05 \x01(\x08\x12\x1a\n\x12\x63ommit_burst_delay\x18\x06 \x01(\x05\x12\x18\n\x10max_commit_burst\x18\x07 \x01(\x05\x12\x15\n\rin_production\x18\x08 \x01(\x08\x12\x1b\n\x08rietveld\x18\t \x01(\x0b\x32\t.Rietveld\x12\x17\n\x06gerrit\x18\x0f \x01(\x0b\x32\x07.Gerrit\x12\x14\n\x0cgit_repo_url\x18\n \x01(\t\x12\x12\n\ntarget_ref\x18\x0b \x01(\t\x12\x14\n\x0csvn_repo_url\x18\x0c \x01(\t\".\n\x08Rietveld\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rproject_bases\x18\x02 \x03(\t\"#\n\x06Gerrit\x12\x19\n\x11\x63q_verified_label\x18\x01 \x01(\t\"\xd6\x06\n\tVerifiers\x12\x36\n\rreviewer_lgtm\x18\x01 \x01(\x0b\x32\x1f.Verifiers.ReviewerLgtmVerifier\x12\x36\n\x0btree_status\x18\x02 \x01(\x0b\x32!.Verifiers.TreeStatusLgtmVerifier\x12*\n\x07try_job\x18\x03 \x01(\x0b\x32\x19.Verifiers.TryJobVerifier\x12,\n\x08sign_cla\x18\x04 \x01(\x0b\x32\x1a.Verifiers.SignCLAVerifier\x1aZ\n\x14ReviewerLgtmVerifier\x12\x16\n\x0e\x63ommitter_list\x18\x01 \x01(\t\x12\x15\n\rmax_wait_secs\x18\x02 \x01(\x05\x12\x13\n\x0bno_lgtm_msg\x18\x03 \x01(\t\x1a\x31\n\x16TreeStatusLgtmVerifier\x12\x17\n\x0ftree_status_url\x18\x01 \x01(\t\x1a\xdc\x03\n\x0eTryJobVerifier\x12\x31\n\x07\x62uckets\x18\x01 \x03(\x0b\x32 .Verifiers.TryJobVerifier.Bucket\x12I\n\x14try_job_retry_config\x18\x02 \x01(\x0b\x32+.Verifiers.TryJobVerifier.TryJobRetryConfig\x1aL\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0ctriggered_by\x18\x02 \x01(\t\x12\x1d\n\x15\x65xperiment_percentage\x18\x04 \x01(\x02\x1aK\n\x06\x42ucket\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x08\x62uilders\x18\x02 \x03(\x0b\x32!.Verifiers.TryJobVerifier.Builder\x1a\xb0\x01\n\x11TryJobRetryConfig\x12\x1b\n\x13try_job_retry_quota\x18\x01 \x01(\x05\x12\x1a\n\x12global_retry_quota\x18\x02 \x01(\x05\x12\x1c\n\x14\x66\x61ilure_retry_weight\x18\x03 \x01(\x05\x12&\n\x1etransient_failure_retry_weight\x18\x04 \x01(\x05\x12\x1c\n\x14timeout_retry_weight\x18\x05 \x01(\x05\x1a\x11\n\x0fSignCLAVerifier'
    ))
_sym_db.RegisterFileDescriptor(DESCRIPTOR)

_CONFIG = _descriptor.Descriptor(
    name='Config',
    full_name='Config',
    filename=None,
    file=DESCRIPTOR,
    containing_type=None,
    fields=[
        _descriptor.FieldDescriptor(name='version',
                                    full_name='Config.version',
                                    index=0,
                                    number=1,
Example #4
0
import sys

_b = sys.version_info[0] < 3 and (lambda x: x) or (
    lambda x: x.encode('latin1'))
from protobuf26 import descriptor as _descriptor
from protobuf26 import message as _message
from protobuf26 import reflection as _reflection
from protobuf26 import symbol_database as _symbol_database
from protobuf26 import descriptor_pb2
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()

DESCRIPTOR = _descriptor.FileDescriptor(
    name='cq.proto',
    package='',
    serialized_pb=_b(
        '\n\x08\x63q.proto\"\xef\x02\n\x06\x43onfig\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x0f\n\x07\x63q_name\x18\x02 \x01(\t\x12\x1d\n\tverifiers\x18\x03 \x01(\x0b\x32\n.Verifiers\x12\x15\n\rcq_status_url\x18\x04 \x01(\t\x12%\n\x19hide_ref_in_committed_msg\x18\x05 \x01(\x08\x42\x02\x18\x01\x12\x1a\n\x12\x63ommit_burst_delay\x18\x06 \x01(\x05\x12\x18\n\x10max_commit_burst\x18\x07 \x01(\x05\x12\x15\n\rin_production\x18\x08 \x01(\x08\x12\x1b\n\x08rietveld\x18\t \x01(\x0b\x32\t.Rietveld\x12\x17\n\x06gerrit\x18\x0f \x01(\x0b\x32\x07.Gerrit\x12\x14\n\x0cgit_repo_url\x18\n \x01(\t\x12\x16\n\ntarget_ref\x18\x0b \x01(\tB\x02\x18\x01\x12\x18\n\x0csvn_repo_url\x18\x0c \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x64raining_start_time\x18\r \x01(\t\".\n\x08Rietveld\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rproject_bases\x18\x02 \x03(\t\"K\n\x06Gerrit\x12\x19\n\x11\x63q_verified_label\x18\x01 \x01(\t\x12&\n\x1e\x64ry_run_sets_cq_verified_label\x18\x02 \x01(\x08\"\xd5\t\n\tVerifiers\x12\x36\n\rreviewer_lgtm\x18\x01 \x01(\x0b\x32\x1f.Verifiers.ReviewerLgtmVerifier\x12=\n\x11gerrit_cq_ability\x18\x05 \x01(\x0b\x32\".Verifiers.GerritCQAbilityVerifier\x12\x36\n\x0btree_status\x18\x02 \x01(\x0b\x32!.Verifiers.TreeStatusLgtmVerifier\x12*\n\x07try_job\x18\x03 \x01(\x0b\x32\x19.Verifiers.TryJobVerifier\x12,\n\x08sign_cla\x18\x04 \x01(\x0b\x32\x1a.Verifiers.SignCLAVerifier\x1aw\n\x14ReviewerLgtmVerifier\x12\x16\n\x0e\x63ommitter_list\x18\x01 \x01(\t\x12\x15\n\rmax_wait_secs\x18\x02 \x01(\x05\x12\x13\n\x0bno_lgtm_msg\x18\x03 \x01(\t\x12\x1b\n\x13\x64ry_run_access_list\x18\x04 \x01(\t\x1as\n\x17GerritCQAbilityVerifier\x12\x16\n\x0e\x63ommitter_list\x18\x01 \x01(\t\x12\x1b\n\x13\x64ry_run_access_list\x18\x04 \x01(\t\x12#\n\x1b\x61llow_submit_with_open_deps\x18\x05 \x01(\x08\x1a\x31\n\x16TreeStatusLgtmVerifier\x12\x17\n\x0ftree_status_url\x18\x01 \x01(\t\x1a\x8a\x05\n\x0eTryJobVerifier\x12\x31\n\x07\x62uckets\x18\x01 \x03(\x0b\x32 .Verifiers.TryJobVerifier.Bucket\x12I\n\x14try_job_retry_config\x18\x02 \x01(\x0b\x32+.Verifiers.TryJobVerifier.TryJobRetryConfig\x1ag\n\x11\x45quivalentBuilder\x12\x0e\n\x06\x62ucket\x18\x01 \x01(\t\x12\x0f\n\x07\x62uilder\x18\x02 \x01(\t\x12\x12\n\npercentage\x18\x03 \x01(\x05\x12\x1d\n\x15owner_whitelist_group\x18\x04 \x01(\t\x1a\x90\x01\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0ctriggered_by\x18\x02 \x01(\t\x12\x1d\n\x15\x65xperiment_percentage\x18\x04 \x01(\x02\x12\x42\n\requivalent_to\x18\x05 \x01(\x0b\x32+.Verifiers.TryJobVerifier.EquivalentBuilder\x1aK\n\x06\x42ucket\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x08\x62uilders\x18\x02 \x03(\x0b\x32!.Verifiers.TryJobVerifier.Builder\x1a\xb0\x01\n\x11TryJobRetryConfig\x12\x1b\n\x13try_job_retry_quota\x18\x01 \x01(\x05\x12\x1a\n\x12global_retry_quota\x18\x02 \x01(\x05\x12\x1c\n\x14\x66\x61ilure_retry_weight\x18\x03 \x01(\x05\x12&\n\x1etransient_failure_retry_weight\x18\x04 \x01(\x05\x12\x1c\n\x14timeout_retry_weight\x18\x05 \x01(\x05\x1a\x11\n\x0fSignCLAVerifier'
    ))
_sym_db.RegisterFileDescriptor(DESCRIPTOR)

_CONFIG = _descriptor.Descriptor(
    name='Config',
    full_name='Config',
    filename=None,
    file=DESCRIPTOR,
    containing_type=None,
    fields=[
        _descriptor.FieldDescriptor(name='version',
                                    full_name='Config.version',
                                    index=0,
                                    number=1,