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

Function print_table

scripts/crawl_sourcecode.py:59–77  ·  view source on GitHub ↗
(table, indent=0)

Source from the content-addressed store, hash-verified

57
58
59def print_table(table, indent=0):
60 indents = " " * indent
61 print(indents, "table:", table.get_name())
62 print(indents, " ", "name:", table.get_name())
63 print(indents, " ", "type:", table.get_type())
64 print(indents, " ", "line:", table.get_lineno())
65 print(indents, " ", "identifiers:", table.get_identifiers())
66 print(indents, " ", "Syms:")
67 for sym in table.get_symbols():
68 flags = []
69 for flag_name in flag_names:
70 func = getattr(sym, flag_name)
71 if func():
72 flags.append(flag_name)
73 print(indents, " sym:", sym.get_name(), "flags:", " ".join(flags))
74 if table.has_children():
75 print(indents, " ", "Child tables:")
76 for child in table.get_children():
77 print_table(child, indent=indent + shift)
78
79
80table = symtable.symtable(source, "a", "exec")

Callers 1

Calls 12

getattrFunction · 0.85
get_typeMethod · 0.80
get_symbolsMethod · 0.80
has_childrenMethod · 0.80
printFunction · 0.50
funcFunction · 0.50
get_nameMethod · 0.45
get_linenoMethod · 0.45
get_identifiersMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
get_childrenMethod · 0.45

Tested by

no test coverage detected