44
55app = typer .Typer ()
66
7- def _get_cases (api_name : str , original_csv : str ):
7+
8+ def _get_cases (api_name : str , only_diff : bool , original_csv : str ):
89 with (
910 open (original_csv , "r" ) as infile ,
1011 open (f"filtered_result_{ api_name } .csv" , "w" , newline = "" ) as outfile ,
@@ -26,7 +27,7 @@ def _get_cases(api_name: str, original_csv: str):
2627 last_col = float (row [- 1 ]) if row [- 1 ].strip () else 0
2728 second_last_col = float (row [- 2 ]) if row [- 2 ].strip () else 0
2829
29- if last_col < 1e-16 and second_last_col < 1e-16 :
30+ if only_diff and last_col < 1e-16 and second_last_col < 1e-16 :
3031 continue
3132
3233 writer .writerow (row )
@@ -44,22 +45,19 @@ def _get_cases(api_name: str, original_csv: str):
4445 first_col = row [0 ]
4546 last_col = float (row [- 1 ]) if row [- 1 ].strip () else 0
4647 second_last_col = float (row [- 2 ]) if row [- 2 ].strip () else 0
47-
48- if last_col < 1e-16 and second_last_col < 1e-16 :
49- continue
5048 outs .append (row [2 ].replace ('""' , '"' ))
5149 outfile .write ("\n " .join (outs ))
5250
5351
5452@app .command ()
5553def get_cases (
5654 api_names : list [str ],
55+ only_diff : bool = True ,
5756 config_path : Path = Path ("TotalStableFull.csv" ),
5857):
5958 for api_name in api_names :
60- _get_cases (api_name , config_path .as_posix ())
61-
59+ _get_cases (api_name , only_diff , config_path .as_posix ())
6260
6361
6462if __name__ == "__main__" :
65- app ()
63+ app ()
0 commit comments