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

Function clean_path_on_failure

pre_commit/util.py:28–35  ·  view source on GitHub ↗

Cleans up the directory on an exceptional failure.

(path: str)

Source from the content-addressed store, hash-verified

26
27@contextlib.contextmanager
28def clean_path_on_failure(path: str) -> Generator[None]:
29 """Cleans up the directory on an exceptional failure."""
30 try:
31 yield
32 except BaseException:
33 if os.path.exists(path):
34 rmtree(path)
35 raise
36
37
38def resource_text(filename: str) -> str:

Calls 2

rmtreeFunction · 0.85
existsMethod · 0.80