22
22
from codeflash .result .critic import performance_gain
23
23
24
24
if TYPE_CHECKING :
25
- from codeflash .models .models import FunctionCalledInTest
25
+ from codeflash .models .models import FunctionCalledInTest , InvocationId
26
26
from codeflash .result .explanation import Explanation
27
27
from codeflash .verification .verification_utils import TestConfig
28
28
@@ -31,8 +31,8 @@ def existing_tests_source_for(
31
31
function_qualified_name_with_modules_from_root : str ,
32
32
function_to_tests : dict [str , set [FunctionCalledInTest ]],
33
33
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 ]] ,
36
36
) -> str :
37
37
test_files = function_to_tests .get (function_qualified_name_with_modules_from_root )
38
38
if not test_files :
@@ -41,8 +41,8 @@ def existing_tests_source_for(
41
41
tests_root = test_cfg .tests_root
42
42
module_root = test_cfg .project_root_path
43
43
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 ]] = {}
46
46
non_generated_tests = set ()
47
47
for test_file in test_files :
48
48
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(
59
59
if rel_path not in optimized_tests_to_runtimes :
60
60
optimized_tests_to_runtimes [rel_path ] = {}
61
61
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]
63
63
if invocation_id .test_class_name
64
64
else invocation_id .test_function_name
65
65
)
66
66
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]
68
68
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]
70
70
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]
72
72
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]
74
74
# parse into string
75
75
all_rel_paths = (
76
76
original_tests_to_runtimes .keys ()
0 commit comments