Atomically write UTF-8 text content into the cache.
(cache_path: Path, content: str)
| 1097 | |
| 1098 | |
| 1099 | def _write_text_cache(cache_path: Path, content: str): |
| 1100 | """Atomically write UTF-8 text content into the cache.""" |
| 1101 | cache_path.parent.mkdir(parents=True, exist_ok=True) |
| 1102 | temp_path = cache_path.with_suffix(f"{cache_path.suffix}.part") |
| 1103 | with open(temp_path, "w", encoding="utf-8", newline="\n") as f: |
| 1104 | f.write(content) |
| 1105 | os.replace(temp_path, cache_path) |
| 1106 | |
| 1107 | |
| 1108 | def _get_recaptcha_asset_cache_dir() -> Path: |
no outgoing calls
no test coverage detected