Skip to content

Commit abf341b

Browse files
committed
typehints + formatting
1 parent 4b0ef1c commit abf341b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

docs/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
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+
from __future__ import annotations
7+
68
import os
79
import sys
810

11+
from sphinx.application import Sphinx
12+
913
# Add the src directory to the path so we can import the package
1014
sys.path.insert(0, os.path.abspath("../src"))
1115

@@ -55,7 +59,7 @@
5559
autodoc_typehints_description_target = "documented"
5660

5761

58-
def _inject_type_submodules(app, docname, source):
62+
def _inject_type_submodules(_app: Sphinx, docname: str, source: list[str]) -> None:
5963
"""Auto-generate automodule directives for all type submodules.
6064
6165
Replaces the ``.. auto-all-types::`` placeholder in types.rst with
@@ -70,23 +74,19 @@ def _inject_type_submodules(app, docname, source):
7074

7175
import runloop_api_client.types as types_pkg
7276

73-
directives = []
77+
directives: list[str] = []
7478
for _, modname, ispkg in sorted(
7579
pkgutil.walk_packages(types_pkg.__path__, types_pkg.__name__ + "."),
7680
key=lambda x: x[1],
7781
):
7882
if ispkg:
7983
continue
80-
directives.append(
81-
f".. automodule:: {modname}\n"
82-
f" :members:\n"
83-
f" :undoc-members:\n"
84-
)
84+
directives.append(f".. automodule:: {modname}\n :members:\n :undoc-members:\n")
8585
source[0] = source[0].replace(".. auto-all-types::", "\n".join(directives))
8686

8787

88-
def setup(app):
89-
app.connect("source-read", _inject_type_submodules)
88+
def setup(app: Sphinx) -> None:
89+
app.connect("source-read", _inject_type_submodules) # pyright: ignore[reportUnknownMemberType]
9090

9191

9292
# Intersphinx mapping

0 commit comments

Comments
 (0)