| 
1 | 1 | from __future__ import annotations  | 
2 | 2 | 
 
  | 
3 |  | -import time  | 
4 |  | - | 
5 | 3 | import json  | 
6 | 4 | import os  | 
7 | 5 | import platform  | 
 | 6 | +import time  | 
8 | 7 | from typing import TYPE_CHECKING, Any  | 
9 | 8 | 
 
  | 
10 | 9 | import requests  | 
@@ -122,7 +121,7 @@ def optimize_python_code(  | 
122 | 121 |             logger.info(f"Generated {len(optimizations_json)} candidates.")  | 
123 | 122 |             console.rule()  | 
124 | 123 |             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.")  | 
126 | 125 |             return [  | 
127 | 126 |                 OptimizedCandidate(  | 
128 | 127 |                     source_code=opt["source_code"],  | 
@@ -177,7 +176,7 @@ def optimize_python_code_line_profiler(  | 
177 | 176 | 
 
  | 
178 | 177 |         logger.info("Generating optimized candidates…")  | 
179 | 178 |         console.rule()  | 
180 |  | -        if line_profiler_results=="":  | 
 | 179 | +        if line_profiler_results == "":  | 
181 | 180 |             logger.info("No LineProfiler results were provided, Skipping optimization.")  | 
182 | 181 |             console.rule()  | 
183 | 182 |             return []  | 
@@ -209,7 +208,6 @@ def optimize_python_code_line_profiler(  | 
209 | 208 |         console.rule()  | 
210 | 209 |         return []  | 
211 | 210 | 
 
  | 
212 |  | - | 
213 | 211 |     def log_results(  | 
214 | 212 |         self,  | 
215 | 213 |         function_trace_id: str,  | 
@@ -272,9 +270,10 @@ def generate_regression_tests(  | 
272 | 270 |         - Dict[str, str] | None: The generated regression tests and instrumented tests, or None if an error occurred.  | 
273 | 271 | 
  | 
274 | 272 |         """  | 
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'"  | 
278 | 277 |         payload = {  | 
279 | 278 |             "source_code_being_tested": source_code_being_tested,  | 
280 | 279 |             "function_to_optimize": function_to_optimize,  | 
 | 
0 commit comments