1515 CodeContext ,
1616 FunctionFilterCriteria ,
1717 HelperFunction ,
18- Language ,
1918 ReferenceInfo ,
2019 TestInfo ,
2120 TestResult ,
2221)
22+ from codeflash .languages .language_enum import Language
2323from codeflash .languages .registry import register_language
2424from codeflash .models .function_types import FunctionParent
2525
@@ -48,8 +48,8 @@ def function_sources_to_helpers(sources: list[FunctionSource]) -> list[HelperFun
4848 qualified_name = fs .qualified_name ,
4949 file_path = fs .file_path ,
5050 source_code = fs .source_code ,
51- start_line = fs . jedi_definition . line if fs . jedi_definition else 1 ,
52- end_line = fs . jedi_definition . line if fs . jedi_definition else 1 ,
51+ start_line = getattr ( getattr ( fs , " jedi_definition" , None ), "line" , 1 ) ,
52+ end_line = getattr ( getattr ( fs , " jedi_definition" , None ), "line" , 1 ) ,
5353 )
5454 for fs in sources
5555 ]
@@ -119,7 +119,7 @@ def visit_FunctionDef(self, node: cst.FunctionDef) -> None:
119119 )
120120
121121
122- @register_language
122+ @register_language # type: ignore[arg-type] # PythonSupport satisfies LanguageSupport protocol structurally
123123class PythonSupport :
124124 """Python language support implementation.
125125
@@ -214,6 +214,7 @@ def load_coverage(
214214 ) -> Any :
215215 from codeflash .verification .coverage_utils import CoverageUtils
216216
217+ assert coverage_config_file is not None
217218 return CoverageUtils .load_from_sqlite_database (
218219 database_path = coverage_database_file ,
219220 config_path = coverage_config_file ,
@@ -854,7 +855,7 @@ def compare_test_results(
854855 candidate_results_path : Path ,
855856 project_root : Path | None = None ,
856857 project_classpath : str | None = None ,
857- ) -> tuple [bool , list ]:
858+ ) -> tuple [bool , list [ Any ] ]:
858859 """Compare test results between original and candidate code.
859860
860861 Args:
@@ -1017,7 +1018,7 @@ def instrument_source_for_line_profiler(
10171018 # This is handled through the existing infrastructure
10181019 return True
10191020
1020- def parse_line_profile_results (self , line_profiler_output_file : Path ) -> dict :
1021+ def parse_line_profile_results (self , line_profiler_output_file : Path ) -> dict [ str , Any ] :
10211022 """Parse line profiler output for Python.
10221023
10231024 Args:
@@ -1078,7 +1079,7 @@ def run_behavioral_tests(
10781079 from codeflash .code_utils .config_consts import TOTAL_LOOPING_TIME_EFFECTIVE
10791080 from codeflash .languages .python .static_analysis .coverage_utils import prepare_coverage_files
10801081 from codeflash .languages .python .test_runner import execute_test_subprocess
1081- from codeflash .models .models import TestType
1082+ from codeflash .models .test_type import TestType
10821083
10831084 blocklisted_plugins = ["benchmark" , "codspeed" , "xdist" , "sugar" ]
10841085
@@ -1110,7 +1111,7 @@ def run_behavioral_tests(
11101111 common_pytest_args .append (f"--timeout={ timeout } " )
11111112
11121113 result_file_path = get_run_tmp_file (Path ("pytest_results.xml" ))
1113- result_args = [f"--junitxml={ result_file_path . as_posix () } " , "-o" , "junit_logging=all" ]
1114+ result_args = [f"--junitxml={ result_file_path } " , "-o" , "junit_logging=all" ]
11141115
11151116 pytest_test_env = test_env .copy ()
11161117 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
@@ -1137,14 +1138,7 @@ def run_behavioral_tests(
11371138 shlex .split (f"{ SAFE_SYS_EXECUTABLE } -m coverage erase" ), cwd = cwd , env = pytest_test_env , timeout = 30
11381139 )
11391140 logger .debug (cov_erase )
1140- coverage_cmd = [
1141- SAFE_SYS_EXECUTABLE ,
1142- "-m" ,
1143- "coverage" ,
1144- "run" ,
1145- f"--rcfile={ coverage_config_file .as_posix ()} " ,
1146- "-m" ,
1147- ]
1141+ coverage_cmd = [SAFE_SYS_EXECUTABLE , "-m" , "coverage" , "run" , f"--rcfile={ coverage_config_file } " , "-m" ]
11481142 coverage_cmd .extend (self .pytest_cmd_tokens (IS_POSIX ))
11491143
11501144 blocklist_args = [f"-p no:{ plugin } " for plugin in blocklisted_plugins if plugin != "cov" ]
@@ -1201,7 +1195,7 @@ def run_benchmarking_tests(
12011195 pytest_args .append (f"--timeout={ timeout } " )
12021196
12031197 result_file_path = get_run_tmp_file (Path ("pytest_results.xml" ))
1204- result_args = [f"--junitxml={ result_file_path . as_posix () } " , "-o" , "junit_logging=all" ]
1198+ result_args = [f"--junitxml={ result_file_path } " , "-o" , "junit_logging=all" ]
12051199 pytest_test_env = test_env .copy ()
12061200 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
12071201 blocklist_args = [f"-p no:{ plugin } " for plugin in blocklisted_plugins ]
@@ -1243,7 +1237,7 @@ def run_line_profile_tests(
12431237 if timeout is not None :
12441238 pytest_args .append (f"--timeout={ timeout } " )
12451239 result_file_path = get_run_tmp_file (Path ("pytest_results.xml" ))
1246- result_args = [f"--junitxml={ result_file_path . as_posix () } " , "-o" , "junit_logging=all" ]
1240+ result_args = [f"--junitxml={ result_file_path } " , "-o" , "junit_logging=all" ]
12471241 pytest_test_env = test_env .copy ()
12481242 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
12491243 blocklist_args = [f"-p no:{ plugin } " for plugin in blocklisted_plugins ]
@@ -1258,7 +1252,7 @@ def run_line_profile_tests(
12581252
12591253 def generate_concolic_tests (
12601254 self , test_cfg : Any , project_root : Path , function_to_optimize : FunctionToOptimize , function_to_optimize_ast : Any
1261- ) -> tuple [dict , str ]:
1255+ ) -> tuple [dict [ str , Any ] , str ]:
12621256 import ast
12631257 import importlib .util
12641258 import subprocess
@@ -1281,7 +1275,7 @@ def generate_concolic_tests(
12811275 crosshair_available = importlib .util .find_spec ("crosshair" ) is not None
12821276
12831277 start_time = time .perf_counter ()
1284- function_to_concolic_tests : dict = {}
1278+ function_to_concolic_tests : dict [ str , Any ] = {}
12851279 concolic_test_suite_code = ""
12861280
12871281 if not crosshair_available :
0 commit comments