Skip to content

Commit

Permalink
Reverted docstring and changed return values instead
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 9, 2022
1 parent 02294bf commit 3db7a6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Tests/test_imageshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_ipythonviewer():
assert False

im = hopper()
assert test_viewer.show(im) == 1
assert test_viewer.show(im)


@pytest.mark.skipif(
Expand Down
22 changes: 11 additions & 11 deletions src/PIL/ImageShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ def show(image, title=None, **options):
:param image: An image object.
:param title: Optional title. Not all viewers can display the title.
:param \**options: Additional viewer options.
:returns: ``1`` if a suitable viewer was found, ``0`` otherwise.
:returns: ``True`` if a suitable viewer was found, ``False`` otherwise.
"""
for viewer in _viewers:
if viewer.show(image, title=title, **options):
return 1
return 0
return True
return False


class Viewer:
Expand Down Expand Up @@ -124,7 +124,7 @@ def show_file(self, path=None, **options):
else:
raise TypeError("Missing required argument: 'path'")
os.system(self.get_command(path, **options))
return 1
return True


# --------------------------------------------------------------------
Expand Down Expand Up @@ -188,7 +188,7 @@ def show_file(self, path=None, **options):
path,
]
)
return 1
return True


if sys.platform == "darwin":
Expand Down Expand Up @@ -251,7 +251,7 @@ def show_file(self, path=None, **options):
).stdout.strip()
command = application[:-8].split(b".")[-1]
self._run_and_remove_path([command, path])
return 1
return True


class DisplayViewer(UnixViewer):
Expand Down Expand Up @@ -289,7 +289,7 @@ def show_file(self, path=None, **options):
args.append(path)

self._run_and_remove_path(args)
return 1
return True


class GmDisplayViewer(UnixViewer):
Expand Down Expand Up @@ -318,7 +318,7 @@ def show_file(self, path=None, **options):
else:
raise TypeError("Missing required argument: 'path'")
self._run_and_remove_path(["gm", "display", path])
return 1
return True


class EogViewer(UnixViewer):
Expand Down Expand Up @@ -347,7 +347,7 @@ def show_file(self, path=None, **options):
else:
raise TypeError("Missing required argument: 'path'")
self._run_and_remove_path(["eog", "-n", path])
return 1
return True


class XVViewer(UnixViewer):
Expand Down Expand Up @@ -387,7 +387,7 @@ def show_file(self, path=None, **options):
args.append(path)

self._run_and_remove_path(args)
return 1
return True


if sys.platform not in ("win32", "darwin"): # unixoids
Expand All @@ -408,7 +408,7 @@ class IPythonViewer(Viewer):

def show_image(self, image, **options):
ipython_display(image)
return 1
return True


try:
Expand Down

0 comments on commit 3db7a6c

Please sign in to comment.