Skip to content

Commit 4560b8b

Browse files
authored
Merge branch 'main' into trace-and-optimize
2 parents e2e6803 + a54be51 commit 4560b8b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ def collect_setup_info() -> SetupInfo:
231231
info_panel = Panel(
232232
Text(
233233
"📁 Let's identify your Python module directory.\n\n"
234-
"This is usually the top-level directory containing all your Python source code.\n"
235-
"We've automatically detected some directories for you.",
234+
"This is usually the top-level directory containing all your Python source code.\n",
236235
style="cyan",
237236
),
238237
title="🔍 Module Discovery",
@@ -936,7 +935,6 @@ def configure_pyproject_toml(setup_info: SetupInfo) -> None:
936935
codeflash_section["module-root"] = setup_info.module_root
937936
codeflash_section["tests-root"] = setup_info.tests_root
938937
codeflash_section["test-framework"] = setup_info.test_framework
939-
codeflash_section["benchmarks-root"] = setup_info.benchmarks_root if setup_info.benchmarks_root else ""
940938
codeflash_section["ignore-paths"] = setup_info.ignore_paths
941939
codeflash_section["disable-telemetry"] = not enable_telemetry
942940
if setup_info.git_remote not in ["", "origin"]:

codeflash/discovery/functions_to_optimize.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from codeflash.telemetry.posthog_cf import ph
3131

3232
if TYPE_CHECKING:
33+
from argparse import Namespace
34+
3335
from libcst import CSTNode
3436
from libcst.metadata import CodeRange
3537

@@ -452,7 +454,7 @@ def inspect_top_level_functions_or_methods(
452454

453455

454456
def was_function_previously_optimized(
455-
function_to_optimize: FunctionToOptimize, code_context: CodeOptimizationContext
457+
function_to_optimize: FunctionToOptimize, code_context: CodeOptimizationContext, args: Namespace
456458
) -> bool:
457459
"""Check which functions have already been optimized and filter them out.
458460
@@ -474,7 +476,7 @@ def was_function_previously_optimized(
474476
owner, repo = None, None
475477
pr_number = get_pr_number()
476478

477-
if not owner or not repo or pr_number is None:
479+
if not owner or not repo or pr_number is None or getattr(args, "no_pr", False):
478480
return False
479481

480482
code_contexts = []

codeflash/optimization/function_optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def can_be_optimized(self) -> Result[tuple[bool, CodeOptimizationContext, dict[P
170170
# last time we could not find an optimization, maybe this time we do.
171171
# Random is before as a performance optimization, swapping the two 'and' statements has the same effect
172172
if random.random() > REPEAT_OPTIMIZATION_PROBABILITY and was_function_previously_optimized( # noqa: S311
173-
self.function_to_optimize, code_context
173+
self.function_to_optimize, code_context, self.args
174174
):
175175
return Failure("Function optimization previously attempted, skipping.")
176176

0 commit comments

Comments
 (0)