(
msg: Printer,
input_path: Path,
output_dir: Union[str, Path],
file_type: str,
converter: str,
ner_map: Optional[Path],
)
| 226 | |
| 227 | |
| 228 | def verify_cli_args( |
| 229 | msg: Printer, |
| 230 | input_path: Path, |
| 231 | output_dir: Union[str, Path], |
| 232 | file_type: str, |
| 233 | converter: str, |
| 234 | ner_map: Optional[Path], |
| 235 | ): |
| 236 | if file_type not in FILE_TYPES_STDOUT and output_dir == "-": |
| 237 | msg.fail( |
| 238 | f"Can't write .{file_type} data to stdout. Please specify an output directory.", |
| 239 | exits=1, |
| 240 | ) |
| 241 | if not input_path.exists(): |
| 242 | msg.fail("Input file not found", input_path, exits=1) |
| 243 | if output_dir != "-" and not Path(output_dir).exists(): |
| 244 | msg.fail("Output directory not found", output_dir, exits=1) |
| 245 | if ner_map is not None and not Path(ner_map).exists(): |
| 246 | msg.fail("NER map not found", ner_map, exits=1) |
| 247 | if input_path.is_dir(): |
| 248 | input_locs = walk_directory(input_path, converter) |
| 249 | if len(input_locs) == 0: |
| 250 | msg.fail("No input files in directory", input_path, exits=1) |
| 251 | if converter not in CONVERTERS: |
| 252 | msg.fail(f"Can't find converter for {converter}", exits=1) |
| 253 | |
| 254 | |
| 255 | def _get_converter(msg, converter, input_path: Path): |
no test coverage detected
searching dependent graphs…