(path: Path, payload: dict[str, Any])
| 46 | |
| 47 | |
| 48 | def write_json_atomic(path: Path, payload: dict[str, Any]) -> None: |
| 49 | path.parent.mkdir(parents=True, exist_ok=True) |
| 50 | tmp = path.with_suffix(path.suffix + '.tmp') |
| 51 | tmp.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding='utf-8') |
| 52 | tmp.replace(path) |
| 53 | |
| 54 | |
| 55 | def write_text_atomic(path: Path, content: str) -> None: |
no outgoing calls
no test coverage detected