@@ -116,7 +116,7 @@ def get_warnings_by_file(warnings: list[dict]) -> dict[str, list[dict]]:
116
116
117
117
def get_unexpected_warnings (
118
118
files_with_expected_warnings : set [tuple [str , int ]],
119
- files_with_warnings : dict [ str , list [ dict ] ],
119
+ files_with_warnings : set [ FileWarnings ],
120
120
) -> int :
121
121
"""
122
122
Returns failure status if warnings discovered in list of warnings
@@ -146,7 +146,7 @@ def get_unexpected_warnings(
146
146
147
147
def get_unexpected_improvements (
148
148
files_with_expected_warnings : set [tuple [str , int ]],
149
- files_with_warnings : dict [ str , list [ dict ] ],
149
+ files_with_warnings : set [ FileWarnings ],
150
150
) -> int :
151
151
"""
152
152
Returns failure status if there are no warnings in the list of warnings
@@ -156,8 +156,7 @@ def get_unexpected_improvements(
156
156
for file in files_with_expected_warnings :
157
157
if file .name not in files_with_warnings .keys ():
158
158
unexpected_improvements .append (file )
159
- else :
160
- if len (files_with_warnings [file .name ]) < file .count :
159
+ elif len (files_with_warnings [file .name ]) < file .count :
161
160
unexpected_improvements .append (file )
162
161
163
162
if unexpected_improvements :
@@ -246,11 +245,11 @@ def main(argv: list[str] | None = None) -> int:
246
245
# Files with expected warnings are stored as a set of tuples
247
246
# where the first element is the file name and the second element
248
247
# is the number of warnings expected in that file
249
- files_with_expected_warnings = [
248
+ files_with_expected_warnings = {
250
249
FileWarnings (file .strip ().split ()[0 ], int (file .strip ().split ()[1 ]))
251
250
for file in clean_files
252
251
if file .strip () and not file .startswith ("#" )
253
- ]
252
+ }
254
253
255
254
with Path (args .compiler_output_file_path ).open (encoding = "UTF-8" ) as f :
256
255
compiler_output_file_contents = f .read ()
0 commit comments