@@ -159,6 +159,7 @@ def get_code_context_hash(self) -> str:
159159
160160 # Extract the function's code content
161161 lines = file_content .splitlines ()
162+ print ("starting and ending line " , self .starting_line , self .ending_line )
162163 if self .starting_line is not None and self .ending_line is not None :
163164 # Use line numbers if available (1-indexed to 0-indexed)
164165 function_content = "\n " .join (lines [self .starting_line - 1 : self .ending_line ])
@@ -460,7 +461,7 @@ def inspect_top_level_functions_or_methods(
460461 )
461462
462463
463- def check_optimization_status (functions_by_file : dict [Path , list [FunctionToOptimize ]]) -> list [tuple [str , str ]]:
464+ def check_optimization_status (functions_by_file : dict [Path , list [FunctionToOptimize ]], project_root_path : Path ) -> set [tuple [str , str ]]:
464465 """Check which functions have already been optimized and filter them out.
465466
466467 This function calls the optimization API to:
@@ -497,22 +498,21 @@ def check_optimization_status(functions_by_file: dict[Path, list[FunctionToOptim
497498 for func in functions :
498499 func_hash = func .get_code_context_hash ()
499500 # Use a unique path identifier that includes function info
500- path_key = f"{ file_path } :{ func .qualified_name } "
501- code_contexts [path_key ] = func_hash
502- path_to_function_map [path_key ] = (file_path , func )
501+ code_contexts .append ({"file_path" : Path (file_path ).relative_to (project_root_path ),
502+ "function_name" : func .qualified_name , "code_hash" : func_hash })
503503
504504 if not code_contexts :
505- return {}, 0
505+ return set ( tuple ())
506506
507507 try :
508508 result = is_function_being_optimized_again (owner , repo , pr_number , code_contexts )
509- already_optimized_paths : list [tuple [str , str ]] = result .get ("already_optimized_paths " , [])
510- return already_optimized_paths
509+ already_optimized_paths : list [tuple [str , str ]] = result .get ("already_optimized_tuples " , [])
510+ return set (( project_root_path / Path ( path [ 0 ]), path [ 1 ]) for path in already_optimized_paths )
511511
512512 except Exception as e :
513513 logger .warning (f"Failed to check optimization status: { e } " )
514514 # Return all functions if API call fails
515- return []
515+ return set ( tuple ())
516516
517517
518518def filter_functions (
@@ -625,6 +625,7 @@ def filter_functions(
625625 f"{ already_optimized_count } already optimized function{ 's' if already_optimized_count != 1 else '' } " : already_optimized_count ,
626626 f"{ blocklist_funcs_removed_count } function{ 's' if blocklist_funcs_removed_count != 1 else '' } as previously optimized" : blocklist_funcs_removed_count ,
627627 f"{ previous_checkpoint_functions_removed_count } function{ 's' if previous_checkpoint_functions_removed_count != 1 else '' } skipped from checkpoint" : previous_checkpoint_functions_removed_count ,
628+ f"{ already_optimized_paths_removed_count } function{ 's' if already_optimized_paths_removed_count != 1 else '' } as previously attempted optimization" : already_optimized_paths_removed_count ,
628629 }
629630 log_string = "\n " .join ([k for k , v in log_info .items () if v > 0 ])
630631 if log_string :
0 commit comments