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
451
452def get_cache(scan_path: Optional[Path] = None) -> IncrementalAstCache:
453 """
454 Return the process-level cache instance.
455
456 The disk cache is rooted at *<scan_path>/.pyspector_cache/ast* when
457 *scan_path* is supplied on the first call. Subsequent calls return the
458 same instance regardless of *scan_path*.
459 """
460 global _instance
461 if _instance is None:
462 cache_dir: Optional[Path] = None
463 if scan_path:
464 base = scan_path if scan_path.is_dir() else scan_path.parent
465 cache_dir = base / ".pyspector_cache" / "ast"
466 _instance = IncrementalAstCache(cache_dir=cache_dir)
467 return _instance
468
469
470def _reset_cache_singleton() -> None:

Callers 5

_scan_to_issuesFunction · 0.85
_execute_scanFunction · 0.85
watch_commandFunction · 0.85

Calls 1

IncrementalAstCacheClass · 0.85