Lazy import for Pillow so module import stays cheap.
()
| 139 | # --------------------------------------------------------------------------- |
| 140 | |
| 141 | def _pil(): |
| 142 | """Lazy import for Pillow so module import stays cheap.""" |
| 143 | try: |
| 144 | from PIL import Image, UnidentifiedImageError # noqa: F401 |
| 145 | except ImportError as e: # pragma: no cover - dependency guaranteed by pyproject.toml |
| 146 | raise ImageProcessingError( |
| 147 | "Pillow is not installed. Add 'Pillow>=10.0' to dependencies." |
| 148 | ) from e |
| 149 | return Image, UnidentifiedImageError |
| 150 | |
| 151 | |
| 152 | def _log_image_event(subtype: str, **fields: Any) -> None: |
no test coverage detected