MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / modify_manifest

Function modify_manifest

testing/fixtures.py:54–65  ·  view source on GitHub ↗

Modify the manifest yielded by this context to write to .pre-commit-hooks.yaml.

(path, commit=True)

Source from the content-addressed store, hash-verified

52
53@contextlib.contextmanager
54def modify_manifest(path, commit=True):
55 """Modify the manifest yielded by this context to write to
56 .pre-commit-hooks.yaml.
57 """
58 manifest_path = os.path.join(path, C.MANIFEST_FILE)
59 with open(manifest_path) as f:
60 manifest = yaml_load(f.read())
61 yield manifest
62 with open(manifest_path, 'w') as manifest_file:
63 manifest_file.write(yaml_dump(manifest))
64 if commit:
65 git_commit(msg=modify_manifest.__name__, cwd=path)
66
67
68@contextlib.contextmanager

Callers 2

hook_disappearingFunction · 0.90

Calls 2

yaml_dumpFunction · 0.90
git_commitFunction · 0.90

Tested by 2

hook_disappearingFunction · 0.72