MCPcopy Create free account
hub / github.com/pollinations/pollinations / read_gists_for_date

Function read_gists_for_date

social/scripts/common.py:621–647  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

619
620
621def 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
650def filter_daily_gists(gists: List[Dict]) -> List[Dict]:

Callers 3

read_gists_for_weekFunction · 0.90
load_gists_as_changelogFunction · 0.90
mainFunction · 0.90

Calls 3

get_repo_rootFunction · 0.85
appendMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected