mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Replaced while with for loop
This commit is contained in:
		
							parent
							
								
									2a403860d1
								
							
						
					
					
						commit
						7c154f52fa
					
				| 
						 | 
					@ -32,14 +32,12 @@ class GimpPaletteFile(object):
 | 
				
			||||||
        if fp.readline()[:12] != b"GIMP Palette":
 | 
					        if fp.readline()[:12] != b"GIMP Palette":
 | 
				
			||||||
            raise SyntaxError("not a GIMP palette file")
 | 
					            raise SyntaxError("not a GIMP palette file")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        i = 0
 | 
					        for i in range(256):
 | 
				
			||||||
 | 
					 | 
				
			||||||
        while i <= 255:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            s = fp.readline()
 | 
					            s = fp.readline()
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if not s:
 | 
					            if not s:
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # skip fields and comment lines
 | 
					            # skip fields and comment lines
 | 
				
			||||||
            if re.match(br"\w+:|#", s):
 | 
					            if re.match(br"\w+:|#", s):
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
| 
						 | 
					@ -52,8 +50,6 @@ class GimpPaletteFile(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            self.palette[i] = o8(v[0]) + o8(v[1]) + o8(v[2])
 | 
					            self.palette[i] = o8(v[0]) + o8(v[1]) + o8(v[2])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            i += 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.palette = b"".join(self.palette)
 | 
					        self.palette = b"".join(self.palette)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def getpalette(self):
 | 
					    def getpalette(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user