MCPcopy Index your code
hub / github.com/python/cpython / fail_if_regression

Function fail_if_regression

Doc/tools/check-warnings.py:209–234  ·  view source on GitHub ↗

Ensure some files always pass Sphinx nit-picky mode (no missing references). These are files which are *not* in .nitignore.

(
    warnings: list[str],
    files_with_expected_nits: set[str],
    files_with_nits: set[str],
)

Source from the content-addressed store, hash-verified

207
208
209def fail_if_regression(
210 warnings: list[str],
211 files_with_expected_nits: set[str],
212 files_with_nits: set[str],
213) -> int:
214 """
215 Ensure some files always pass Sphinx nit-picky mode (no missing references).
216 These are files which are *not* in .nitignore.
217 """
218 all_rst = {
219 str(rst)
220 for rst in Path("Doc/").rglob("*.rst")
221 if rst.parts[1] not in EXCLUDE_SUBDIRS
222 }
223 should_be_clean = all_rst - files_with_expected_nits - EXCLUDE_FILES
224 problem_files = sorted(should_be_clean & files_with_nits)
225 if problem_files:
226 print("\nError: must not contain warnings:\n")
227 for filename in problem_files:
228 print(filename)
229 for warning in warnings:
230 if filename in warning:
231 if match := WARNING_PATTERN.fullmatch(warning):
232 print(" {line}: {msg}".format_map(match))
233 return -1
234 return 0
235
236
237def fail_if_improved(

Callers 1

mainFunction · 0.85

Calls 4

PathClass · 0.90
strFunction · 0.85
format_mapMethod · 0.80
rglobMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…