MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / atomic_write_json

Function atomic_write_json

openkb/locks.py:232–243  ·  view source on GitHub ↗

Atomically replace *path* with formatted JSON.

(
    path: Path,
    data: object,
    *,
    ensure_ascii: bool = True,
    default=None,
)

Source from the content-addressed store, hash-verified

230
231
232def atomic_write_json(
233 path: Path,
234 data: object,
235 *,
236 ensure_ascii: bool = True,
237 default=None,
238) -> None:
239 """Atomically replace *path* with formatted JSON."""
240 atomic_write_text(
241 path,
242 json.dumps(data, indent=2, ensure_ascii=ensure_ascii, default=default) + "\n",
243 )

Callers 4

_persistMethod · 0.90
initFunction · 0.90
write_journalMethod · 0.90

Calls 1

atomic_write_textFunction · 0.85

Tested by 1