MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / read_json

Function read_json

graphify/callflow_html.py:94–104  ·  view source on GitHub ↗

Read JSON with a useful error message.

(path: str | Path, default=None)

Source from the content-addressed store, hash-verified

92# ──────────────────────────────────────────────
93
94def read_json(path: str | Path, default=None):
95 """Read JSON with a useful error message."""
96 if not path:
97 return default
98 path = Path(path)
99 if not path.exists():
100 return default
101 try:
102 return json.loads(path.read_text(encoding="utf-8"))
103 except json.JSONDecodeError as exc:
104 raise SystemExit(f"ERROR: invalid JSON in {path}: {exc}") from exc
105
106
107def first_present(mapping: dict, *keys, default=None):

Callers 3

load_graphFunction · 0.85
load_labelsFunction · 0.85
load_sectionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected