From 2632feeb75cf1357bfa213079636fcbbc6f45756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Fabr=C3=A9gat?= Date: Tue, 8 Apr 2025 18:17:15 +0200 Subject: [PATCH] fix for the (dumb) MyPy type checker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Joan Fabrégat --- docling/pipeline/standard_pdf_pipeline.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docling/pipeline/standard_pdf_pipeline.py b/docling/pipeline/standard_pdf_pipeline.py index 239d2b43..ae2d918d 100644 --- a/docling/pipeline/standard_pdf_pipeline.py +++ b/docling/pipeline/standard_pdf_pipeline.py @@ -2,7 +2,7 @@ import logging import sys import warnings from pathlib import Path -from typing import Optional +from typing import Optional, cast from docling_core.types.doc import DocItem, ImageRef, PictureItem, TableItem @@ -227,7 +227,8 @@ class StandardPdfPipeline(PaginatedPipeline): ): page_ix = element.prov[0].page_no - 1 page = next( - (p for p in conv_res.pages if p.page_no == page_ix), None + (p for p in conv_res.pages if p.page_no == page_ix), + cast("Page", None), ) assert page is not None assert page.size is not None