MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / _disk_load

Method _disk_load

src/pyspector/ast_cache.py:406–419  ·  view source on GitHub ↗
(self, file_path: Path, file_hash: str)

Source from the content-addressed store, hash-verified

404 return self._cache_dir / f"{key}.json"
405
406 def _disk_load(self, file_path: Path, file_hash: str) -> Optional[FileCacheEntry]:
407 p = self._disk_path(file_path)
408 if not p or not p.exists():
409 return None
410 try:
411 entry = _deserialize_entry(p.read_text(encoding="utf-8"))
412 if entry.version == CACHE_VERSION and entry.file_hash == file_hash:
413 return entry
414 except Exception:
415 try:
416 p.unlink(missing_ok=True)
417 except OSError:
418 pass
419 return None
420
421 def _disk_save(self, entry: FileCacheEntry) -> None:
422 p = self._disk_path(Path(entry.file_path))

Callers 1

_get_entryMethod · 0.95

Calls 2

_disk_pathMethod · 0.95
_deserialize_entryFunction · 0.85

Tested by

no test coverage detected