Skip to content

Commit 09ac28a

Browse files
committed
add linter flag removal to conf.py docstring rendering
1 parent 971b9b6 commit 09ac28a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/source/conf.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# For the full list of built-in configuration values, see the documentation:
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

6+
import re
7+
68
# -- Project information -----------------------------------------------------
79
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
810

@@ -38,3 +40,15 @@
3840

3941
html_theme = "furo"
4042
html_static_path = ["_static"]
43+
44+
45+
# remove linter flags from rendered docstrings
46+
47+
def remove_linter_flags(app, what, name, obj, options, lines):
48+
for index, line in enumerate(lines):
49+
if "# noqa" in line or "# no-cython-lint" in line:
50+
lines[index] = line.split("#")[0].rstrip()
51+
52+
53+
def setup(app):
54+
app.connect("autodoc-process-docstring", remove_linter_flags)

0 commit comments

Comments
 (0)