Ensure a directory exists, creating it if necessary. Args: path: Directory path Returns: Path object for the directory
(path: Union[str, Path])
| 9 | |
| 10 | |
| 11 | def ensure_dir(path: Union[str, Path]) -> Path: |
| 12 | """ |
| 13 | Ensure a directory exists, creating it if necessary. |
| 14 | |
| 15 | Args: |
| 16 | path: Directory path |
| 17 | |
| 18 | Returns: |
| 19 | Path object for the directory |
| 20 | """ |
| 21 | path = Path(path) |
| 22 | path.mkdir(parents=True, exist_ok=True) |
| 23 | return path |
| 24 | |
| 25 | |
| 26 | def read_text_file(path: Union[str, Path], encoding: str = "utf-8") -> Optional[str]: |
nothing calls this directly
no outgoing calls
no test coverage detected