Return a pretty-printed string representation of this pygmars Tree.
(copyright_tree, indent=0)
| 4655 | |
| 4656 | |
| 4657 | def 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 |