def normalize_file(filename, *args):
""" Import-normalize a file.
If the file is not parseable, an empty filelike object will be returned.
"""
try:
ast = compiler.parseFile(filename)
except Exception, e:
return StringIO('')
ip = ImportPuller()
walk(ast, ip)
return StringIO(ip.as_string())
评论列表
文章目录