Add types-Pillow dependency (#98266)
parent
e5f7d83912
commit
54cbc85c13
|
@ -12,7 +12,7 @@ from typing import Any
|
|||
from aiohttp import web
|
||||
from async_timeout import timeout
|
||||
from httpx import HTTPStatusError, RequestError, TimeoutException
|
||||
import PIL
|
||||
import PIL.Image
|
||||
import voluptuous as vol
|
||||
import yarl
|
||||
|
||||
|
@ -137,7 +137,7 @@ def get_image_type(image: bytes) -> str | None:
|
|||
imagefile = io.BytesIO(image)
|
||||
with contextlib.suppress(PIL.UnidentifiedImageError):
|
||||
img = PIL.Image.open(imagefile)
|
||||
fmt = img.format.lower()
|
||||
fmt = img.format.lower() if img.format else None
|
||||
|
||||
if fmt is None:
|
||||
# if PIL can't figure it out, could be svg.
|
||||
|
|
|
@ -4,7 +4,7 @@ Can only be used by integrations that have pillow in their requirements.
|
|||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from PIL import ImageDraw
|
||||
from PIL.ImageDraw import ImageDraw
|
||||
|
||||
|
||||
def draw_box(
|
||||
|
|
|
@ -41,6 +41,7 @@ types-decorator==5.1.8.3
|
|||
types-enum34==1.1.8
|
||||
types-ipaddress==1.0.8
|
||||
types-paho-mqtt==1.6.0.6
|
||||
types-Pillow==10.0.0.2
|
||||
types-pkg-resources==0.1.3
|
||||
types-psutil==5.9.5
|
||||
types-python-dateutil==2.8.19.13
|
||||
|
|
Loading…
Reference in New Issue