MCPcopy
hub / github.com/rocky/python-uncompyle6 / maybe_show_tree_param_default

Function maybe_show_tree_param_default

uncompyle6/show.py:61–82  ·  view source on GitHub ↗

Show a function parameter with default for an grammar-tree based on the show_tree flag (or file object), writing to the appropriate stream depending on the type of the flag. :param show_tree: Flag which determines whether the function parameter with default is

(show_tree, name, default)

Source from the content-addressed store, hash-verified

59
60
61def maybe_show_tree_param_default(show_tree, name, default):
62 """
63 Show a function parameter with default for an grammar-tree based on the show_tree flag
64 (or file object), writing to the appropriate stream depending on the type
65 of the flag.
66
67 :param show_tree: Flag which determines whether the function parameter with
68 default is written to sys.stdout or not. (It is also to
69 pass a file like object, into which the ast will be
70 written).
71 :param name: The function parameter name.
72 :param default: The function parameter default.
73 """
74 if show_tree:
75 stream = show_tree if hasattr(show_tree, "write") else sys.stdout
76 stream.write("\n")
77 stream.write("--" + name)
78 stream.write("\n")
79 stream.write(str(default))
80 stream.write("\n")
81 stream.write("--")
82 stream.write("\n")

Callers 1

build_paramFunction · 0.90

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected