fix(msexcel): ignore Mypy checking for _find_images_in_sheet function

Signed-off-by: Jiun An Tsai <andrew@247365-Macbook.local>
This commit is contained in:
Jiun An Tsai 2025-01-07 15:37:34 +08:00
parent 2b591f9872
commit 8ec3f176eb

View File

@ -26,6 +26,7 @@ _log = logging.getLogger(__name__)
from typing import Any, List
from PIL import Image
from pydantic import BaseModel
@ -326,10 +327,8 @@ class MsExcelDocumentBackend(DeclarativeDocumentBackend):
self, doc: DoclingDocument, sheet: Worksheet
) -> DoclingDocument:
# FIXME: mypy does not agree with _images ...
"""
# Iterate over images in the sheet
for idx, image in enumerate(sheet._images): # Access embedded images
for idx, image in enumerate(sheet._images): # type: ignore
image_bytes = BytesIO(image.ref.blob)
pil_image = Image.open(image_bytes)
@ -339,36 +338,32 @@ class MsExcelDocumentBackend(DeclarativeDocumentBackend):
image=ImageRef.from_pil(image=pil_image, dpi=72),
caption=None,
)
"""
# FIXME: mypy does not agree with _charts ...
"""
for idx, chart in enumerate(sheet._charts): # Access embedded charts
for idx, chart in enumerate(sheet._charts): # type: ignore
chart_path = f"chart_{idx + 1}.png"
_log.info(
f"Chart found, but dynamic rendering is required for: {chart_path}"
)
_log.info(f"Chart {idx + 1}:")
# Chart type
_log.info(f"Type: {type(chart).__name__}")
# Title
if chart.title:
_log.info(f"Title: {chart.title}")
else:
_log.info("No title")
# Data series
for series in chart.series:
_log.info(" => series ...")
_log.info(f"Data Series: {series.title}")
_log.info(f"Values: {series.values}")
_log.info(f"Categories: {series.categories}")
# Position
# _log.info(f"Anchor Cell: {chart.anchor}")
"""
return doc