Prefer the hash shard within the requested semantic prompt namespace.
(root: Path, kind: str, digest: str, prompt_fp: str | None = None,
*, for_write: bool = False)
| 1473 | |
| 1474 | |
| 1475 | def _cache_entry_path(root: Path, kind: str, digest: str, prompt_fp: str | None = None, |
| 1476 | *, for_write: bool = False) -> Path: |
| 1477 | """Prefer the hash shard within the requested semantic prompt namespace.""" |
| 1478 | namespace = cache_dir(root, kind, prompt_fp) |
| 1479 | flat = namespace / f"{digest}.json" |
| 1480 | if kind.startswith("semantic"): |
| 1481 | shard = namespace / digest[:2] / flat.name |
| 1482 | if for_write or os.path.isfile(_os_long_path(shard)): |
| 1483 | return shard |
| 1484 | return flat |
| 1485 | |
| 1486 | |
| 1487 | def load_cached(path: Path, root: Path = Path("."), kind: str = "ast", |
no test coverage detected