Argparse type validator for filename arguments. :path: Path of filename. :optname: Name of the option.
(path: str, optname: str)
| 281 | |
| 282 | |
| 283 | def filename_arg(path: str, optname: str) -> str: |
| 284 | """Argparse type validator for filename arguments. |
| 285 | |
| 286 | :path: Path of filename. |
| 287 | :optname: Name of the option. |
| 288 | """ |
| 289 | if os.path.isdir(path): |
| 290 | raise UsageError(f"{optname} must be a filename, given: {path}") |
| 291 | return path |
| 292 | |
| 293 | |
| 294 | def directory_arg(path: str, optname: str) -> str: |
nothing calls this directly
no test coverage detected