Skip to content

Commit a1eee7d

Browse files
committed
cleanup
1 parent 3dde686 commit a1eee7d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

codeflash/benchmarking/function_ranker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
}
2424
pytest_func_patterns = {"pytest_", "_pytest", "runtest"}
2525

26+
2627
def is_pytest_infrastructure(filename: str, function_name: str) -> bool:
2728
"""Check if a function is part of pytest infrastructure that should be excluded from ranking.
2829

codeflash/optimization/optimizer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,23 @@ def rank_all_functions_globally(
373373
file_path = func_to_file_map.get(key)
374374
if file_path:
375375
globally_ranked.append((file_path, func))
376+
376377
console.rule()
377378
logger.info(
378379
f"Globally ranked {len(ranked_functions)} functions by ttX score "
379380
f"(filtered {len(functions_only) - len(ranked_functions)} low-importance functions)"
380381
)
381382

383+
# Display ranking table for user visibility
382384
self.display_global_ranking(globally_ranked, ranker)
383385
console.rule()
384386

385-
return globally_ranked
386-
387387
except Exception as e:
388388
logger.warning(f"Could not perform global ranking: {e}")
389389
logger.debug("Falling back to original function order")
390390
return all_functions
391+
else:
392+
return globally_ranked
391393

392394
def run(self) -> None:
393395
from codeflash.code_utils.checkpoint import CodeflashRunCheckpoint
@@ -494,7 +496,7 @@ def run(self) -> None:
494496
)
495497
self.patch_files.append(patch_path)
496498
if i < len(globally_ranked_functions) - 1:
497-
next_file, next_func = globally_ranked_functions[i + 1]
499+
_, next_func = globally_ranked_functions[i + 1]
498500
create_worktree_snapshot_commit(
499501
self.current_worktree, f"Optimizing {next_func.qualified_name}"
500502
)

0 commit comments

Comments
 (0)