(
manpages: Sequence[ParsedManpage],
*,
max_cache_bytes: int | None = None,
max_entry_bytes: int | None = None,
max_entries: int | None = None,
)
| 39 | stores: list[CachingStore] = [] |
| 40 | |
| 41 | def make( |
| 42 | manpages: Sequence[ParsedManpage], |
| 43 | *, |
| 44 | max_cache_bytes: int | None = None, |
| 45 | max_entry_bytes: int | None = None, |
| 46 | max_entries: int | None = None, |
| 47 | ) -> CachingStore: |
| 48 | db_path = tmp_path / f"cache-{len(stores)}.db" |
| 49 | writable = Store.create(str(db_path)) |
| 50 | for manpage in manpages: |
| 51 | writable.add_manpage(manpage, _make_raw()) |
| 52 | writable.close() |
| 53 | |
| 54 | kwargs: dict[str, int] = {} |
| 55 | if max_cache_bytes is not None: |
| 56 | kwargs["max_cache_bytes"] = max_cache_bytes |
| 57 | if max_entry_bytes is not None: |
| 58 | kwargs["max_entry_bytes"] = max_entry_bytes |
| 59 | if max_entries is not None: |
| 60 | kwargs["max_entries"] = max_entries |
| 61 | |
| 62 | cached = CachingStore(str(db_path), **kwargs) |
| 63 | stores.append(cached) |
| 64 | return cached |
| 65 | |
| 66 | yield make |
| 67 |
no test coverage detected