(
self,
*,
path: Union[str, Path],
max_bytes: int,
compatibility_key: str,
min_tokens: int = 128,
)
| 12332 | METADATA_COMPATIBILITY_KEY = "compatibility_key" |
| 12333 | |
| 12334 | def __init__( |
| 12335 | self, |
| 12336 | *, |
| 12337 | path: Union[str, Path], |
| 12338 | max_bytes: int, |
| 12339 | compatibility_key: str, |
| 12340 | min_tokens: int = 128, |
| 12341 | ) -> None: |
| 12342 | self.path = Path(path) |
| 12343 | self.path.mkdir(parents=True, exist_ok=True) |
| 12344 | self.max_bytes = max(0, int(max_bytes)) |
| 12345 | self.min_tokens = max(1, int(min_tokens)) |
| 12346 | self.compatibility_key = compatibility_key |
| 12347 | self._metadata = { |
| 12348 | self.METADATA_FORMAT: self.FORMAT_VERSION, |
| 12349 | self.METADATA_COMPATIBILITY_KEY: compatibility_key, |
| 12350 | } |
| 12351 | self._trie = RadixTrie() |
| 12352 | self._entries_by_id: Dict[int, SequenceDiskCache.Entry] = {} |
| 12353 | self._entries_by_tokens: Dict[Tuple[int, ...], SequenceDiskCache.Entry] = {} |
| 12354 | self._next_entry_id = 0 |
| 12355 | self._size_bytes = 0 |
| 12356 | self._load_entries() |
| 12357 | self._evict_if_needed() |
| 12358 | |
| 12359 | @staticmethod |
| 12360 | def fingerprint_file(path: str) -> str: |
nothing calls this directly
no test coverage detected