Skip to content

Commit

Permalink
Do not add unique summaries over how many done, limit counts to 5 max…
Browse files Browse the repository at this point in the history
… shown
  • Loading branch information
yarikoptic committed Dec 16, 2024
1 parent 17e5fd0 commit f5b58d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dandi/support/pyout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import Counter
import datetime
import logging
import re
import sys
import time

Expand Down Expand Up @@ -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)]

Check warning on line 61 in dandi/support/pyout.py

View check run for this annotation

Codecov / codecov/patch

dandi/support/pyout.py#L61

Added line #L61 was not covered by tests
return vals


# class mapped_counts(object):
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f5b58d2

Please sign in to comment.