docs: avoid "Alias for field number ..." entries in namedtuples

pull/650/head
Ryan Barrett 2023-10-01 10:21:12 -07:00
rodzic ce15b8c149
commit 88f4c79db5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -10,9 +10,10 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import collections
import os
import sys
import sphinx_rtd_theme
# If extensions (or modules to document with autodoc) are in another directory,
@ -353,3 +354,17 @@ intersphinx_mapping = {
'urllib3': ('https://urllib3.readthedocs.io/en/latest', None),
'werkzeug': ('https://werkzeug.palletsprojects.com/en/latest/', None),
}
# -- Post process ------------------------------------------------------------
def remove_namedtuple_attrib_docstring(app, what, name, obj, skip, options):
"""Removes `Alias for field number ...` entries from namedtuple generated docs.
https://stackoverflow.com/a/70459782/186123
"""
if type(obj) is collections._tuplegetter:
return True
return skip
def setup(app):
app.connect('autodoc-skip-member', remove_namedtuple_attrib_docstring)