@@ -37,19 +37,22 @@ def tuple_of_three(string: str) -> Tuple[str, str, str]:
37
37
def parse_args_to_dict (args ) -> Sequence [TestData ]:
38
38
args_dict = dict ()
39
39
40
- for test , parser in args .parser :
41
- if test not in args_dict :
42
- args_dict [test ] = TestData (test )
43
- args_dict [test ].output_parsers += [OutputParserData (parser )]
44
-
45
- for test , parser , file in args .file :
46
- if test not in args_dict :
47
- args_dict [test ] = TestData (test )
48
- args_dict [test ].file_parsers += [FileParserData (parser , file )]
40
+ if args .parser is not None :
41
+ for test , parser in args .parser :
42
+ if test not in args_dict :
43
+ args_dict [test ] = TestData (test )
44
+ args_dict [test ].output_parsers += [OutputParserData (parser )]
45
+
46
+ if args .file is not None :
47
+ for test , parser , file in args .file :
48
+ if test not in args_dict :
49
+ args_dict [test ] = TestData (test )
50
+ args_dict [test ].file_parsers += [FileParserData (parser , file )]
49
51
50
52
data_parsers = []
51
- for file , parser in args .data :
52
- data_parsers += [FileParserData (parser , file )]
53
+ if args .data is not None :
54
+ for file , parser in args .data :
55
+ data_parsers += [FileParserData (parser , file )]
53
56
54
57
return args_dict .values (), data_parsers
55
58
@@ -75,23 +78,26 @@ def check_args(args) -> None:
75
78
if output_dir .exists ():
76
79
raise FileExistsError (f"Output directory { str (output_dir )} exists" )
77
80
78
- for _ , parser in args .parser :
79
- parser_path = Path (parser )
80
- if not parser_path .exists ():
81
- raise FileNotFoundError (f"Output parser { str (parser_path )} does not exist" )
82
-
83
- for _ , parser , _ in args .file :
84
- parser_path = Path (parser )
85
- if not parser_path .exists ():
86
- raise FileNotFoundError (f"File parser { str (parser_path )} does not exist" )
87
-
88
- for file , parser in args .data :
89
- parser_path = Path (parser )
90
- if not parser_path .exists ():
91
- raise FileNotFoundError (f"Data file parser { str (parser_path )} does not exist" )
92
- file_path = Path (parser )
93
- if not file_path .exists ():
94
- raise FileNotFoundError (f"Data file { str (file_path )} does not exist" )
81
+ if args .parser is not None :
82
+ for _ , parser in args .parser :
83
+ parser_path = Path (parser )
84
+ if not parser_path .exists ():
85
+ raise FileNotFoundError (f"Output parser { str (parser_path )} does not exist" )
86
+
87
+ if args .file is not None :
88
+ for _ , parser , _ in args .file :
89
+ parser_path = Path (parser )
90
+ if not parser_path .exists ():
91
+ raise FileNotFoundError (f"File parser { str (parser_path )} does not exist" )
92
+
93
+ if args .data is not None :
94
+ for file , parser in args .data :
95
+ parser_path = Path (parser )
96
+ if not parser_path .exists ():
97
+ raise FileNotFoundError (f"Data file parser { str (parser_path )} does not exist" )
98
+ file_path = Path (parser )
99
+ if not file_path .exists ():
100
+ raise FileNotFoundError (f"Data file { str (file_path )} does not exist" )
95
101
96
102
97
103
if __name__ == "__main__" :
0 commit comments