Fix mypy type errors in reporting module
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user