mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 11:35:52 +03:00
Removed PILLOW_VERSION
This commit is contained in:
parent
174fad7d3d
commit
cd50d468ba
|
@ -813,35 +813,6 @@ class TestImage:
|
|||
with pytest.warns(DeprecationWarning):
|
||||
assert Image.CONTAINER == 2
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_module",
|
||||
[PIL, Image],
|
||||
)
|
||||
def test_pillow_version(self, test_module):
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert test_module.PILLOW_VERSION == PIL.__version__
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
str(test_module.PILLOW_VERSION)
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert int(test_module.PILLOW_VERSION[0]) >= 7
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert test_module.PILLOW_VERSION < "9.9.0"
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert test_module.PILLOW_VERSION <= "9.9.0"
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert test_module.PILLOW_VERSION != "7.0.0"
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert test_module.PILLOW_VERSION >= "7.0.0"
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert test_module.PILLOW_VERSION > "7.0.0"
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
[
|
||||
|
|
|
@ -51,17 +51,6 @@ ImageFile.raise_ioerror
|
|||
So, ``ImageFile.raise_ioerror`` will be removed in Pillow 9.0.0 (2022-01-02).
|
||||
Use ``ImageFile.raise_oserror`` instead.
|
||||
|
||||
PILLOW_VERSION constant
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 5.2.0
|
||||
|
||||
``PILLOW_VERSION`` will be removed in Pillow 9.0.0 (2022-01-02).
|
||||
Use ``__version__`` instead.
|
||||
|
||||
It was initially removed in Pillow 7.0.0, but brought back in 7.1.0 to give projects
|
||||
more time to upgrade.
|
||||
|
||||
Tk/Tcl 8.4
|
||||
~~~~~~~~~~
|
||||
|
||||
|
@ -109,6 +98,17 @@ Removed features
|
|||
Deprecated features are only removed in major releases after an appropriate
|
||||
period of deprecation has passed.
|
||||
|
||||
PILLOW_VERSION constant
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 5.2.0
|
||||
.. versionremoved:: 9.0.0
|
||||
|
||||
Use ``__version__`` instead.
|
||||
|
||||
It was initially removed in Pillow 7.0.0, but temporarily brought back in 7.1.0
|
||||
to give projects more time to upgrade.
|
||||
|
||||
im.offset
|
||||
~~~~~~~~~
|
||||
|
||||
|
|
10
docs/releasenotes/9.0.0.rst
Normal file
10
docs/releasenotes/9.0.0.rst
Normal file
|
@ -0,0 +1,10 @@
|
|||
9.0.0
|
||||
-----
|
||||
|
||||
Backwards Incompatible Changes
|
||||
==============================
|
||||
|
||||
PILLOW_VERSION constant
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
|
|
@ -14,6 +14,7 @@ expected to be backported to earlier versions.
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
9.0.0
|
||||
8.4.0
|
||||
8.3.2
|
||||
8.3.1
|
||||
|
|
|
@ -45,26 +45,15 @@ except ImportError:
|
|||
ElementTree = None
|
||||
|
||||
# VERSION was removed in Pillow 6.0.0.
|
||||
# PILLOW_VERSION is deprecated and will be removed in a future release.
|
||||
# PILLOW_VERSION was removed in Pillow 9.0.0.
|
||||
# Use __version__ instead.
|
||||
from . import (
|
||||
ImageMode,
|
||||
TiffTags,
|
||||
UnidentifiedImageError,
|
||||
__version__,
|
||||
_plugins,
|
||||
_raise_version_warning,
|
||||
)
|
||||
from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins
|
||||
from ._binary import i32le
|
||||
from ._util import deferred_error, isPath
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
def __getattr__(name):
|
||||
if name == "PILLOW_VERSION":
|
||||
_raise_version_warning()
|
||||
return __version__
|
||||
else:
|
||||
categories = {"NORMAL": 0, "SEQUENCE": 1, "CONTAINER": 2}
|
||||
if name in categories:
|
||||
warnings.warn(
|
||||
|
@ -78,12 +67,6 @@ if sys.version_info >= (3, 7):
|
|||
|
||||
|
||||
else:
|
||||
|
||||
from . import PILLOW_VERSION
|
||||
|
||||
# Silence warning
|
||||
assert PILLOW_VERSION
|
||||
|
||||
# categories
|
||||
NORMAL = 0
|
||||
SEQUENCE = 1
|
||||
|
|
|
@ -19,66 +19,9 @@ import warnings
|
|||
from . import _version
|
||||
|
||||
# VERSION was removed in Pillow 6.0.0.
|
||||
__version__ = _version.__version__
|
||||
|
||||
|
||||
# PILLOW_VERSION is deprecated and will be removed in a future release.
|
||||
# PILLOW_VERSION was removed in Pillow 9.0.0.
|
||||
# Use __version__ instead.
|
||||
def _raise_version_warning():
|
||||
warnings.warn(
|
||||
"PILLOW_VERSION is deprecated and will be removed in Pillow 9 (2022-01-02). "
|
||||
"Use __version__ instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
def __getattr__(name):
|
||||
if name == "PILLOW_VERSION":
|
||||
_raise_version_warning()
|
||||
return __version__
|
||||
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
||||
|
||||
|
||||
else:
|
||||
|
||||
class _Deprecated_Version(str):
|
||||
def __str__(self):
|
||||
_raise_version_warning()
|
||||
return super().__str__()
|
||||
|
||||
def __getitem__(self, key):
|
||||
_raise_version_warning()
|
||||
return super().__getitem__(key)
|
||||
|
||||
def __eq__(self, other):
|
||||
_raise_version_warning()
|
||||
return super().__eq__(other)
|
||||
|
||||
def __ne__(self, other):
|
||||
_raise_version_warning()
|
||||
return super().__ne__(other)
|
||||
|
||||
def __gt__(self, other):
|
||||
_raise_version_warning()
|
||||
return super().__gt__(other)
|
||||
|
||||
def __lt__(self, other):
|
||||
_raise_version_warning()
|
||||
return super().__lt__(other)
|
||||
|
||||
def __ge__(self, other):
|
||||
_raise_version_warning()
|
||||
return super().__gt__(other)
|
||||
|
||||
def __le__(self, other):
|
||||
_raise_version_warning()
|
||||
return super().__lt__(other)
|
||||
|
||||
PILLOW_VERSION = _Deprecated_Version(__version__)
|
||||
|
||||
__version__ = _version.__version__
|
||||
del _version
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user