@@ -595,7 +595,8 @@ def _f_definitions(self, functions_definitions):
595595 if self .source_code :
596596 funcs_info [f .name ]["source_code" ] = ast_to_source_code (f )
597597 if self .data_flow :
598- code_tokens , dfg = extract_dataflow (funcs_info [f .name ]["source_code" ], self .parser , "python" )
598+ temp_source_code = ast_to_source_code (f )
599+ code_tokens , dfg = extract_dataflow (temp_source_code , self .parser , "python" )
599600 funcs_info [f .name ]["data_flow" ] = dfg
600601 funcs_info [f .name ]["code_tokens" ] = code_tokens
601602 return funcs_info
@@ -1263,6 +1264,8 @@ def main(input_path, output_dir, ignore_dir_pattern, ignore_file_pattern, requir
12631264 path_to_languages = str (Path (__file__ ).parent / "resources" )
12641265 if sys .platform .startswith ("win" ) or sys .platform .startswith ("cygwin" ):
12651266 language = Language (path_to_languages + os .path .sep + "python_win.so" , "python" )
1267+ elif sys .platform .startswith ("darwin" ):
1268+ language = Language (path_to_languages + os .path .sep + "python_mac.so" , "python" )
12661269 else :
12671270 language = Language (path_to_languages + os .path .sep + "python_unix.so" , "python" )
12681271 else :
@@ -1311,22 +1314,37 @@ def main(input_path, output_dir, ignore_dir_pattern, ignore_file_pattern, requir
13111314 except :
13121315 print ("Readme not found at root level" )
13131316 for subdir , dirs , files in os .walk (input_path ):
1314-
1317+ # print(subdir, dirs, files)
13151318 for ignore_d in ignore_dir_pattern :
13161319 dirs [:] = [d for d in dirs if not d .startswith (ignore_d )]
13171320 for ignore_f in ignore_file_pattern :
13181321 files [:] = [f for f in files if not f .startswith (ignore_f )]
13191322 for f in files :
13201323 if ".py" in f and not f .endswith (".pyc" ):
1324+ # path = os.path.join(subdir, f)
1325+ # # print(path)
1326+ # relative_path = Path(subdir).relative_to(Path(input_path).parent)
1327+ # out_dir = str(Path(output_dir) / relative_path)
1328+ # cf_dir, json_dir = create_output_dirs(out_dir, control_flow)
1329+ # code_info = CodeInspection(path, cf_dir, json_dir, control_flow, abstract_syntax_tree, source_code,
1330+ # data_flow, parser)
1331+ #
1332+ # if code_info.fileJson:
1333+ # print(code_info.fileJson[0])
1334+ # if out_dir not in dir_info:
1335+ # dir_info[out_dir] = [code_info.fileJson[0]]
1336+ # else:
1337+ # dir_info[out_dir].append(code_info.fileJson[0])
13211338 try :
1322-
13231339 path = os .path .join (subdir , f )
1340+ # print(path)
13241341 relative_path = Path (subdir ).relative_to (Path (input_path ).parent )
13251342 out_dir = str (Path (output_dir ) / relative_path )
13261343 cf_dir , json_dir = create_output_dirs (out_dir , control_flow )
13271344 code_info = CodeInspection (path , cf_dir , json_dir , control_flow , abstract_syntax_tree , source_code , data_flow , parser )
1328- # print(parsers)
1345+
13291346 if code_info .fileJson :
1347+ # print(code_info.fileJson[0])
13301348 if out_dir not in dir_info :
13311349 dir_info [out_dir ] = [code_info .fileJson [0 ]]
13321350 else :
0 commit comments