| 756 | import gc |
| 757 | |
| 758 | def print_path(path): |
| 759 | for i, step in enumerate(path): |
| 760 | # next "wraps around" |
| 761 | next = path[(i + 1) % len(path)] |
| 762 | |
| 763 | outstream.write(" %s -- " % type(step)) |
| 764 | if isinstance(step, dict): |
| 765 | for key, val in step.items(): |
| 766 | if val is next: |
| 767 | outstream.write(f"[{key!r}]") |
| 768 | break |
| 769 | if key is next: |
| 770 | outstream.write(f"[key] = {val!r}") |
| 771 | break |
| 772 | elif isinstance(step, list): |
| 773 | outstream.write("[%d]" % step.index(next)) |
| 774 | elif isinstance(step, tuple): |
| 775 | outstream.write("( tuple )") |
| 776 | else: |
| 777 | outstream.write(repr(step)) |
| 778 | outstream.write(" ->\n") |
| 779 | outstream.write("\n") |
| 780 | |
| 781 | def recurse(obj, start, all, current_path): |
| 782 | if show_progress: |