MCPcopy
hub / github.com/pre-commit/pre-commit / install_hook_envs

Function install_hook_envs

pre_commit/repository.py:214–229  ·  view source on GitHub ↗
(hooks: Sequence[Hook], store: Store)

Source from the content-addressed store, hash-verified

212
213
214def install_hook_envs(hooks: Sequence[Hook], store: Store) -> None:
215 def _need_installed() -> list[Hook]:
216 seen: set[tuple[Prefix, str, str, tuple[str, ...]]] = set()
217 ret = []
218 for hook in hooks:
219 if hook.install_key not in seen and not _hook_installed(hook):
220 ret.append(hook)
221 seen.add(hook.install_key)
222 return ret
223
224 if not _need_installed():
225 return
226 with store.exclusive_lock():
227 # Another process may have already completed this work
228 for hook in _need_installed():
229 _hook_install(hook)
230
231
232def all_hooks(root_config: dict[str, Any], store: Store) -> tuple[Hook, ...]:

Callers 4

runFunction · 0.90
install_hooksFunction · 0.90
_get_hookFunction · 0.90

Calls 3

_need_installedFunction · 0.85
_hook_installFunction · 0.85
exclusive_lockMethod · 0.80

Tested by 2

_get_hookFunction · 0.72