"""Shared utility for writing per-scraper run statistics to JSON.""" from __future__ import annotations import json from pathlib import Path HERE = Path(__file__).parent def write_stats(filename: str, stats: dict) -> None: """Write scraper run stats dict to a JSON file next to this module.""" path = HERE / filename path.write_text(json.dumps(stats, ensure_ascii=False, indent=2), encoding="utf-8")