def get_ast_imports(ast):
"""
Given an AST, return a list of module tuples for the imports found, in the
form:
(modname, remote-name, local-name, lineno, pragma)
"""
assert ast is not None
vis = ImportVisitor()
compiler.walk(ast, vis, ImportWalker(vis))
found_imports = vis.finalize()
return found_imports
# **WARNING** This is where all the evil lies. Risk and peril. Watch out.
评论列表
文章目录