Refactor(utils): mark ExistingDirectory and ExistingFile as deprecated #14

Merged
jakob.scheid merged 4 commits from refactor/remove-existing-file-class into main 2026-09-05 14:44:21 +02:00
Showing only changes of commit 78e3e020be - Show all commits
+6 -4
View File
@@ -24,10 +24,12 @@ import argparse
import pathlib import pathlib
def existing_directory(path: str) -> pathlib.Path: def existing_directory(path: str) -> pathlib.Path:
try: _path = path
return pathlib.Path(path) path = pathlib.Path(_path)
jakob.scheid marked this conversation as resolved Outdated
Outdated
Review

There is no check whether the directory exists.

There is no check whether the directory exists.
except (FileNotFoundError, NotADirectoryError) as e: if not path.exists():
raise argparse.ArgumentTypeError(f'{e.filename}{": " + e.args[1] if len(e.args) > 1 else ""}') raise argparse.ArgumentTypeError(f'{_path}: no such file or directory')
if not path.is_dir():
raise argparse.ArgumentTypeError(f'{_path}: not a directory')
def main() -> int: def main() -> int:
argument_parser = argparse.ArgumentParser() argument_parser = argparse.ArgumentParser()