Skip to content

Commit e1ea520

Browse files
authored
Merge pull request #486 from NASA-PDS/copilot/sub-pr-483-again
Tighten type hints in `split_by_version()` in backfill_history.py
2 parents 4bd9377 + 0f72bf7 commit e1ea520

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)