Improve type checks under check-untyped-defs

This commit is contained in:
James R. Barlow
2026-07-07 14:51:56 -07:00
parent 12ec97f732
commit efebe9ca2e
4 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -446,7 +446,7 @@ class OcrGrafter:
self.pdf_base.close()
return self.output_file
def _parse_hocr_pages(self):
def _parse_hocr_pages(self) -> list[Fpdf2ParsedPage]:
"""Render all pages to multi-page PDF with shared fonts, then graft."""
from ocrmypdf.hocrtransform.hocr_parser import HocrParser
+1 -1
View File
@@ -464,7 +464,7 @@ class OcrOptions(BaseModel):
):
raise ValueError(
"Since you specified `--output-type none`, the output file "
f"{self.output_file} cannot be produced. Set the output file to "
f"{str(self.output_file)} cannot be produced. Set the output file to "
f"`-` to suppress this message."
)
return self
+1 -1
View File
@@ -21,7 +21,7 @@ class PluginOptionRegistry:
compatibility (e.g., options.tesseract_timeout).
"""
def __init__(self):
def __init__(self) -> None:
self._option_models: dict[str, type[BaseModel]] = {}
def register_option_model(
+2
View File
@@ -550,6 +550,8 @@ def main(): # pragma: no cover
pprint(pdfinfo)
for page in pdfinfo.pages:
pprint(page)
if page is None:
continue
for im in page.images:
pprint(im)