style: auto-fix linting issues

This commit is contained in:
Claude 2026-02-19 12:18:56 +00:00 committed by claude[bot]
parent 95d4f10b95
commit 48c30f5ffe
6 changed files with 16 additions and 29 deletions

View file

@ -15,8 +15,7 @@ if TYPE_CHECKING:
from pathlib import Path
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
from codeflash.models.models import GeneratedTestsList, InvocationId
from codeflash.models.models import FunctionSource
from codeflash.models.models import FunctionSource, GeneratedTestsList, InvocationId
from codeflash.languages.language_enum import Language
from codeflash.models.function_types import FunctionParent
@ -540,11 +539,7 @@ class LanguageSupport(Protocol):
...
def postprocess_generated_tests(
self,
generated_tests: GeneratedTestsList,
test_framework: str,
project_root: Path,
source_file_path: Path,
self, generated_tests: GeneratedTestsList, test_framework: str, project_root: Path, source_file_path: Path
) -> GeneratedTestsList:
"""Apply language-specific postprocessing to generated tests.

View file

@ -1780,11 +1780,7 @@ class JavaScriptSupport:
return remove_test_functions(test_source, functions_to_remove)
def postprocess_generated_tests(
self,
generated_tests: GeneratedTestsList,
test_framework: str,
project_root: Path,
source_file_path: Path,
self, generated_tests: GeneratedTestsList, test_framework: str, project_root: Path, source_file_path: Path
) -> GeneratedTestsList:
"""Apply language-specific postprocessing to generated tests."""
from codeflash.languages.javascript.edit_tests import (
@ -1884,7 +1880,9 @@ class JavaScriptSupport:
key = test_qualified_name + "#" + abs_path_str
parts = inv_id.iteration_id.split("_").__len__() # type: ignore[union-attr]
cur_invid = inv_id.iteration_id.split("_")[0] if parts < 3 else "_".join(inv_id.iteration_id.split("_")[:-1]) # type: ignore[union-attr]
cur_invid = (
inv_id.iteration_id.split("_")[0] if parts < 3 else "_".join(inv_id.iteration_id.split("_")[:-1])
) # type: ignore[union-attr]
match_key = key + "#" + cur_invid
if match_key not in unique_inv_ids:
unique_inv_ids[match_key] = 0

View file

@ -1729,4 +1729,3 @@ def _format_references_as_markdown(references: list, file_path: Path, project_ro
fn_call_context += "\n```\n"
return fn_call_context

View file

@ -25,7 +25,7 @@ if TYPE_CHECKING:
from pathlib import Path
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
from codeflash.languages.base import Language, LanguageSupport
from codeflash.languages.base import LanguageSupport
from codeflash.models.models import CodeOptimizationContext, CodeStringsMarkdown, OptimizedCandidate, ValidCode
ASTNodeT = TypeVar("ASTNodeT", bound=ast.AST)
@ -600,9 +600,7 @@ def replace_function_definitions_for_language(
# Add any new global declarations from the optimized code to the original source
original_source_code = lang_support.add_global_declarations(
optimized_code=code_to_apply,
original_source=original_source_code,
module_abspath=module_abspath,
optimized_code=code_to_apply, original_source=original_source_code, module_abspath=module_abspath
)
# If we have function_to_optimize with line info and this is the main file, use it for precise replacement

View file

@ -658,11 +658,7 @@ class PythonSupport:
return test_source
def postprocess_generated_tests(
self,
generated_tests: GeneratedTestsList,
test_framework: str,
project_root: Path,
source_file_path: Path,
self, generated_tests: GeneratedTestsList, test_framework: str, project_root: Path, source_file_path: Path
) -> GeneratedTestsList:
"""Apply language-specific postprocessing to generated tests."""
_ = test_framework, project_root, source_file_path
@ -672,7 +668,9 @@ class PythonSupport:
self, generated_tests: GeneratedTestsList, functions_to_remove: list[str]
) -> GeneratedTestsList:
"""Remove specific test functions from generated tests."""
from codeflash.languages.python.static_analysis.edit_generated_tests import remove_functions_from_generated_tests
from codeflash.languages.python.static_analysis.edit_generated_tests import (
remove_functions_from_generated_tests,
)
return remove_functions_from_generated_tests(generated_tests, functions_to_remove)
@ -684,7 +682,9 @@ class PythonSupport:
tests_project_rootdir: Path | None = None,
) -> GeneratedTestsList:
"""Add runtime comments to generated tests."""
from codeflash.languages.python.static_analysis.edit_generated_tests import add_runtime_comments_to_generated_tests
from codeflash.languages.python.static_analysis.edit_generated_tests import (
add_runtime_comments_to_generated_tests,
)
return add_runtime_comments_to_generated_tests(
generated_tests, original_runtimes, optimized_runtimes, tests_project_rootdir

View file

@ -2069,10 +2069,7 @@ class FunctionOptimizer:
)
generated_tests = self.language_support.add_runtime_comments_to_generated_tests(
generated_tests,
original_runtime_by_test,
optimized_runtime_by_test,
self.test_cfg.tests_project_rootdir,
generated_tests, original_runtime_by_test, optimized_runtime_by_test, self.test_cfg.tests_project_rootdir
)
generated_tests_str = ""