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

Function get_cache

src/pyspector/ast_cache.py:452–467  ·  view source on GitHub ↗

Return the process-level cache instance. The disk cache is rooted at * /.pyspector_cache/ast* when *scan_path* is supplied on the first call. Subsequent calls return the same instance regardless of *scan_path*.

(scan_path: Optional[Path] = None)

Source from the content-addressed store, hash-verified

450 if parallel and misses:
451 fresh = [(i, probe, content) for i, probe, content in misses if not probe.old_chunks]
452 cache_dir = str(self._cache_dir) if self._cache_dir else None
453 built = parallel_map(
454 _build_entry_task,
455 [(str(p.path), c, p.file_hash, p.mtime, cache_dir) for _, p, c in fresh],
456 costs=[len(c) for _, _, c in fresh],
457 on_note=on_note,
458 )
459 if built is not None:
460 pooled = {i: result for (i, _, _), result in zip(fresh, built)}
461
462 for i, probe, content in misses:
463 result = pooled.get(i)
464 if result is None:
465 outcomes[i] = self._build_one(probe, content)
466 elif result[0] == "ok":
467 self._l1_put(probe.key, result[1])
468 outcomes[i] = self._decode(result[1])
469 else:
470 outcomes[i] = result # a Problem reported by the worker

Callers 5

_scan_to_issuesFunction · 0.85
_execute_scanFunction · 0.85
watch_commandFunction · 0.85

Calls 1

IncrementalAstCacheClass · 0.85