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


Python api_implementation.Version方法代码示例

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


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

示例1: __init__

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

    self.message_types_by_name = {}
    self.name = name
    self.package = package
    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):
      if api_implementation.Version() == 2:
        # pylint: disable=protected-access
        _message.Message._BuildFile(self.serialized_pb)
        # pylint: enable=protected-access
      else:
        cpp_message.BuildFile(self.serialized_pb) 
开发者ID:katharosada,项目名称:botchallenge,代码行数:24,代码来源:descriptor.py

示例2: testPickleRepeatedScalarContainer

# 需要导入模块: from google.protobuf.internal import api_implementation [as 别名]
# 或者: from google.protobuf.internal.api_implementation import Version [as 别名]
def testPickleRepeatedScalarContainer(self, message_module):
    # TODO(tibell): The pure-Python implementation support pickling of
    #   scalar containers in *some* cases. For now the cpp2 version
    #   throws an exception to avoid a segfault. Investigate if we
    #   want to support pickling of these fields.
    #
    # For more information see: https://b2.corp.google.com/u/0/issues/18677897
    if (api_implementation.Type() != 'cpp' or
        api_implementation.Version() == 2):
      return
    m = message_module.TestAllTypes()
    with self.assertRaises(pickle.PickleError) as _:
      pickle.dumps(m.repeated_int32, pickle.HIGHEST_PROTOCOL) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:15,代码来源:message_test.py

示例3: SkipCheckUnknownFieldIfCppImplementation

# 需要导入模块: from google.protobuf.internal import api_implementation [as 别名]
# 或者: from google.protobuf.internal.api_implementation import Version [as 别名]
def SkipCheckUnknownFieldIfCppImplementation(func):
  return unittest.skipIf(
      api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
      'Addtional test for pure python involved protect members')(func) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:6,代码来源:unknown_fields_test.py

示例4: SkipIfCppImplementation

# 需要导入模块: from google.protobuf.internal import api_implementation [as 别名]
# 或者: from google.protobuf.internal.api_implementation import Version [as 别名]
def SkipIfCppImplementation(func):
  return unittest.skipIf(
      api_implementation.Type() == 'cpp' and api_implementation.Version() == 2,
      'C++ implementation does not expose unknown fields to Python')(func) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:6,代码来源:unknown_fields_test.py

示例5: testThatCppApiV2IsTheDefault

# 需要导入模块: from google.protobuf.internal import api_implementation [as 别名]
# 或者: from google.protobuf.internal.api_implementation import Version [as 别名]
def testThatCppApiV2IsTheDefault(self):
      """If -DPYTHON_PROTO_*IMPL* was given at build time, this may fail."""
      self.assertEqual('cpp', api_implementation.Type())
      self.assertEqual(2, api_implementation.Version()) 
开发者ID:katharosada,项目名称:botchallenge,代码行数:6,代码来源:api_implementation_default_test.py


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