當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。