mypy: Add types-Pillow.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-08-09 14:20:13 -07:00 committed by Tim Abbott
parent b798b34b23
commit 5c90522e69
6 changed files with 14 additions and 3 deletions

View File

@ -79,7 +79,6 @@ module = [
"onelogin.*", "onelogin.*",
"openapi_core.*", "openapi_core.*",
"openapi_schema_validator.*", "openapi_schema_validator.*",
"PIL.*",
"premailer.*", "premailer.*",
"psycopg2.*", "psycopg2.*",
"pyinotify.*", "pyinotify.*",

View File

@ -1688,6 +1688,10 @@ types-orjson==0.1.1 \
--hash=sha256:7454bfbaed27900a844bb9d8e211b69f1c335f0b9e3541d4950a793db41c104d \ --hash=sha256:7454bfbaed27900a844bb9d8e211b69f1c335f0b9e3541d4950a793db41c104d \
--hash=sha256:92f85986261ea1a5cb215e4b35e4016631d35163a372f023918750f340ea737f --hash=sha256:92f85986261ea1a5cb215e4b35e4016631d35163a372f023918750f340ea737f
# via -r requirements/mypy.in # via -r requirements/mypy.in
types-pillow==8.3.2 \
--hash=sha256:35fa2085164e550ef89d10c75963c5c9d673e8fd529343560b945eb6ac26891d \
--hash=sha256:7926e2d0a774184af16115207a4938b3d1089b3cfac658e837af6a6d2ed8cc2d
# via -r requirements/mypy.in
types-polib==0.1.3 \ types-polib==0.1.3 \
--hash=sha256:54fb4d5a9edc2b2f7e3cd7ebbf8631dbcecdeb69e9e31597e81c2b5b3bd3613b \ --hash=sha256:54fb4d5a9edc2b2f7e3cd7ebbf8631dbcecdeb69e9e31597e81c2b5b3bd3613b \
--hash=sha256:bd79bc1780e5d7fb6fd0dce59bb8d118ca81f8b2f14d5d05e21d2716e2e1937b --hash=sha256:bd79bc1780e5d7fb6fd0dce59bb8d118ca81f8b2f14d5d05e21d2716e2e1937b

View File

@ -18,6 +18,7 @@ types-Markdown
types-oauthlib types-oauthlib
types-orjson types-orjson
types-polib types-polib
types-Pillow
types-Pygments types-Pygments
types-python-dateutil types-python-dateutil
types-pytz types-pytz

View File

@ -129,6 +129,10 @@ types-orjson==0.1.1 \
--hash=sha256:7454bfbaed27900a844bb9d8e211b69f1c335f0b9e3541d4950a793db41c104d \ --hash=sha256:7454bfbaed27900a844bb9d8e211b69f1c335f0b9e3541d4950a793db41c104d \
--hash=sha256:92f85986261ea1a5cb215e4b35e4016631d35163a372f023918750f340ea737f --hash=sha256:92f85986261ea1a5cb215e4b35e4016631d35163a372f023918750f340ea737f
# via -r requirements/mypy.in # via -r requirements/mypy.in
types-pillow==8.3.2 \
--hash=sha256:35fa2085164e550ef89d10c75963c5c9d673e8fd529343560b945eb6ac26891d \
--hash=sha256:7926e2d0a774184af16115207a4938b3d1089b3cfac658e837af6a6d2ed8cc2d
# via -r requirements/mypy.in
types-polib==0.1.3 \ types-polib==0.1.3 \
--hash=sha256:54fb4d5a9edc2b2f7e3cd7ebbf8631dbcecdeb69e9e31597e81c2b5b3bd3613b \ --hash=sha256:54fb4d5a9edc2b2f7e3cd7ebbf8631dbcecdeb69e9e31597e81c2b5b3bd3613b \
--hash=sha256:bd79bc1780e5d7fb6fd0dce59bb8d118ca81f8b2f14d5d05e21d2716e2e1937b --hash=sha256:bd79bc1780e5d7fb6fd0dce59bb8d118ca81f8b2f14d5d05e21d2716e2e1937b

View File

@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 92
# historical commits sharing the same major version, in which case a # historical commits sharing the same major version, in which case a
# minor version bump suffices. # minor version bump suffices.
PROVISION_VERSION = "153.10" PROVISION_VERSION = "153.11"

View File

@ -148,7 +148,9 @@ def resize_gif(im: GifImageFile, size: int = DEFAULT_EMOJI_SIZE) -> bytes:
new_frame = ImageOps.pad(new_frame, (size, size), Image.ANTIALIAS) new_frame = ImageOps.pad(new_frame, (size, size), Image.ANTIALIAS)
frames.append(new_frame) frames.append(new_frame)
duration_info.append(im.info["duration"]) duration_info.append(im.info["duration"])
disposals.append(im.disposal_method) disposals.append(
im.disposal_method # type: ignore[attr-defined] # private member missing from stubs
)
out = io.BytesIO() out = io.BytesIO()
frames[0].save( frames[0].save(
out, out,
@ -168,6 +170,7 @@ def resize_emoji(image_data: bytes, size: int = DEFAULT_EMOJI_SIZE) -> bytes:
im = Image.open(io.BytesIO(image_data)) im = Image.open(io.BytesIO(image_data))
image_format = im.format image_format = im.format
if image_format == "GIF": if image_format == "GIF":
assert isinstance(im, GifImageFile)
# There are a number of bugs in Pillow.GifImagePlugin which cause # There are a number of bugs in Pillow.GifImagePlugin which cause
# results in resized gifs being broken. To work around this we # results in resized gifs being broken. To work around this we
# only resize under certain conditions to minimize the chance of # only resize under certain conditions to minimize the chance of