Atomically replace *path* with text *content*.
(path: Path, content: str, *, encoding: str = "utf-8")
| 225 | |
| 226 | |
| 227 | def atomic_write_text(path: Path, content: str, *, encoding: str = "utf-8") -> None: |
| 228 | """Atomically replace *path* with text *content*.""" |
| 229 | atomic_write_bytes(path, content.encode(encoding)) |
| 230 | |
| 231 | |
| 232 | def atomic_write_json( |