Documented deprecation

This commit is contained in:
Andrew Murray 2022-01-16 11:38:34 +11:00
parent 86944abbab
commit 5df83a57ff
2 changed files with 30 additions and 3 deletions

View File

@ -53,6 +53,18 @@ Before Pillow 8.3.0, ``ImagePalette`` required palette data of particular length
default, and the size parameter could be used to override that. Pillow 8.3.0 removed
the default required length, also removing the need for the size parameter.
ImageShow.Viewer.show_file file argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. deprecated:: 9.1.0
The ``file`` argument in :py:meth:`~PIL.ImageShow.Viewer.show_file()` has been
deprecated, replaced by ``path``.
In effect, ``viewer.show_file("test.jpg")`` will continue to work unchanged.
``viewer.show_file(file="test.jpg")`` will raise a deprecation warning, and suggest
``viewer.show_file(path="test.jpg")`` instead.
Removed features
----------------

View File

@ -107,7 +107,12 @@ class Viewer:
return self.show_file(self.save_image(image), **options)
def show_file(self, path=None, **options):
"""Display given file."""
"""
Display given file.
Before Pillow 9.1.0, the first argument was ``file``. This is now deprecated,
and ``path`` should be used instead.
"""
if path is None:
if "file" in options:
warnings.warn(
@ -157,7 +162,12 @@ class MacViewer(Viewer):
return command
def show_file(self, path=None, **options):
"""Display given file"""
"""
Display given file.
Before Pillow 9.1.0, the first argument was ``file``. This is now deprecated,
and ``path`` should be used instead.
"""
if path is None:
if "file" in options:
warnings.warn(
@ -194,7 +204,12 @@ class UnixViewer(Viewer):
return f"({command} {quote(file)}; rm -f {quote(file)})&"
def show_file(self, path=None, **options):
"""Display given file"""
"""
Display given file.
Before Pillow 9.1.0, the first argument was ``file``. This is now deprecated,
and ``path`` should be used instead.
"""
if path is None:
if "file" in options:
warnings.warn(