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

Function annotate_diff

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

Convert Sphinx warning messages to GitHub Actions for changed paragraphs. Converts lines like: .../Doc/library/cgi.rst:98: WARNING: reference target not found to: ::warning file=.../Doc/library/cgi.rst,line=98::reference target not found See: https://docs.githu

(
    warnings: list[str], ref_a: str = "main", ref_b: str = "HEAD"
)

Source from the content-addressed store, hash-verified

184
185
186def annotate_diff(
187 warnings: list[str], ref_a: str = "main", ref_b: str = "HEAD"
188) -> None:
189 """
190 Convert Sphinx warning messages to GitHub Actions for changed paragraphs.
191
192 Converts lines like:
193 .../Doc/library/cgi.rst:98: WARNING: reference target not found
194 to:
195 ::warning file=.../Doc/library/cgi.rst,line=98::reference target not found
196
197 See:
198 https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message
199 """
200 warnings_touched = process_touched_warnings(warnings, ref_a, ref_b)
201 print("Emitting doc warnings matching modified lines:")
202 for warning in warnings_touched:
203 print("::warning file={file},line={line}::{msg}".format_map(warning))
204 print(warning[0])
205 if not warnings_touched:
206 print("None")
207
208
209def fail_if_regression(

Callers 1

mainFunction · 0.85

Calls 2

process_touched_warningsFunction · 0.85
format_mapMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…