Restructured text fixes so that pydoctor would return without an error

This commit is contained in:
Julian Stirling 2025-07-09 23:55:46 +01:00
parent 58b056988a
commit a84a916719
31 changed files with 269 additions and 256 deletions

View file

@ -18,7 +18,7 @@ def set_shutdown_function(shutdown_function: Callable[[], None]):
Ensure a function is called before the shutdown
This monkey patches the Uvicorn Server's handle_exit. This is needed because
the uvicorn `lifecycle` events and FastAPI `shutdown` events only fire once
the uvicorn ``lifecycle`` events and FastAPI ``shutdown`` events only fire once
background tasks have completed.
Without this the system exits cleanly only if no client is receiving a
@ -26,9 +26,8 @@ def set_shutdown_function(shutdown_function: Callable[[], None]):
send streaming responses.
:param shutdown_function: A callable with no arguments or outputs. This
should stop any async generators that may be sending to streaming responses.
should stop any async generators that may be sending to streaming responses.
"""
original_handler = Server.handle_exit
@wraps(Server.handle_exit)
@ -58,7 +57,6 @@ def _get_scans_dir(config: dict) -> Optional[str]:
Return is None if there is no /smart_scan/ thing loaded.
"""
if "/smart_scan/" in config["things"]:
try:
return config["things"]["/smart_scan/"]["kwargs"]["scans_folder"]

View file

@ -10,8 +10,8 @@ THIS_DIR = os.path.dirname(os.path.abspath(__file__))
def add_static_file(app: FastAPI, fname: str, folder: str) -> None:
"""Add a single file to the root of the FastAPI app
The file with name `fname` will be mounted at `/fname` - the
`folder` does not affect where it is mounted in the app.
The file with name ``fname`` will be mounted at ``/fname`` - the
``folder`` does not affect where it is mounted in the app.
app: The FastAPI app to add to, in this case the OpenFlexure server
fname: the name of the file to add