mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
Remove im.category and related Image.NORMAL, Image.SEQUENCE, Image.CONTAINER, deprecated in 8.2.0
This commit is contained in:
parent
070e770469
commit
ddc4e90235
|
@ -929,17 +929,6 @@ class TestImage:
|
|||
im.apply_transparency()
|
||||
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):
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert Image.LINEAR == Image.Resampling.BILINEAR
|
||||
|
|
|
@ -12,18 +12,6 @@ Deprecated features
|
|||
Below are features which are considered deprecated. Where appropriate,
|
||||
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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -210,6 +198,18 @@ Tk/Tcl 8.4
|
|||
|
||||
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
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -61,10 +61,6 @@ from ._util import DeferredError, is_path
|
|||
|
||||
|
||||
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 = {
|
||||
"LINEAR": "BILINEAR",
|
||||
"CUBIC": "BICUBIC",
|
||||
|
@ -521,12 +517,6 @@ class Image:
|
|||
self.pyaccess = 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
|
||||
def width(self):
|
||||
return self.size[0]
|
||||
|
|
Loading…
Reference in New Issue
Block a user