File size: 710 Bytes
6f5156a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | """Goldenset workbook helpers."""
from __future__ import annotations
from pathlib import Path
def discover_goldensets(data_dir: Path) -> list[Path]:
"""Workbooks under ``data/<anything>/Goldenset_*.xlsx``."""
return sorted(data_dir.glob("*/Goldenset_*.xlsx"))
def header_map(header_row: tuple) -> dict[str, int]:
m: dict[str, int] = {}
for i, h in enumerate(header_row):
if h is None:
continue
m[str(h).strip().lower()] = i
return m
def cell(row: tuple, idx: int | None) -> str | None:
if idx is None:
return None
if idx < 0 or idx >= len(row):
return None
v = row[idx]
if v is None:
return None
return str(v)
|