mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Add types-Pillow dependency (#98266)
This commit is contained in:
parent
e5f7d83912
commit
54cbc85c13
@ -12,7 +12,7 @@ from typing import Any
|
|||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from async_timeout import timeout
|
from async_timeout import timeout
|
||||||
from httpx import HTTPStatusError, RequestError, TimeoutException
|
from httpx import HTTPStatusError, RequestError, TimeoutException
|
||||||
import PIL
|
import PIL.Image
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
import yarl
|
import yarl
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ def get_image_type(image: bytes) -> str | None:
|
|||||||
imagefile = io.BytesIO(image)
|
imagefile = io.BytesIO(image)
|
||||||
with contextlib.suppress(PIL.UnidentifiedImageError):
|
with contextlib.suppress(PIL.UnidentifiedImageError):
|
||||||
img = PIL.Image.open(imagefile)
|
img = PIL.Image.open(imagefile)
|
||||||
fmt = img.format.lower()
|
fmt = img.format.lower() if img.format else None
|
||||||
|
|
||||||
if fmt is None:
|
if fmt is None:
|
||||||
# if PIL can't figure it out, could be svg.
|
# 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 __future__ import annotations
|
||||||
|
|
||||||
from PIL import ImageDraw
|
from PIL.ImageDraw import ImageDraw
|
||||||
|
|
||||||
|
|
||||||
def draw_box(
|
def draw_box(
|
||||||
|
@ -41,6 +41,7 @@ types-decorator==5.1.8.3
|
|||||||
types-enum34==1.1.8
|
types-enum34==1.1.8
|
||||||
types-ipaddress==1.0.8
|
types-ipaddress==1.0.8
|
||||||
types-paho-mqtt==1.6.0.6
|
types-paho-mqtt==1.6.0.6
|
||||||
|
types-Pillow==10.0.0.2
|
||||||
types-pkg-resources==0.1.3
|
types-pkg-resources==0.1.3
|
||||||
types-psutil==5.9.5
|
types-psutil==5.9.5
|
||||||
types-python-dateutil==2.8.19.13
|
types-python-dateutil==2.8.19.13
|
||||||
|
Loading…
x
Reference in New Issue
Block a user