add factory return and ignore options type
Some checks failed
Run Docs CI / build-docs (push) Failing after 1m26s
Run CI / code-checks (push) Failing after 6m36s

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
Michele Dolfi 2025-03-18 12:37:40 +01:00
parent b2021ac8d8
commit fdaa53a618
2 changed files with 5 additions and 3 deletions

View File

@ -410,7 +410,7 @@ def convert(
export_doctags = OutputFormat.DOCTAGS in to_formats
ocr_factory = get_ocr_factory(allow_external_plugins=allow_external_plugins)
ocr_options: OcrOptions = ocr_factory.create_options(
ocr_options: OcrOptions = ocr_factory.create_options( # type: ignore
kind=ocr_engine,
force_full_page_ocr=force_ocr,
)

View File

@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
@lru_cache()
def get_ocr_factory(allow_external_plugins: bool = False):
def get_ocr_factory(allow_external_plugins: bool = False) -> OcrFactory:
factory = OcrFactory()
factory.load_from_plugins(allow_external_plugins=allow_external_plugins)
logger.info("Registered ocr engines: %r", factory.registered_kind)
@ -18,7 +18,9 @@ def get_ocr_factory(allow_external_plugins: bool = False):
@lru_cache()
def get_picture_description_factory(allow_external_plugins: bool = False):
def get_picture_description_factory(
allow_external_plugins: bool = False,
) -> PictureDescriptionFactory:
factory = PictureDescriptionFactory()
factory.load_from_plugins(allow_external_plugins=allow_external_plugins)
logger.info("Registered picture descriptions: %r", factory.registered_kind)