Skip to content

Commit 27fb8eb

Browse files
authored
Merge branch 'main' into fix-formatter-during-runtime
2 parents 6b27835 + 309ec58 commit 27fb8eb

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

codeflash/api/aiservice.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from __future__ import annotations
22

3-
import time
4-
53
import json
64
import os
75
import platform
6+
import time
87
from typing import TYPE_CHECKING, Any
98

109
import requests
@@ -122,7 +121,7 @@ def optimize_python_code(
122121
logger.info(f"Generated {len(optimizations_json)} candidates.")
123122
console.rule()
124123
end_time = time.perf_counter()
125-
logger.debug(f"Optimization took {end_time - start_time:.2f} seconds.")
124+
logger.debug(f"Generating optimizations took {end_time - start_time:.2f} seconds.")
126125
return [
127126
OptimizedCandidate(
128127
source_code=opt["source_code"],
@@ -177,7 +176,7 @@ def optimize_python_code_line_profiler(
177176

178177
logger.info("Generating optimized candidates…")
179178
console.rule()
180-
if line_profiler_results=="":
179+
if line_profiler_results == "":
181180
logger.info("No LineProfiler results were provided, Skipping optimization.")
182181
console.rule()
183182
return []
@@ -209,7 +208,6 @@ def optimize_python_code_line_profiler(
209208
console.rule()
210209
return []
211210

212-
213211
def log_results(
214212
self,
215213
function_trace_id: str,
@@ -272,9 +270,10 @@ def generate_regression_tests(
272270
- Dict[str, str] | None: The generated regression tests and instrumented tests, or None if an error occurred.
273271
274272
"""
275-
assert test_framework in ["pytest", "unittest"], (
276-
f"Invalid test framework, got {test_framework} but expected 'pytest' or 'unittest'"
277-
)
273+
assert test_framework in [
274+
"pytest",
275+
"unittest",
276+
], f"Invalid test framework, got {test_framework} but expected 'pytest' or 'unittest'"
278277
payload = {
279278
"source_code_being_tested": source_code_being_tested,
280279
"function_to_optimize": function_to_optimize,

codeflash/cli_cmds/cmd_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ def enter_api_key_and_save_to_rc() -> None:
848848

849849

850850
def create_bubble_sort_file_and_test(args: Namespace) -> tuple[str, str]:
851-
bubble_sort_content = """def sorter(arr):
851+
bubble_sort_content = """def sorter(arr: list[int] | list[float]) -> list[int] | list[float]:
852852
for i in range(len(arr)):
853853
for j in range(len(arr) - 1):
854854
if arr[j] > arr[j + 1]:

0 commit comments

Comments
 (0)