sift_py.yaml.utils
1from pathlib import Path 2from typing import Callable, Type 3 4 5def _handle_subdir(path: Path, file_handler: Callable): 6 """The file_handler callable must accept a Path object as its only argument.""" 7 for file_in_dir in path.iterdir(): 8 if file_in_dir.is_dir(): 9 _handle_subdir(file_in_dir, file_handler) 10 elif file_in_dir.is_file(): 11 file_handler(file_in_dir) 12 13 14def _type_fqn(typ: Type) -> str: 15 return f"{typ.__module__}.{typ.__name__}"