Ejemplo n.º 1
0
    def MakeFieldDescriptor(self,
                            field_proto,
                            message_name,
                            index,
                            is_extension=False):
        """Creates a field descriptor from a FieldDescriptorProto.

    For message and enum type fields, this method will do a look up
    in the pool for the appropriate descriptor for that type. If it
    is unavailable, it will fall back to the _source function to
    create it. If this type is still unavailable, construction will
    fail.

    Args:
      field_proto: The proto describing the field.
      message_name: The name of the containing message.
      index: Index of the field
      is_extension: Indication that this field is for an extension.

    Returns:
      An initialized FieldDescriptor object
    """

        if message_name:
            full_name = '.'.join((message_name, field_proto.name))
        else:
            full_name = field_proto.name

        return descriptor.FieldDescriptor(name=field_proto.name,
                                          full_name=full_name,
                                          index=index,
                                          number=field_proto.number,
                                          type=field_proto.type,
                                          cpp_type=None,
                                          message_type=None,
                                          enum_type=None,
                                          containing_type=None,
                                          label=field_proto.label,
                                          has_default_value=False,
                                          default_value=None,
                                          is_extension=is_extension,
                                          extension_scope=None,
                                          options=field_proto.options)
Ejemplo n.º 2
0
_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,
                                    type=5,
                                    cpp_type=1,
                                    label=1,
                                    has_default_value=False,
                                    default_value=0,
                                    message_type=None,
                                    enum_type=None,
                                    containing_type=None,
                                    is_extension=False,
                                    extension_scope=None,
                                    options=None),
        _descriptor.FieldDescriptor(name='cq_name',
                                    full_name='Config.cq_name',
                                    index=1,
                                    number=2,
                                    type=9,
                                    cpp_type=9,
                                    label=1,
                                    has_default_value=False,
Ejemplo n.º 3
0
_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(
      name='file_to_generate', full_name='google.protobuf.compiler.CodeGeneratorRequest.file_to_generate', index=0,
      number=1, type=9, cpp_type=9, label=3,
      has_default_value=False, default_value=[],
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    _descriptor.FieldDescriptor(
      name='parameter', full_name='google.protobuf.compiler.CodeGeneratorRequest.parameter', index=1,
      number=2, type=9, cpp_type=9, label=1,
      has_default_value=False, default_value=_b("").decode('utf-8'),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    _descriptor.FieldDescriptor(
      name='proto_file', full_name='google.protobuf.compiler.CodeGeneratorRequest.proto_file', index=2,
      number=15, type=11, cpp_type=10, label=3,
      has_default_value=False, default_value=[],
      message_type=None, enum_type=None, containing_type=None,