MCPcopy
hub / github.com/VectifyAI/PageIndex / _read_json

Method _read_json

pageindex/client.py:148–155  ·  view source on GitHub ↗

Read a JSON file, returning None on any error.

(path)

Source from the content-addressed store, hash-verified

146
147 @staticmethod
148 def _read_json(path) -> dict | None:
149 """Read a JSON file, returning None on any error."""
150 try:
151 with open(path, "r", encoding="utf-8") as f:
152 return json.load(f)
153 except (json.JSONDecodeError, OSError) as e:
154 print(f"Warning: corrupt {Path(path).name}: {e}")
155 return None
156
157 def _save_doc(self, doc_id: str):
158 doc = self.documents[doc_id].copy()

Callers 3

_rebuild_metaMethod · 0.95
_read_metaMethod · 0.95
_ensure_doc_loadedMethod · 0.95

Calls 1

loadMethod · 0.80

Tested by

no test coverage detected