@@ -18,10 +18,12 @@ def _my_os():
1818 return platform .system ()
1919
2020
21- def _run_model (file_path , file_parser , predictor ):
21+ def _run_model (file_path , file_parser , predictor , show_only_mismatch = True ):
2222 print (f"\n ======== Analysing { file_path } =========\n \n " )
2323 for func_name , func_body , docstr in file_parser .parse_file_and_get_data (file_path ):
2424 match , _ = predictor .predict (func_body , docstr )
25+ if match and show_only_mismatch :
26+ continue
2527 match_yes = "Yes" if bool (match ) == True else "No"
2628 print (f'>>> Function "{ func_name } " with Dcostring """{ docstr } """\n >>> Do they match?\n { match_yes } ' )
2729 print ("******************************************************************" )
@@ -54,10 +56,10 @@ def run_pipeline(args):
5456 if args .recursive :
5557 for file_path in iter_dir (args .recursive ):
5658 if is_python_file (file_path ):
57- _run_model (file_path , fp , predictor )
59+ _run_model (file_path , fp , predictor , args . filter_match )
5860 else :
5961 if is_python_file (args .file_name ):
60- _run_model (args .file_name , fp , predictor )
62+ _run_model (args .file_name , fp , predictor , args . filter_match )
6163 else :
6264 print ("Bye Bye!" )
6365
@@ -67,6 +69,7 @@ def main():
6769 parser = ArgumentParser ()
6870 parser .add_argument ("-f" , "--file_name" , type = str , required = False , help = "The name of the file you want to run the pipeline on" )
6971 parser .add_argument ("-r" , "--recursive" , required = False , help = "Put the directory if you want to run recursively" )
72+ parser .add_argument ("-m" , "--filter_match" , action = "store_false" , help = "Shall we only show the mis matches?" )
7073
7174 args = parser .parse_args ()
7275 run_pipeline (args )
0 commit comments