8000 Update function signatures and make files with expected warnings list… · python/cpython@26b40d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26b40d3

Browse files
committed
Update function signatures and make files with expected warnings list a true set
1 parent cbf069b commit 26b40d3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Tools/build/check_warnings.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def get_warnings_by_file(warnings: list[dict]) -> dict[str, list[dict]]:
115115

116116
def get_unexpected_warnings(
117117
files_with_expected_warnings: set[tuple[str, int]],
118-
files_with_warnings: dict[str, list[dict]],
118+
files_with_warnings: set[FileWarnings],
119119
) -> int:
120120
"""
121121
Returns failure status if warnings discovered in list of warnings
@@ -145,7 +145,7 @@ def get_unexpected_warnings(
145145

146146
def get_unexpected_improvements(
147147
files_with_expected_warnings: set[tuple[str, int]],
148-
files_with_warnings: dict[str, list[dict]],
148+
files_with_warnings: set[FileWarnings],
149149
) -> int:
150150
"""
151151
Returns failure status if there are no warnings in the list of warnings
@@ -155,8 +155,7 @@ def get_unexpected_improvements(
155155
for file in files_with_expected_warnings:
156156
if file.name not in files_with_warnings.keys():
157157
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:
160159
unexpected_improvements.append(file)
161160

162161
if unexpected_improvements:
@@ -239,11 +238,11 @@ def main(argv: list[str] | None = None) -> int:
239238
# Files with expected warnings are stored as a set of tuples
240239
# where the first element is the file name and the second element
241240
# is the number of warnings expected in that file
242-
files_with_expected_warnings = [
241+
files_with_expected_warnings = {
243242
FileWarnings(file.strip().split()[0], int(file.strip().split()[1]))
244243
for file in clean_files
245244
if file.strip() and not file.startswith("#")
246-
]
245+
}
247246

248247
with Path(args.compiler_output_file_path).open(encoding="UTF-8") as f:
249248
compiler_output_file_contents = f.read()
31B0

0 commit comments

Comments
 (0)
0