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

Function print_symbols

Lib/symtable.py:421–436  ·  view source on GitHub ↗
(table, level=0)

Source from the content-addressed store, hash-verified

419def main(args):
420 import sys
421 def print_symbols(table, level=0):
422 indent = ' ' * level
423 nested = "nested " if table.is_nested() else ""
424 if table.get_type() == 'module':
425 what = f'from file {table._filename!r}'
426 else:
427 what = f'{table.get_name()!r}'
428 print(f'{indent}symbol table for {nested}{table.get_type()} {what}:')
429 for ident in table.get_identifiers():
430 symbol = table.lookup(ident)
431 flags = ', '.join(symbol._flags_str()).lower()
432 print(f' {indent}{symbol._scope_str().lower()} symbol {symbol.get_name()!r}: {flags}')
433 print()
434
435 for table2 in table.get_children():
436 print_symbols(table2, level + 1)
437
438 for filename in args or ['-']:
439 if filename == '-':

Callers 1

mainFunction · 0.85

Calls 11

get_typeMethod · 0.80
_flags_strMethod · 0.80
_scope_strMethod · 0.80
printFunction · 0.50
is_nestedMethod · 0.45
get_nameMethod · 0.45
get_identifiersMethod · 0.45
lookupMethod · 0.45
lowerMethod · 0.45
joinMethod · 0.45
get_childrenMethod · 0.45

Tested by

no test coverage detected