当前位置: 首页>>代码示例>>Python>>正文


Python _message.FileDescriptor方法代码示例

本文整理汇总了Python中google.protobuf.pyext._message.FileDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Python _message.FileDescriptor方法的具体用法?Python _message.FileDescriptor怎么用?Python _message.FileDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在google.protobuf.pyext._message的用法示例。


在下文中一共展示了_message.FileDescriptor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __init__(self, name, package, options=None, serialized_pb=None,
               dependencies=None, public_dependencies=None,
               syntax=None, pool=None):
    """Constructor."""
    super(FileDescriptor, self).__init__(options, 'FileOptions')

    if pool is None:
      from google.protobuf import descriptor_pool
      pool = descriptor_pool.Default()
    self.pool = pool
    self.message_types_by_name = {}
    self.name = name
    self.package = package
    self.syntax = syntax or "proto2"
    self.serialized_pb = serialized_pb

    self.enum_types_by_name = {}
    self.extensions_by_name = {}
    self.services_by_name = {}
    self.dependencies = (dependencies or [])
    self.public_dependencies = (public_dependencies or [])

    if (api_implementation.Type() == 'cpp' and
        self.serialized_pb is not None):
      _message.default_pool.AddSerializedFile(self.serialized_pb) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:27,代码来源:descriptor.py

示例2: __init__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __init__(self, name, package, options=None, serialized_pb=None,
               dependencies=None, syntax=None):
    """Constructor."""
    super(FileDescriptor, self).__init__(options, 'FileOptions')

    self.message_types_by_name = {}
    self.name = name
    self.package = package
    self.syntax = syntax or "proto2"
    self.serialized_pb = serialized_pb

    self.enum_types_by_name = {}
    self.extensions_by_name = {}
    self.dependencies = (dependencies or [])

    if (api_implementation.Type() == 'cpp' and
        self.serialized_pb is not None):
      _message.default_pool.AddSerializedFile(self.serialized_pb) 
开发者ID:sklearn-theano,项目名称:sklearn-theano,代码行数:20,代码来源:descriptor.py

示例3: __new__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __new__(cls, name, package, options=None,
                serialized_options=None, serialized_pb=None,
                dependencies=None, public_dependencies=None,
                syntax=None, pool=None, create_key=None):
      # FileDescriptor() is called from various places, not only from generated
      # files, to register dynamic proto files and messages.
      # pylint: disable=g-explicit-bool-comparison
      if serialized_pb == b'':
        # Cpp generated code must be linked in if serialized_pb is ''
        try:
          return _message.default_pool.FindFileByName(name)
        except KeyError:
          raise RuntimeError('Please link in cpp generated lib for %s' % (name))
      elif serialized_pb:
        return _message.default_pool.AddSerializedFile(serialized_pb)
      else:
        return super(FileDescriptor, cls).__new__(cls) 
开发者ID:luci,项目名称:luci-py,代码行数:19,代码来源:descriptor.py

示例4: __init__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __init__(self, options, options_class_name, name, full_name,
               file, containing_type, serialized_start=None,
               serialized_end=None, serialized_options=None):
    """Constructor.

    Args:
      options: Protocol message options or None
        to use default message options.
      options_class_name: (str) The class name of the above options.

      name: (str) Name of this protocol message type.
      full_name: (str) Fully-qualified name of this protocol message type,
        which will include protocol "package" name and the name of any
        enclosing types.
      file: (FileDescriptor) Reference to file info.
      containing_type: if provided, this is a nested descriptor, with this
        descriptor as parent, otherwise None.
      serialized_start: The start index (inclusive) in block in the
        file.serialized_pb that describes this descriptor.
      serialized_end: The end index (exclusive) in block in the
        file.serialized_pb that describes this descriptor.
      serialized_options: Protocol message serilized options or None.
    """
    super(_NestedDescriptorBase, self).__init__(
        options, serialized_options, options_class_name)

    self.name = name
    # TODO(falk): Add function to calculate full_name instead of having it in
    #             memory?
    self.full_name = full_name
    self.file = file
    self.containing_type = containing_type

    self._serialized_start = serialized_start
    self._serialized_end = serialized_end 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:37,代码来源:descriptor.py

示例5: __new__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __new__(cls, name, package, options=None,
                serialized_options=None, serialized_pb=None,
                dependencies=None, public_dependencies=None,
                syntax=None, pool=None):
      # FileDescriptor() is called from various places, not only from generated
      # files, to register dynamic proto files and messages.
      if serialized_pb:
        # TODO(amauryfa): use the pool passed as argument. This will work only
        # for C++-implemented DescriptorPools.
        return _message.default_pool.AddSerializedFile(serialized_pb)
      else:
        return super(FileDescriptor, cls).__new__(cls) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:14,代码来源:descriptor.py

示例6: __new__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __new__(cls, name, package, options=None, serialized_pb=None,
                dependencies=None, public_dependencies=None,
                syntax=None, pool=None):
      # FileDescriptor() is called from various places, not only from generated
      # files, to register dynamic proto files and messages.
      if serialized_pb:
        # TODO(amauryfa): use the pool passed as argument. This will work only
        # for C++-implemented DescriptorPools.
        return _message.default_pool.AddSerializedFile(serialized_pb)
      else:
        return super(FileDescriptor, cls).__new__(cls) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:13,代码来源:descriptor.py

示例7: __new__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __new__(cls, name, package, options=None, serialized_pb=None,
                dependencies=None, syntax=None):
      # FileDescriptor() is called from various places, not only from generated
      # files, to register dynamic proto files and messages.
      if serialized_pb:
        return _message.default_pool.AddSerializedFile(serialized_pb)
      else:
        return super(FileDescriptor, cls).__new__(cls) 
开发者ID:sklearn-theano,项目名称:sklearn-theano,代码行数:10,代码来源:descriptor.py

示例8: __init__

# 需要导入模块: from google.protobuf.pyext import _message [as 别名]
# 或者: from google.protobuf.pyext._message import FileDescriptor [as 别名]
def __init__(self, options, options_class_name, name, full_name,
               file, containing_type, serialized_start=None,
               serialized_end=None, serialized_options=None):
    """Constructor.

    Args:
      options: Protocol message options or None
        to use default message options.
      options_class_name (str): The class name of the above options.
      name (str): Name of this protocol message type.
      full_name (str): Fully-qualified name of this protocol message type,
        which will include protocol "package" name and the name of any
        enclosing types.
      file (FileDescriptor): Reference to file info.
      containing_type: if provided, this is a nested descriptor, with this
        descriptor as parent, otherwise None.
      serialized_start: The start index (inclusive) in block in the
        file.serialized_pb that describes this descriptor.
      serialized_end: The end index (exclusive) in block in the
        file.serialized_pb that describes this descriptor.
      serialized_options: Protocol message serialized options or None.
    """
    super(_NestedDescriptorBase, self).__init__(
        options, serialized_options, options_class_name)

    self.name = name
    # TODO(falk): Add function to calculate full_name instead of having it in
    #             memory?
    self.full_name = full_name
    self.file = file
    self.containing_type = containing_type

    self._serialized_start = serialized_start
    self._serialized_end = serialized_end 
开发者ID:luci,项目名称:luci-py,代码行数:36,代码来源:descriptor.py


注:本文中的google.protobuf.pyext._message.FileDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。