2222from codeflash .result .critic import performance_gain
2323
2424if TYPE_CHECKING :
25- from codeflash .models .models import FunctionCalledInTest
25+ from codeflash .models .models import FunctionCalledInTest , InvocationId
2626 from codeflash .result .explanation import Explanation
2727 from codeflash .verification .verification_utils import TestConfig
2828
@@ -31,8 +31,8 @@ def existing_tests_source_for(
3131 function_qualified_name_with_modules_from_root : str ,
3232 function_to_tests : dict [str , set [FunctionCalledInTest ]],
3333 test_cfg : TestConfig ,
34- original_runtimes_all : dict ,
35- optimized_runtimes_all : dict ,
34+ original_runtimes_all : dict [ InvocationId , list [ int ]] ,
35+ optimized_runtimes_all : dict [ InvocationId , list [ int ]] ,
3636) -> str :
3737 test_files = function_to_tests .get (function_qualified_name_with_modules_from_root )
3838 if not test_files :
@@ -41,8 +41,8 @@ def existing_tests_source_for(
4141 tests_root = test_cfg .tests_root
4242 module_root = test_cfg .project_root_path
4343 rel_tests_root = tests_root .relative_to (module_root )
44- original_tests_to_runtimes = {}
45- optimized_tests_to_runtimes = {}
44+ original_tests_to_runtimes : dict [ Path , dict [ str , int ]] = {}
45+ optimized_tests_to_runtimes : dict [ Path , dict [ str , int ]] = {}
4646 non_generated_tests = set ()
4747 for test_file in test_files :
4848 non_generated_tests .add (Path (test_file .tests_in_file .test_file ).relative_to (tests_root ))
@@ -59,18 +59,18 @@ def existing_tests_source_for(
5959 if rel_path not in optimized_tests_to_runtimes :
6060 optimized_tests_to_runtimes [rel_path ] = {}
6161 qualified_name = (
62- invocation_id .test_class_name + "." + invocation_id .test_function_name
62+ invocation_id .test_class_name + "." + invocation_id .test_function_name # type: ignore[operator]
6363 if invocation_id .test_class_name
6464 else invocation_id .test_function_name
6565 )
6666 if qualified_name not in original_tests_to_runtimes [rel_path ]:
67- original_tests_to_runtimes [rel_path ][qualified_name ] = 0
67+ original_tests_to_runtimes [rel_path ][qualified_name ] = 0 # type: ignore[index]
6868 if qualified_name not in optimized_tests_to_runtimes [rel_path ]:
69- optimized_tests_to_runtimes [rel_path ][qualified_name ] = 0
69+ optimized_tests_to_runtimes [rel_path ][qualified_name ] = 0 # type: ignore[index]
7070 if invocation_id in original_runtimes_all :
71- original_tests_to_runtimes [rel_path ][qualified_name ] += min (original_runtimes_all [invocation_id ])
71+ original_tests_to_runtimes [rel_path ][qualified_name ] += min (original_runtimes_all [invocation_id ]) # type: ignore[index]
7272 if invocation_id in optimized_runtimes_all :
73- optimized_tests_to_runtimes [rel_path ][qualified_name ] += min (optimized_runtimes_all [invocation_id ])
73+ optimized_tests_to_runtimes [rel_path ][qualified_name ] += min (optimized_runtimes_all [invocation_id ]) # type: ignore[index]
7474 # parse into string
7575 all_rel_paths = (
7676 original_tests_to_runtimes .keys ()
0 commit comments