scripts: Improved cycle detection notes in scripts

- Prevented childrenof memoization from hiding the source of a
  detected cycle.

- Deduplicated multiple cycle detected notes.

- Fixed note rendering when last column does not have a notes list.
  Currently this only happens when entry is None (no results).
This commit is contained in:
Christopher Haster
2024-12-07 00:55:00 -06:00
parent 56d888933f
commit ac79c88c6f
9 changed files with 91 additions and 37 deletions

View File

@@ -889,8 +889,13 @@ def table(Result, results, diff_results=None, *,
getattr(r, k, None),
getattr(diff_r, k, None)))))
# append any notes
if hasattr(Result, '_notes'):
entry[-1][1].extend(getattr(r, Result._notes))
if hasattr(Result, '_notes') and r is not None:
notes = getattr(r, Result._notes)
if isinstance(entry[-1], tuple):
entry[-1] = (entry[-1][0], entry[-1][1] + notes)
else:
entry[-1] = (entry[-1], notes)
return entry
# recursive entry helper, only used by some scripts