Finds and prints a single cycle in the dependency graph.
(el, graph, reprs, path)
| 766 | reprs[r_id] = describe(r, blacklist) |
| 767 | |
| 768 | def find_cycle(el, graph, reprs, path): |
| 769 | """Finds and prints a single cycle in the dependency graph.""" |
| 770 | if el not in graph: |
| 771 | return |
| 772 | for r in graph[el]: |
| 773 | if r in path: |
| 774 | logging.error("Reference cycle sample:") |
| 775 | for p in path + (r,): |
| 776 | logging.error(reprs.get(p, "unknown object " + str(p))) |
| 777 | return True |
| 778 | else: |
| 779 | if find_cycle(r, graph, reprs, path + (r,)): |
| 780 | return True |
| 781 | return False |
| 782 | |
| 783 | obj = objects[idx] |
| 784 | graph = {} # referrer ID -> object ID |
no test coverage detected