Fix mypy type errors in reporting module

This commit is contained in:
2026-01-29 18:06:13 +00:00
parent c016320b71
commit 6830b3158c
8 changed files with 576 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ Charts are rendered to base64-encoded PNG images for embedding in HTML/PDF.
import base64
from io import BytesIO
from typing import Any
import pandas as pd
@@ -27,9 +28,9 @@ class ChartGenerator:
dpi: Resolution for chart images (dots per inch).
"""
self.dpi = dpi
self._plt: type | None = None
self._plt: tuple[Any, Any] | None = None
def _get_matplotlib(self) -> tuple:
def _get_matplotlib(self) -> tuple[Any, Any]:
"""Lazy-load matplotlib to avoid import errors when not installed.
Returns:

View File

@@ -75,7 +75,8 @@ class PDFRenderer:
"""
try:
HTML = self._get_weasyprint()
return HTML(string=html).write_pdf()
result: bytes = HTML(string=html).write_pdf()
return result
except PDFConversionError:
raise
except Exception as e: