MCPcopy Index your code
hub / github.com/RustPython/RustPython / print_node

Function print_node

scripts/crawl_sourcecode.py:29–43  ·  view source on GitHub ↗
(node, indent=0)

Source from the content-addressed store, hash-verified

27
28
29def print_node(node, indent=0):
30 indents = " " * indent
31 if isinstance(node, ast.AST):
32 lineno = "row={}".format(node.lineno) if hasattr(node, "lineno") else ""
33 print(indents, "NODE", node.__class__.__name__, lineno)
34 for field in node._fields:
35 print(indents, "-", field)
36 f = getattr(node, field)
37 if isinstance(f, list):
38 for f2 in f:
39 print_node(f2, indent=indent + shift)
40 else:
41 print_node(f, indent=indent + shift)
42 else:
43 print(indents, "OBJ", node)
44
45
46print_node(t)

Callers 1

Calls 5

isinstanceFunction · 0.85
hasattrFunction · 0.85
getattrFunction · 0.85
printFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected