本文整理汇总了Python中lib2to3.fixes.fix_.FixImports方法的典型用法代码示例。如果您正苦于以下问题:Python fix_.FixImports方法的具体用法?Python fix_.FixImports怎么用?Python fix_.FixImports使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib2to3.fixes.fix_
的用法示例。
在下文中一共展示了fix_.FixImports方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compile_pattern
# 需要导入模块: from lib2to3.fixes import fix_ [as 别名]
# 或者: from lib2to3.fixes.fix_ import FixImports [as 别名]
def compile_pattern(self):
# We override this, so MAPPING can be pragmatically altered and the
# changes will be reflected in PATTERN.
self.PATTERN = self.build_pattern()
super(FixImports, self).compile_pattern()
# Don't match the node if it's within another match.
示例2: match
# 需要导入模块: from lib2to3.fixes import fix_ [as 别名]
# 或者: from lib2to3.fixes.fix_ import FixImports [as 别名]
def match(self, node):
match = super(FixImports, self).match
results = match(node)
if results:
# Module usage could be in the trailer of an attribute lookup, so we
# might have nested matches when "bare_with_attr" is present.
if "bare_with_attr" not in results and \
any(match(obj) for obj in attr_chain(node, "parent")):
return False
return results
return False
示例3: start_tree
# 需要导入模块: from lib2to3.fixes import fix_ [as 别名]
# 或者: from lib2to3.fixes.fix_ import FixImports [as 别名]
def start_tree(self, tree, filename):
super(FixImports, self).start_tree(tree, filename)
self.replace = {}