upload: Replace deprecated PIL.PngImagePlugin.APNG_DISPOSE_OP_NONE.

https://pillow.readthedocs.io/en/stable/deprecations.html#constants

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit f90a41bab0)
This commit is contained in:
Anders Kaseorg
2023-02-08 18:57:32 -08:00
committed by Tim Abbott
parent 961be78940
commit fe27f8eb40

View File

@@ -172,7 +172,12 @@ def resize_animated(im: Image.Image, size: int = DEFAULT_EMOJI_SIZE) -> bytes:
im.disposal_method # type: ignore[attr-defined] # private member missing from stubs
)
elif isinstance(im, PngImagePlugin.PngImageFile):
disposals.append(im.info.get("disposal", PngImagePlugin.APNG_DISPOSE_OP_NONE))
disposals.append(
im.info.get(
"disposal",
PngImagePlugin.Disposal.OP_NONE, # type: ignore[attr-defined] # https://github.com/python/typeshed/pull/9698
)
)
else: # nocoverage
raise BadImageError(_("Unknown animated image format."))
out = io.BytesIO()