Add types-Pillow dependency (#98266)

pull/98331/head
Marc Mueller 2023-08-13 18:57:46 +02:00 committed by GitHub
parent e5f7d83912
commit 54cbc85c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -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.

View File

@ -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(

View File

@ -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