mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Simplify code and update comments
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									9f5d6e0c31
								
							
						
					
					
						commit
						512ee3ff9b
					
				| 
						 | 
					@ -258,20 +258,20 @@ def hopper(mode: str | None = None) -> Image.Image:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if mode is None:
 | 
					    if mode is None:
 | 
				
			||||||
        # Always return fresh not-yet-loaded version of image.
 | 
					        # Always return fresh not-yet-loaded version of image.
 | 
				
			||||||
        # Operations on not-yet-loaded images is separate class of errors
 | 
					        # Operations on not-yet-loaded images are a separate class of errors
 | 
				
			||||||
        # what we should catch.
 | 
					        # that we should catch.
 | 
				
			||||||
        return Image.open("Tests/images/hopper.ppm")
 | 
					        return Image.open("Tests/images/hopper.ppm")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return _cached_hopper(mode).copy()
 | 
					    return _cached_hopper(mode).copy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@lru_cache(maxsize=None)
 | 
					@lru_cache
 | 
				
			||||||
def _cached_hopper(mode: str = None) -> Image.Image:
 | 
					def _cached_hopper(mode: str) -> Image.Image:
 | 
				
			||||||
    if mode == "F":
 | 
					    if mode == "F":
 | 
				
			||||||
        im = hopper("L").convert(mode)
 | 
					        im = hopper("L")
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        im = hopper().convert(mode)
 | 
					        im = hopper()
 | 
				
			||||||
    return im
 | 
					    return im.convert(mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def djpeg_available() -> bool:
 | 
					def djpeg_available() -> bool:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user