Add type hints to get_file_paths
- ID
689f9c1- date
2025-01-21 11:10:59+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
81aaf4f- message
Add type hints to `get_file_paths`- changed files
1 file, 4 additions, 3 deletions
Changed files
expansions/get_file_paths.py (598) → expansions/get_file_paths.py (673)
diff --git a/expansions/get_file_paths.py b/expansions/get_file_paths.py
index bd9e1c9..cb8168d 100644
--- a/expansions/get_file_paths.py
+++ b/expansions/get_file_paths.py
@@ -1,12 +1,13 @@
+from collections.abc import Iterator
import pathlib
-def get_file_paths_under(root=".", *, suffix=""):
+def get_file_paths_under(
+ root: pathlib.Path = pathlib.Path("."), *, suffix: str = ""
+) -> Iterator[pathlib.Path]:
"""
Generates the absolute paths to every matching file under ``root``.
"""
- root = pathlib.Path(root)
-
if root.exists() and not root.is_dir():
raise ValueError(f"Cannot find files under file: {root!r}")