88the 12.x backport line at ``cuda-bindings`` 12.9.6, and in the mainline 13.x
99series at ``cuda-bindings`` 13.2.0. This module decides which source to use
1010and normalizes generated docstrings so user-facing ``CUDAError`` messages stay
11- close to the long-form explanation prose .
11+ presentable .
1212
13- The cleanup rules here were derived while validating docstring-vs-dict parity
14- in PR #1805. Keep them narrow and remove them when codegen / fallback support is
15- no longer needed.
13+ The cleanup rules here were derived while validating generated enum docstrings
14+ in PR #1805. Keep them narrow and remove them when codegen quirks or fallback
15+ support are no longer needed.
1616"""
1717
1818from __future__ import annotations
@@ -43,25 +43,11 @@ def _binding_version_has_usable_enum_docstrings(version: tuple[int, int, int]) -
4343 )
4444
4545
46- def _strip_doxygen_double_colon_prefixes (s : str ) -> str :
47- """Remove Doxygen-style ``::`` before CUDA identifiers (not C++ ``Foo::Bar`` scope).
48-
49- The frozen fallback tables come from CUDA header comments and therefore use
50- Doxygen ``::name`` references. Generated enum ``__doc__`` text uses Sphinx
51- roles instead, so parity checks need a small amount of normalization.
52- """
53- prev = None
54- while prev != s :
55- prev = s
56- s = re .sub (r"(?<![A-Za-z0-9_])::+([A-Za-z_][A-Za-z0-9_]*)" , r"\1" , s )
57- return s
58-
59-
6046def _fix_hyphenation_wordwrap_spacing (s : str ) -> str :
6147 """Remove spaces around hyphens introduced by line wrapping in generated ``__doc__`` text.
6248
6349 This is a narrow workaround for wrapped forms such as ``non- linear`` that
64- otherwise differ from the single-line fallback prose .
50+ would otherwise look awkward in user-facing messages .
6551 """
6652 prev = None
6753 while prev != s :
@@ -74,10 +60,10 @@ def _fix_hyphenation_wordwrap_spacing(s: str) -> str:
7460def clean_enum_member_docstring (doc : str | None ) -> str | None :
7561 """Turn an enum member ``__doc__`` into plain text.
7662
77- The generated enum docstrings are already close to the fallback explanation
78- prose, but not byte-identical: they may contain Sphinx inline roles, line
79- wrapping, or a small known codegen defect. Normalize only those differences
80- so the text is suitable for user-facing error messages.
63+ The generated enum docstrings are already close to user-facing prose, but
64+ they may contain Sphinx inline roles, line wrapping, or a small known
65+ codegen defect. Normalize only those differences so the text is suitable
66+ for error messages.
8167 """
8268 if doc is None :
8369 return None
0 commit comments