Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(msexcel): ignore Mypy checking for _find_images_in_sheet function in msexcel backend #691

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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