Coverage for src/extratools_core/path.py: 0%
9 statements
« prev ^ index » next coverage.py v7.8.1, created at 2025-05-23 02:47 -0700
« prev ^ index » next coverage.py v7.8.1, created at 2025-05-23 02:47 -0700
1from .typing import PathLike
4def clear_dir(curr_dir: PathLike) -> None:
5 """
6 Based on example in https://docs.python.org/3/library/pathlib.html#pathlib.Path.walk
7 """
9 if not curr_dir.is_dir():
10 raise ValueError
12 for parent, dirs, files in curr_dir.walk(top_down=False):
13 for filename in files:
14 (parent / filename).unlink()
15 for dirname in dirs:
16 (parent / dirname).rmdir()