MCPcopy Create free account
hub / github.com/idank/explainshell / find_man_page

Method find_man_page

explainshell/caching_store.py:157–184  ·  view source on GitHub ↗
(
        self, name: str, distro: str | None = None, release: str | None = None
    )

Source from the content-addressed store, hash-verified

155 del self._local.store
156
157 def find_man_page(
158 self, name: str, distro: str | None = None, release: str | None = None
159 ) -> list[ParsedManpage]:
160 key = (name, distro, release)
161 with self._lock:
162 try:
163 value = self._manpage_cache[key]
164 except KeyError:
165 self._manpage_cache_misses += 1
166 else:
167 self._manpage_cache_hits += 1
168 if isinstance(value, _FindManpageMiss):
169 raise errors.ProgramDoesNotExist(*value.args)
170 return list(value)
171
172 try:
173 value: _CacheValue = tuple(
174 self._store().find_man_page(name, distro=distro, release=release)
175 )
176 except errors.ProgramDoesNotExist as exc:
177 value = _FindManpageMiss(exc.args)
178
179 with self._lock:
180 self._cache_manpage(key, value)
181
182 if isinstance(value, _FindManpageMiss):
183 raise errors.ProgramDoesNotExist(*value.args)
184 return list(value)
185
186 def manpage_cache_info(self) -> ManpageCacheInfo:
187 with self._lock:

Callers

nothing calls this directly

Calls 3

_storeMethod · 0.95
_cache_manpageMethod · 0.95
_FindManpageMissClass · 0.85

Tested by

no test coverage detected