MCPcopy Create free account
hub / github.com/ActiveState/code / pprintAst

Function pprintAst

recipes/Python/533145_AST_Pretty_Printer/recipe-533145.py:11–13  ·  view source on GitHub ↗

Pretty-print an AST to the given output stream.

(ast, indent='  ', stream=sys.stdout)

Source from the content-addressed store, hash-verified

9
10
11def pprintAst(ast, indent=' ', stream=sys.stdout):
12 "Pretty-print an AST to the given output stream."
13 rec_node(ast, 0, indent, stream.write)
14
15def rec_node(node, level, indent, write):
16 "Recurse through a node, pretty-printing it."

Callers 1

testFunction · 0.85

Calls 1

rec_nodeFunction · 0.70

Tested by

no test coverage detected