Skip to content

Commit 512ee3f

Browse files
hugovkradarhere
andauthored
Simplify code and update comments
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
1 parent 9f5d6e0 commit 512ee3f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Tests/helper.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,20 +258,20 @@ def hopper(mode: str | None = None) -> Image.Image:
258258

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

265265
return _cached_hopper(mode).copy()
266266

267267

268-
@lru_cache(maxsize=None)
269-
def _cached_hopper(mode: str = None) -> Image.Image:
268+
@lru_cache
269+
def _cached_hopper(mode: str) -> Image.Image:
270270
if mode == "F":
271-
im = hopper("L").convert(mode)
271+
im = hopper("L")
272272
else:
273-
im = hopper().convert(mode)
274-
return im
273+
im = hopper()
274+
return im.convert(mode)
275275

276276

277277
def djpeg_available() -> bool:

0 commit comments

Comments
 (0)