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

Function patch_pairindextypes

Doc/tools/extensions/pyspecific.py:97–118  ·  view source on GitHub ↗

Remove all entries from ``pairindextypes`` before writing POT files. We want to run this just before writing output files, as the check to circumvent is in ``I18nBuilder.write_doc()``. As such, we link this to ``env-check-consistency``, even though it has nothing to do with the envi

(app, _env)

Source from the content-addressed store, hash-verified

95
96
97def patch_pairindextypes(app, _env) -> None:
98 """Remove all entries from ``pairindextypes`` before writing POT files.
99
100 We want to run this just before writing output files, as the check to
101 circumvent is in ``I18nBuilder.write_doc()``.
102 As such, we link this to ``env-check-consistency``, even though it has
103 nothing to do with the environment consistency check.
104 """
105 if app.builder.name != 'gettext':
106 return
107
108 # allow translating deprecated index entries
109 try:
110 from sphinx.domains.python import pairindextypes
111 except ImportError:
112 pass
113 else:
114 # Sphinx checks if a 'pair' type entry on an index directive is one of
115 # the Sphinx-translated pairindextypes values. As we intend to move
116 # away from this, we need Sphinx to believe that these values don't
117 # exist, by deleting them when using the gettext builder.
118 pairindextypes.clear()
119
120
121def setup(app):

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…