Argparse type validator for directory arguments. :path: Path of directory. :optname: Name of the option.
(path: str, optname: str)
| 292 | |
| 293 | |
| 294 | def directory_arg(path: str, optname: str) -> str: |
| 295 | """Argparse type validator for directory arguments. |
| 296 | |
| 297 | :path: Path of directory. |
| 298 | :optname: Name of the option. |
| 299 | """ |
| 300 | if not os.path.isdir(path): |
| 301 | raise UsageError(f"{optname} must be a directory, given: {path}") |
| 302 | return path |
| 303 | |
| 304 | |
| 305 | # Plugins that cannot be disabled via "-p no:X" currently. |
nothing calls this directly
no test coverage detected