def _bytecode(self, filename): filename = os.path.abspath(self.root + filename) # bytecode cache based on the filename try: return self.cached_files[filename] except KeyError: data = self._read_file(filename) if data is None: return None ast = source_to_ast(data) bc = compile_ast(ast, ast.scope, unicode(filename)) self.cached_files[filename] = bc return bc
def ast(source): ast = source_to_ast(source) return ast