本文整理汇总了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)
示例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)
示例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