Skip to content

Commit

Permalink
fix(msexcel): ignore Mypy checking for _find_images_in_sheet function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiun An Tsai authored and Jiun An Tsai committed Jan 8, 2025
1 parent 2b591f9 commit 7baf789
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions docling/backend/msexcel_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from typing import Any, List

from PIL import Image
from pydantic import BaseModel


Expand Down Expand Up @@ -326,10 +327,8 @@ def _find_images_in_sheet(
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)
Expand All @@ -339,36 +338,32 @@ def _find_images_in_sheet(
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

0 comments on commit 7baf789

Please sign in to comment.