You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
--tree++ shows template rule when it is used
This commit is contained in:
@@ -32,7 +32,7 @@ def maybe_show_asm(showasm, tokens):
|
||||
stream.write('\n')
|
||||
|
||||
|
||||
def maybe_show_tree(show_tree, ast):
|
||||
def maybe_show_tree(walker, ast):
|
||||
"""
|
||||
Show the ast based on the showast flag (or file object), writing to the
|
||||
appropriate stream depending on the type of the flag.
|
||||
@@ -42,9 +42,15 @@ def maybe_show_tree(show_tree, ast):
|
||||
like object, into which the ast will be written).
|
||||
:param ast: The ast to show.
|
||||
"""
|
||||
if show_tree:
|
||||
stream = show_tree if hasattr(show_tree, 'write') else sys.stdout
|
||||
stream.write(str(ast))
|
||||
if walker.showast:
|
||||
if hasattr(walker.showast, 'write'):
|
||||
stream = walker.showast
|
||||
else:
|
||||
stream = sys.stdout
|
||||
if walker.showast == 'Full':
|
||||
walker.str_with_template(ast)
|
||||
else:
|
||||
stream.write(str(ast))
|
||||
stream.write('\n')
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user