verse.parser.astunparser.Unparser
- class verse.parser.astunparser.Unparser(tree, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
Bases:
object
Methods in this class recursively traverse an AST and output source code for the abstract syntax; original formatting is disregarded.
Methods
dispatch
(tree)Dispatcher function, dispatching tree type T to method _T.
enter
()Print ':', and increase the indentation.
fill
([text])Indent a piece of text, according to the current indentation level
leave
()Decrease the indentation level.
write
(text)Append a piece of text to the current line.
- __init__(tree, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
Unparser(tree, file=sys.stdout) -> None. Print the source for tree to file.
- dispatch(tree)
Dispatcher function, dispatching tree type T to method _T.
- enter()
Print ‘:’, and increase the indentation.
- fill(text='')
Indent a piece of text, according to the current indentation level
- leave()
Decrease the indentation level.
- write(text)
Append a piece of text to the current line.