Read all gist JSON files for a given date from the local repo. Args: date_str: YYYY-MM-DD repo_root: path to repo root (auto-detected if None) Returns: List of gist dicts sorted by pr_number
(date_str: str, repo_root: str = None)
| 619 | |
| 620 | |
| 621 | def read_gists_for_date(date_str: str, repo_root: str = None) -> List[Dict]: |
| 622 | """Read all gist JSON files for a given date from the local repo. |
| 623 | |
| 624 | Args: |
| 625 | date_str: YYYY-MM-DD |
| 626 | repo_root: path to repo root (auto-detected if None) |
| 627 | |
| 628 | Returns: |
| 629 | List of gist dicts sorted by pr_number |
| 630 | """ |
| 631 | if repo_root is None: |
| 632 | repo_root = get_repo_root() |
| 633 | |
| 634 | gist_dir = Path(repo_root) / GISTS_REL_DIR / date_str |
| 635 | |
| 636 | if not gist_dir.exists(): |
| 637 | return [] |
| 638 | |
| 639 | gists = [] |
| 640 | for f in sorted(gist_dir.glob("PR-*.json")): |
| 641 | try: |
| 642 | with open(f, "r", encoding="utf-8") as fh: |
| 643 | gists.append(json.load(fh)) |
| 644 | except (json.JSONDecodeError, OSError) as e: |
| 645 | print(f" Warning: skipping malformed gist {f}: {e}") |
| 646 | |
| 647 | return sorted(gists, key=lambda g: g.get("pr_number", 0)) |
| 648 | |
| 649 | |
| 650 | def filter_daily_gists(gists: List[Dict]) -> List[Dict]: |
no test coverage detected