@@ -18,10 +18,12 @@ def _my_os():
18
18
return platform .system ()
19
19
20
20
21
- def _run_model (file_path , file_parser , predictor ):
21
+ def _run_model (file_path , file_parser , predictor , show_only_mismatch = True ):
22
22
print (f"\n ======== Analysing { file_path } =========\n \n " )
23
23
for func_name , func_body , docstr in file_parser .parse_file_and_get_data (file_path ):
24
24
match , _ = predictor .predict (func_body , docstr )
25
+ if match and show_only_mismatch :
26
+ continue
25
27
match_yes = "Yes" if bool (match ) == True else "No"
26
28
print (f'>>> Function "{ func_name } " with Dcostring """{ docstr } """\n >>> Do they match?\n { match_yes } ' )
27
29
print ("******************************************************************" )
@@ -54,10 +56,10 @@ def run_pipeline(args):
54
56
if args .recursive :
55
57
for file_path in iter_dir (args .recursive ):
56
58
if is_python_file (file_path ):
57
- _run_model (file_path , fp , predictor )
59
+ _run_model (file_path , fp , predictor , args . filter_match )
58
60
else :
59
61
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 )
61
63
else :
62
64
print ("Bye Bye!" )
63
65
@@ -67,6 +69,7 @@ def main():
67
69
parser = ArgumentParser ()
68
70
parser .add_argument ("-f" , "--file_name" , type = str , required = False , help = "The name of the file you want to run the pipeline on" )
69
71
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?" )
70
73
71
74
args = parser .parse_args ()
72
75
run_pipeline (args )
0 commit comments