MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / tree_pformat

Function tree_pformat

src/cluecode/copyrights.py:4657–4674  ·  view source on GitHub ↗

Return a pretty-printed string representation of this pygmars Tree.

(copyright_tree, indent=0)

Source from the content-addressed store, hash-verified

4655
4656
4657def tree_pformat(copyright_tree, indent=0):
4658 """
4659 Return a pretty-printed string representation of this pygmars Tree.
4660 """
4661 fourdents = indent + 4
4662
4663 s = " " * indent + f"(label={copyright_tree.label!r}, children=(" + "\n"
4664 for child in copyright_tree:
4665 if isinstance(child, Tree):
4666 s += tree_pformat(copyright_tree=child, indent=fourdents)
4667 else:
4668 s += " " * fourdents
4669 s += repr(child)
4670 s += "\n"
4671
4672 s += " " * indent + "))" + "\n"
4673
4674 return s

Callers 1

detectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected