Skip to content

Commit 0f72bf7

Browse files
Copilotjordanpadams
andcommitted
Tighten type hints in split_by_version() in backfill_history.py
Co-authored-by: jordanpadams <33492486+jordanpadams@users.noreply.github.com> Agent-Logs-Url: https://github.com/NASA-PDS/registry/sessions/ab42f1c3-5d84-40a5-b8c0-c00a2938c827
1 parent d0e1845 commit 0f72bf7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

scripts/backfill_history.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747

4848
# ── version splitting (mirrors generate_registry_status_reports.py) ──────────
4949

50-
def split_by_version(rows: list[list[str]]) -> tuple[list, list]:
50+
def split_by_version(rows: list[list[str]]) -> tuple[list[list[str]], list[list[str]]]:
5151
"""Split rows into (latest, superseded) by LID using numeric version comparison."""
52-
by_lid: dict[str, list] = defaultdict(list)
52+
by_lid: dict[str, list[tuple[tuple[int, ...], list[str]]]] = defaultdict(list)
5353
for row in rows:
5454
lidvid = row[1] if len(row) > 1 else ""
5555
if "::" in lidvid:
@@ -62,7 +62,8 @@ def split_by_version(rows: list[list[str]]) -> tuple[list, list]:
6262
ver_key = (0,)
6363
by_lid[lid].append((ver_key, row))
6464

65-
latest, superseded = [], []
65+
latest: list[list[str]] = []
66+
superseded: list[list[str]] = []
6667
for version_rows in by_lid.values():
6768
sorted_rows = sorted(version_rows, key=lambda x: x[0], reverse=True)
6869
latest.append(sorted_rows[0][1])

0 commit comments

Comments
 (0)