8000 Merge branch 'add-warning-count-to-warning-ignore-files' into add-war… · python/cpython@ef9ac02 · GitHub
[go: up one dir, main page]

Skip to content

Commit ef9ac02

Browse files
committed
Merge branch 'add-warning-count-to-warning-ignore-files' into add-warning-options-and-include-in-check-warnings
2 parents d351928 + 26b40d3 commit ef9ac02

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Tools/build/check_warnings.py

< 10000 div class="d-flex flex-row flex-justify-end flex-1 flex-order-1 flex-sm-order-2 flex-items-center">
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def get_warnings_by_file(warnings: list[dict]) -> dict[str, list[dict]]:
116116

117117
def get_unexpected_warnings(
118118
files_with_expected_warnings: set[tuple[str, int]],
119-
files_with_warnings: dict[str, list[dict]],
119+
files_with_warnings: set[FileWarnings],
120120
) -> int:
121121
"""
122122
Returns failure status if warnings discovered in list of warnings
@@ -146,7 +146,7 @@ def get_unexpected_warnings(
146146

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

163162
if unexpected_improvements:
@@ -246,11 +245,11 @@ def main(argv: list[str] | None = None) -> int:
246245
# Files with expected warnings are stored as a set of tuples
247246
# where the first element is the file name and the second element
248247
# is the number of warnings expected in that file
249-
files_with_expected_warnings = [
248+
files_with_expected_warnings = {
250249
FileWarnings(file.strip().split()[0], int(file.strip().split()[1]))
251250
for file in clean_files
252251
if file.strip() and not file.startswith("#")
253-
]
252+
}
254253

255254
with Path(args.compiler_output_file_path).open(encoding="UTF-8") as f:
256255
compiler_output_file_contents = f.read()

0 commit comments

Comments
 (0)
0