Skip to content

Commit

Permalink
Remove summary
Browse files Browse the repository at this point in the history
  • Loading branch information
benjeffery authored and mergify[bot] committed Sep 26, 2024
1 parent 6a4148c commit 56a163e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
7 changes: 7 additions & 0 deletions python/tests/test_highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,6 +2207,13 @@ def test_bad_provenance(self, ts_fixture):
ts = tables.tree_sequence()
assert "Could not parse provenance" in ts._repr_html_()

def test_provenance_summary_html(self, ts_fixture):
tables = ts_fixture.tables
for _ in range(20):
# Add a row with isotimestamp
tables.provenances.add_row("foo", "bar")
assert "... 15 more" in tables.tree_sequence()._repr_html_()

def test_html_repr_limit(self, ts_fixture):
tables = ts_fixture.tables
d = {n: n for n in range(50)}
Expand Down
14 changes: 2 additions & 12 deletions python/tskit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"""
Module responsible for various utility functions used in other modules.
"""
import collections
import dataclasses
import datetime
import html
Expand Down Expand Up @@ -564,19 +563,10 @@ def tree_sequence_html(ts):
f"""Could not parse provenance record: """
f"""{e.__class__.__name__} {str(e)}"""
)
extra_summary = collections.Counter()
for prov in extra_provenances:
try:
record = json.loads(prov.record)
software_name = record.get("software", {}).get("name", "Unknown")
command = record.get("parameters", {}).get("command", "Unknown")
extra_summary.update([f"{software_name} {command}"])
except Exception:
extra_summary.update(["Error parsing provenance record"])
for command, count in extra_summary.most_common():
if len(extra_provenances) > 0:
provenance_rows += f"""
<tr>
<td colspan="5"><i>... {count} {command}</i></td>
<td colspan="5"><i>... {len(extra_provenances)} more</i></td>
</tr>
"""
md = (
Expand Down

0 comments on commit 56a163e

Please sign in to comment.