/usr/share/pyshared/sourcecodegen/generation.py is in python-sourcecodegen 0.6.14-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from visitor import ASTVisitor
class ModuleSourceCodeGenerator(object):
"""Generates Python source code from an AST tree (as parsed by the
``compiler.parse`` method)."""
def __init__(self, tree):
self.tree = tree
def getSourceCode(self):
visitor = ASTVisitor(self.tree)
return visitor()
def generate_code(tree):
return ModuleSourceCodeGenerator(tree).getSourceCode()
|