Skip to content

Commit

Permalink
Simplify code and update comments
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
  • Loading branch information
hugovk and radarhere authored Apr 1, 2024
1 parent 9f5d6e0 commit 512ee3f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,20 +258,20 @@ def hopper(mode: str | None = None) -> Image.Image:

if mode is None:
# Always return fresh not-yet-loaded version of image.
# Operations on not-yet-loaded images is separate class of errors
# what we should catch.
# Operations on not-yet-loaded images are a separate class of errors
# that we should catch.
return Image.open("Tests/images/hopper.ppm")

return _cached_hopper(mode).copy()


@lru_cache(maxsize=None)
def _cached_hopper(mode: str = None) -> Image.Image:
@lru_cache
def _cached_hopper(mode: str) -> Image.Image:
if mode == "F":
im = hopper("L").convert(mode)
im = hopper("L")
else:
im = hopper().convert(mode)
return im
im = hopper()
return im.convert(mode)


def djpeg_available() -> bool:
Expand Down

0 comments on commit 512ee3f

Please sign in to comment.