mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Apply suggestions from code review
Simplify conditional expressions Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									164ea2df6f
								
							
						
					
					
						commit
						a8b3feac86
					
				| 
						 | 
				
			
			@ -164,9 +164,7 @@ def grabclipboard():
 | 
			
		|||
        else:  # Session type check failed
 | 
			
		||||
            sessiontype = None
 | 
			
		||||
 | 
			
		||||
        if shutil.which("wl-paste") and (
 | 
			
		||||
            (sessiontype == "wayland") or (sessiontype is None)
 | 
			
		||||
        ):
 | 
			
		||||
        if shutil.which("wl-paste") and sessiontype in ["wayland", None]:
 | 
			
		||||
            output = subprocess.check_output(["wl-paste", "-l"]).decode()
 | 
			
		||||
            mimetypes = output.splitlines()
 | 
			
		||||
            if "image/png" in mimetypes:
 | 
			
		||||
| 
						 | 
				
			
			@ -179,9 +177,7 @@ def grabclipboard():
 | 
			
		|||
            args = ["wl-paste"]
 | 
			
		||||
            if mimetype:
 | 
			
		||||
                args.extend(["-t", mimetype])
 | 
			
		||||
        elif shutil.which("xclip") and (
 | 
			
		||||
            (sessiontype == "x11") or (sessiontype is None)
 | 
			
		||||
        ):
 | 
			
		||||
        elif shutil.which("xclip") and sessiontype in ["x11", None]:
 | 
			
		||||
            args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
 | 
			
		||||
        else:
 | 
			
		||||
            msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user