Skip to content

Commit bab3bd4

Browse files
style: auto-fix linting issues
1 parent 202bdc4 commit bab3bd4

5 files changed

Lines changed: 20 additions & 19 deletions

File tree

codeflash/languages/javascript/parse.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
from junitparser.xunit2 import JUnitXml
1717

1818
from codeflash.cli_cmds.console import logger
19-
from codeflash.models.models import (
20-
FunctionTestInvocation,
21-
InvocationId,
22-
TestResults,
23-
TestType,
24-
)
19+
from codeflash.models.models import FunctionTestInvocation, InvocationId, TestResults, TestType
2520

2621
if TYPE_CHECKING:
2722
import subprocess

codeflash/languages/javascript/test_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,9 @@ def run_jest_behavioral_tests(
638638
)
639639
logger.debug(f"Jest result: returncode={result.returncode}")
640640
logger.warning(f"[JEST DEBUG] returncode={result.returncode}")
641-
logger.warning(f"[JEST DEBUG] Jest stdout (first 500 chars): {result.stdout[:500] if result.stdout else '(empty)'}")
641+
logger.warning(
642+
f"[JEST DEBUG] Jest stdout (first 500 chars): {result.stdout[:500] if result.stdout else '(empty)'}"
643+
)
642644
# Log Jest output at WARNING level if tests fail and no XML output will be created
643645
# This helps debug issues like import errors that cause Jest to fail early
644646
if result.returncode != 0 and not result_file_path.exists():

codeflash/optimization/function_optimizer.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,14 @@ def _handle_empty_queue(self) -> CandidateNode | None:
311311
lambda: setattr(self, "line_profiler_done", True),
312312
)
313313
if len(self.future_all_code_repair) > 0:
314-
return self._process_candidates(
314+
result = self._process_candidates(
315315
self.future_all_code_repair,
316316
"Repairing {0} candidates",
317317
"Added {0} candidates from repair, total candidates now: {1}",
318-
lambda: self.future_all_code_repair.clear(),
318+
None,
319319
)
320+
self.future_all_code_repair.clear()
321+
return result
320322
if self.line_profiler_done and not self.refinement_done:
321323
return self._process_candidates(
322324
self.future_all_refinements,
@@ -326,12 +328,14 @@ def _handle_empty_queue(self) -> CandidateNode | None:
326328
filter_candidates_func=self._filter_refined_candidates,
327329
)
328330
if len(self.future_adaptive_optimizations) > 0:
329-
return self._process_candidates(
331+
result = self._process_candidates(
330332
self.future_adaptive_optimizations,
331333
"Applying adaptive optimizations to {0} candidates",
332334
"Added {0} candidates from adaptive optimization, total candidates now: {1}",
333-
lambda: self.future_adaptive_optimizations.clear(),
335+
None,
334336
)
337+
self.future_adaptive_optimizations.clear()
338+
return result
335339
return None # All done
336340

337341
def _process_candidates(
@@ -596,9 +600,11 @@ def generate_and_instrument_tests(
596600
logger.debug(f"[PIPELINE] Wrote behavioral test to {generated_test.behavior_file_path}")
597601

598602
# Save perf test source for debugging
599-
with open("/tmp/codeflash_perf_test_debug.test.ts", "w", encoding="utf-8") as debug_f:
600-
debug_f.write(generated_test.instrumented_perf_test_source)
601-
logger.warning(f"[PERF DEBUG] Saved perf test to /tmp/codeflash_perf_test_debug.test.ts for inspection")
603+
from pathlib import Path
604+
605+
debug_path = Path("/tmp/codeflash_perf_test_debug.test.ts") # noqa: S108
606+
debug_path.write_text(generated_test.instrumented_perf_test_source, encoding="utf-8")
607+
logger.warning("[PERF DEBUG] Saved perf test to /tmp/codeflash_perf_test_debug.test.ts for inspection")
602608

603609
with generated_test.perf_file_path.open("w", encoding="utf8") as f:
604610
f.write(generated_test.instrumented_perf_test_source)
@@ -2098,7 +2104,7 @@ def process_review(
20982104
formatted_generated_test = format_generated_code(concolic_test_str, self.args.formatter_cmds)
20992105
generated_tests_str += f"```{code_lang}\n{formatted_generated_test}\n```\n\n"
21002106

2101-
existing_tests, replay_tests, concolic_tests = existing_tests_source_for(
2107+
existing_tests, replay_tests, _ = existing_tests_source_for(
21022108
self.function_to_optimize.qualified_name_with_modules_from_root(self.project_root),
21032109
function_to_all_tests,
21042110
test_cfg=self.test_cfg,

codeflash/verification/verifier.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ def generate_tests(
5757
rel_import_path = f"./{rel_import_path}"
5858
# Keep as string since Path() normalizes away the ./ prefix
5959
module_path = rel_import_path
60-
logger.warning(
61-
f"[IMPORT FIX] test_path={test_path}, source={source_file_abs}, rel_import={rel_import_path}"
62-
)
60+
logger.warning(f"[IMPORT FIX] test_path={test_path}, source={source_file_abs}, rel_import={rel_import_path}")
6361

6462
logger.warning(f"[IMPORT FIX] Passing module_path to AI service: '{module_path}'")
6563
response = aiservice_client.generate_regression_tests(

codeflash/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# These version placeholders will be replaced by uv-dynamic-versioning during build.
2-
__version__ = "0.20.0"
2+
__version__ = "0.20.0.post483.dev0+202bdc4d"

0 commit comments

Comments
 (0)