1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Enforce strict Pyright gate

This commit is contained in:
Andraxion 2026-07-24 22:26:01 -04:00
parent 90898cfd63
commit 2841042b9c
16 changed files with 214 additions and 77 deletions

View file

@ -3,6 +3,7 @@
from __future__ import annotations
from pathlib import Path
from typing import cast
from .config_validation import ID_PATTERN, confined_path, require_string, string_list
from .errors import DocForgeError
@ -33,6 +34,7 @@ def load_render_config(
return None
if not isinstance(document, dict):
raise DocForgeError("invalid_config", "render must be a table")
document = cast(dict[str, object], document)
unknown = sorted(set(document) - _RENDER_KEYS)
if unknown:
raise DocForgeError("invalid_config", "render has unknown fields", fields=unknown)
@ -65,14 +67,16 @@ def load_render_config(
view_documents = document.get("views")
if not isinstance(view_documents, list) or not view_documents:
raise DocForgeError("invalid_config", "render.views must contain at least one view")
if len(view_documents) > limits.max_render_views:
view_values = cast(list[object], view_documents)
if len(view_values) > limits.max_render_views:
raise DocForgeError("invalid_config", "render.views exceeds the configured limit")
views: list[RenderView] = []
view_ids: set[str] = set()
output_paths: set[Path] = set()
for view_document in view_documents:
if not isinstance(view_document, dict):
for view_value in view_values:
if not isinstance(view_value, dict):
raise DocForgeError("invalid_config", "Each render view must be a table")
view_document = cast(dict[str, object], view_value)
unknown_view = sorted(set(view_document) - _VIEW_KEYS)
if unknown_view:
raise DocForgeError(