Skip to content

Commit 0325444

Browse files
author
Codeflash Bot
committed
logging fix
1 parent 83814be commit 0325444

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

codeflash/optimization/function_optimizer.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ def determine_best_candidate(
617617
trace_id=self.function_trace_id[:-4] + exp_type,
618618
optimization_id=candidate.optimization_id,
619619
passed="no",
620-
faster="no", # this also may or may not pass
620+
faster="no",
621621
)
622622
console.rule()
623623
continue
@@ -632,7 +632,7 @@ def determine_best_candidate(
632632
trace_id=self.function_trace_id[:-4] + exp_type,
633633
optimization_id=candidate.optimization_id,
634634
passed="no",
635-
faster="no", # this also may or may not pass
635+
faster="no",
636636
)
637637
continue
638638
# check if this code has been evaluated before by checking the ast normalized code string
@@ -668,8 +668,11 @@ def determine_best_candidate(
668668
optimization_id=candidate.optimization_id,
669669
passed="yes" if is_correct[candidate.optimization_id] else "no",
670670
faster="yes"
671-
if speedup_ratios[candidate.optimization_id] > 0
672-
else "no", # this also may or may not pass
671+
if (
672+
speedup_ratios[candidate.optimization_id] is not None
673+
and speedup_ratios[candidate.optimization_id] > 0
674+
)
675+
else "no",
673676
)
674677
continue
675678
ast_code_to_id[normalized_code] = {
@@ -847,8 +850,11 @@ def determine_best_candidate(
847850
optimization_id=candidate.optimization_id,
848851
passed="yes" if is_correct[candidate.optimization_id] else "no",
849852
faster="yes"
850-
if speedup_ratios[candidate.optimization_id] > 0
851-
else "no", # this also may or may not pass
853+
if (
854+
speedup_ratios[candidate.optimization_id] is not None
855+
and speedup_ratios[candidate.optimization_id] > 0
856+
)
857+
else "no",
852858
)
853859
except KeyboardInterrupt as e:
854860
logger.exception(f"Optimization interrupted: {e}")

0 commit comments

Comments
 (0)