Remove im.category and related Image.NORMAL, Image.SEQUENCE, Image.CONTAINER, deprecated in 8.2.0

This commit is contained in:
Hugo van Kemenade 2023-04-02 19:51:16 +03:00
parent 070e770469
commit ddc4e90235
3 changed files with 12 additions and 33 deletions

View File

@ -929,17 +929,6 @@ class TestImage:
im.apply_transparency() im.apply_transparency()
assert im.palette.colors[(27, 35, 6, 214)] == 24 assert im.palette.colors[(27, 35, 6, 214)] == 24
def test_categories_deprecation(self):
with pytest.warns(DeprecationWarning):
assert hopper().category == 0
with pytest.warns(DeprecationWarning):
assert Image.NORMAL == 0
with pytest.warns(DeprecationWarning):
assert Image.SEQUENCE == 1
with pytest.warns(DeprecationWarning):
assert Image.CONTAINER == 2
def test_constants(self): def test_constants(self):
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert Image.LINEAR == Image.Resampling.BILINEAR assert Image.LINEAR == Image.Resampling.BILINEAR

View File

@ -12,18 +12,6 @@ Deprecated features
Below are features which are considered deprecated. Where appropriate, Below are features which are considered deprecated. Where appropriate,
a ``DeprecationWarning`` is issued. a ``DeprecationWarning`` is issued.
Categories
~~~~~~~~~~
.. deprecated:: 8.2.0
``im.category`` is deprecated and will be removed in Pillow 10.0.0 (2023-07-01),
along with the related ``Image.NORMAL``, ``Image.SEQUENCE`` and
``Image.CONTAINER`` attributes.
To determine if an image has multiple frames or not,
``getattr(im, "is_animated", False)`` can be used instead.
JpegImagePlugin.convert_dict_qtables JpegImagePlugin.convert_dict_qtables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -210,6 +198,18 @@ Tk/Tcl 8.4
Support for Tk/Tcl 8.4 was removed in Pillow 10.0.0 (2023-07-01). Support for Tk/Tcl 8.4 was removed in Pillow 10.0.0 (2023-07-01).
Categories
~~~~~~~~~~
.. deprecated:: 8.2.0
.. versionremoved:: 10.0.0
``im.category`` was removed along with the related ``Image.NORMAL``,
``Image.SEQUENCE`` and ``Image.CONTAINER`` attributes.
To determine if an image has multiple frames or not,
``getattr(im, "is_animated", False)`` can be used instead.
PyQt5 and PySide2 PyQt5 and PySide2
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~

View File

@ -61,10 +61,6 @@ from ._util import DeferredError, is_path
def __getattr__(name): def __getattr__(name):
categories = {"NORMAL": 0, "SEQUENCE": 1, "CONTAINER": 2}
if name in categories:
deprecate("Image categories", 10, "is_animated", plural=True)
return categories[name]
old_resampling = { old_resampling = {
"LINEAR": "BILINEAR", "LINEAR": "BILINEAR",
"CUBIC": "BICUBIC", "CUBIC": "BICUBIC",
@ -521,12 +517,6 @@ class Image:
self.pyaccess = None self.pyaccess = None
self._exif = None self._exif = None
def __getattr__(self, name):
if name == "category":
deprecate("Image categories", 10, "is_animated", plural=True)
return self._category
raise AttributeError(name)
@property @property
def width(self): def width(self):
return self.size[0] return self.size[0]