mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
mkdirp -> os.makedirs(..., exist_ok=True)
This commit is contained in:
parent
67c2dcd90d
commit
2a9893d0f0
5 changed files with 9 additions and 21 deletions
|
|
@ -29,14 +29,6 @@ else: # pragma: no cover (<PY37)
|
|||
EnvironT = Union[Dict[str, str], 'os._Environ']
|
||||
|
||||
|
||||
def mkdirp(path: str) -> None:
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError:
|
||||
if not os.path.exists(path):
|
||||
raise
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def clean_path_on_failure(path: str) -> Generator[None, None, None]:
|
||||
"""Cleans up the directory on an exceptional failure."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue