Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions codeflash/api/aiservice.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from __future__ import annotations

import time

import json
import os
import platform
import time
from typing import TYPE_CHECKING, Any

import requests
Expand Down Expand Up @@ -122,7 +121,7 @@ def optimize_python_code(
logger.info(f"Generated {len(optimizations_json)} candidates.")
console.rule()
end_time = time.perf_counter()
logger.debug(f"Optimization took {end_time - start_time:.2f} seconds.")
logger.debug(f"Generating optimizations took {end_time - start_time:.2f} seconds.")
return [
OptimizedCandidate(
source_code=opt["source_code"],
Expand Down Expand Up @@ -177,7 +176,7 @@ def optimize_python_code_line_profiler(

logger.info("Generating optimized candidates…")
console.rule()
if line_profiler_results=="":
if line_profiler_results == "":
logger.info("No LineProfiler results were provided, Skipping optimization.")
console.rule()
return []
Expand Down Expand Up @@ -209,7 +208,6 @@ def optimize_python_code_line_profiler(
console.rule()
return []


def log_results(
self,
function_trace_id: str,
Expand Down Expand Up @@ -272,9 +270,10 @@ def generate_regression_tests(
- Dict[str, str] | None: The generated regression tests and instrumented tests, or None if an error occurred.

"""
assert test_framework in ["pytest", "unittest"], (
f"Invalid test framework, got {test_framework} but expected 'pytest' or 'unittest'"
)
assert test_framework in [
"pytest",
"unittest",
], f"Invalid test framework, got {test_framework} but expected 'pytest' or 'unittest'"
payload = {
"source_code_being_tested": source_code_being_tested,
"function_to_optimize": function_to_optimize,
Expand Down
Loading