From f5b58d2171aae3dbf0db07890df0921fbbf6e638 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 16 Dec 2024 10:28:22 -0500 Subject: [PATCH] Do not add unique summaries over how many done, limit counts to 5 max shown --- dandi/support/pyout.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dandi/support/pyout.py b/dandi/support/pyout.py index 7ceaf5680..ccceb54de 100644 --- a/dandi/support/pyout.py +++ b/dandi/support/pyout.py @@ -3,6 +3,7 @@ from collections import Counter import datetime import logging +import re import sys import time @@ -54,7 +55,11 @@ def summary_dates(values): def counts(values): - return [f"{v:d} {k}" for k, v in Counter(values).items()] + vals = [f"{v:d} {k}" for k, v in Counter(values).items()] + # limit to 5 flines + if len(vals) > 5: + vals = vals[:4] + ["+%d more" % (len(vals) - 4)] + return vals # class mapped_counts(object): @@ -158,7 +163,8 @@ def get_style(hide_if_missing=True): color=dict( re_lookup=[["^exists", "yellow"], ["^(failed|error|ERROR)", "red"]] ), - aggregate=counts, + # replace numbers since we do not want unique among them + aggregate=lambda values: counts(re.sub(r"\d+", "some", v) for v in values), ), "progress": progress_style, "done%": progress_style,