1515from collections .abc import Callable , Iterable
1616from concurrent .futures import ThreadPoolExecutor
1717from datetime import UTC , datetime
18+ from pathlib import Path
1819from typing import Any , NamedTuple
1920from urllib .parse import urlparse
2021from urllib .request import Request , build_opener
@@ -182,7 +183,7 @@ def _task(url: str) -> CheckResult:
182183# --- cache -----------------------------------------------------------------------
183184
184185
185- def load_cache (path = URL_CACHE_PATH ) -> dict [str , dict [str , Any ]]:
186+ def load_cache (path : Path = URL_CACHE_PATH ) -> dict [str , dict [str , Any ]]:
186187 return {e ["url" ]: e for e in ledger .iter_entries (path ) if isinstance (e .get ("url" ), str )}
187188
188189
@@ -200,7 +201,7 @@ def is_fresh(entry: dict[str, Any], now: datetime, ttl_days: int) -> bool:
200201 return (now - ts ).days < ttl_days
201202
202203
203- def save_cache (cache : dict [str , dict [str , Any ]], path = URL_CACHE_PATH ) -> None :
204+ def save_cache (cache : dict [str , dict [str , Any ]], path : Path = URL_CACHE_PATH ) -> None :
204205 ledger .replace_all (list (cache .values ()), path )
205206
206207
0 commit comments