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


Python __future__._Feature方法代码示例

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


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

示例1: testAllExported

# 需要导入模块: import __future__ [as 别名]
# 或者: from __future__ import _Feature [as 别名]
def testAllExported(self):
    """Test that all public attributes not imported are in __all__."""
    missing_attributes = []
    for attribute in dir(self.MODULE):
      if not attribute.startswith('_'):
        if attribute not in self.MODULE.__all__:
          attribute_value = getattr(self.MODULE, attribute)
          if isinstance(attribute_value, types.ModuleType):
            continue
          # pylint: disable=protected-access
          if isinstance(attribute_value, __future__._Feature):
            continue
          missing_attributes.append(attribute)
    if missing_attributes:
      self.fail('%s are not modules and not defined in __all__.' %
                missing_attributes) 
开发者ID:cloudendpoints,项目名称:endpoints-python,代码行数:18,代码来源:test_util.py

示例2: test_names

# 需要导入模块: import __future__ [as 别名]
# 或者: from __future__ import _Feature [as 别名]
def test_names(self):
        # Verify that all_feature_names appears correct.
        given_feature_names = features[:]
        for name in dir(__future__):
            obj = getattr(__future__, name, None)
            if obj is not None and isinstance(obj, __future__._Feature):
                self.assertTrue(
                    name in given_feature_names,
                    "%r should have been in all_feature_names" % name
                )
                given_feature_names.remove(name)
        self.assertEqual(len(given_feature_names), 0,
               "all_feature_names has too much: %r" % given_feature_names) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:test___future__.py

示例3: get_compiler_flags

# 需要导入模块: import __future__ [as 别名]
# 或者: from __future__ import _Feature [as 别名]
def get_compiler_flags(self) -> int:
        """
        Give the current compiler flags by looking for _Feature instances
        in the globals.
        """
        flags = 0

        for value in self.get_globals().values():
            if isinstance(value, __future__._Feature):
                flags |= value.compiler_flag

        return flags 
开发者ID:prompt-toolkit,项目名称:ptpython,代码行数:14,代码来源:python_input.py


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