MCPcopy Create free account
hub / github.com/T0UGH/codex-self-evolution-plugin / atomic_write_json

Function atomic_write_json

src/codex_self_evolution/storage.py:49–55  ·  view source on GitHub ↗
(path: Path, payload: object)

Source from the content-addressed store, hash-verified

47
48
49def atomic_write_json(path: Path, payload: object) -> None:
50 path.parent.mkdir(parents=True, exist_ok=True)
51 with tempfile.NamedTemporaryFile("w", encoding="utf-8", dir=path.parent, delete=False) as handle:
52 json.dump(payload, handle, indent=2, sort_keys=True)
53 handle.write("\n")
54 temp_name = handle.name
55 os.replace(temp_name, path)
56
57
58def atomic_write_text(path: Path, content: str) -> None:

Calls

no outgoing calls