expansions/get_file_paths.py
1from collections.abc import Iterator
2from pathlib import Path
5def get_file_paths_under(
6 root: Path | str = Path("."), *, suffix: str = ""
9 Generates the absolute paths to every matching file under ``root``.
13 if root.exists() and not root.is_dir():
14 raise ValueError(f"Cannot find files under non-directory: {root!r}")
17 raise FileNotFoundError(root)
19 for dirpath, _, filenames in root.walk():
21 if not suffix or f.lower().endswith(suffix):
25for p in get_file_paths_under():