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