docs: fix api ref package tables (#25400)

This commit is contained in:
Bagatur 2024-08-14 10:40:16 -07:00 committed by GitHub
parent 414154fa59
commit d178fb9dc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -319,8 +319,6 @@ def _construct_doc(
index_autosummary += f"""
:ref:`{module}`
{'^' * (len(module) + 5)}
.. autosummary::
"""
if classes:
@ -331,6 +329,11 @@ def _construct_doc(
.. autosummary::
:toctree: {module}
"""
index_autosummary += """
**Classes**
.. autosummary::
"""
for class_ in sorted(classes, key=lambda c: c["qualified_name"]):
@ -371,6 +374,14 @@ def _construct_doc(
{fstring}
"""
index_autosummary += f"""
**Functions**
.. autosummary::
{fstring}
"""
if deprecated_classes:
module_doc += f"""\
@ -382,6 +393,12 @@ def _construct_doc(
:toctree: {module}
"""
index_autosummary += """
**Deprecated classes*
.. autosummary::
"""
for class_ in sorted(deprecated_classes, key=lambda c: c["qualified_name"]):
if class_["kind"] == "TypedDict":
template = "typeddict.rst"
@ -401,6 +418,9 @@ def _construct_doc(
{class_["qualified_name"]}
"""
index_autosummary += f"""
{class_['qualified_name']}
"""
if deprecated_functions:
@ -417,6 +437,14 @@ def _construct_doc(
{fstring}
"""
index_autosummary += """
**Deprecated functions**
.. autosummary::
{fstring}
"""
docs.append((f"{module}.rst", module_doc))
docs.append(("index.rst", index_doc + index_autosummary))