mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Merge pull request #140 from cgohlke/patch-7
Fix AttributeError: 'module' object has no attribute 'isNumberType'
This commit is contained in:
		
						commit
						f5d427eb53
					
				| 
						 | 
					@ -30,6 +30,8 @@
 | 
				
			||||||
# See the README file for information on usage and redistribution.
 | 
					# See the README file for information on usage and redistribution.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import numbers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import Image, ImageColor
 | 
					from PIL import Image, ImageColor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
| 
						 | 
					@ -98,7 +100,7 @@ class ImageDraw:
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
        if Image.isStringType(ink):
 | 
					        if Image.isStringType(ink):
 | 
				
			||||||
            ink = ImageColor.getcolor(ink, self.mode)
 | 
					            ink = ImageColor.getcolor(ink, self.mode)
 | 
				
			||||||
        if self.palette and not Image.isNumberType(ink):
 | 
					        if self.palette and not isinstance(ink, numbers.Number):
 | 
				
			||||||
            ink = self.palette.getcolor(ink)
 | 
					            ink = self.palette.getcolor(ink)
 | 
				
			||||||
        self.ink = self.draw.draw_ink(ink, self.mode)
 | 
					        self.ink = self.draw.draw_ink(ink, self.mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,13 +143,13 @@ class ImageDraw:
 | 
				
			||||||
            if ink is not None:
 | 
					            if ink is not None:
 | 
				
			||||||
                if Image.isStringType(ink):
 | 
					                if Image.isStringType(ink):
 | 
				
			||||||
                    ink = ImageColor.getcolor(ink, self.mode)
 | 
					                    ink = ImageColor.getcolor(ink, self.mode)
 | 
				
			||||||
                if self.palette and not Image.isNumberType(ink):
 | 
					                if self.palette and not isinstance(ink, numbers.Number):
 | 
				
			||||||
                    ink = self.palette.getcolor(ink)
 | 
					                    ink = self.palette.getcolor(ink)
 | 
				
			||||||
                ink = self.draw.draw_ink(ink, self.mode)
 | 
					                ink = self.draw.draw_ink(ink, self.mode)
 | 
				
			||||||
            if fill is not None:
 | 
					            if fill is not None:
 | 
				
			||||||
                if Image.isStringType(fill):
 | 
					                if Image.isStringType(fill):
 | 
				
			||||||
                    fill = ImageColor.getcolor(fill, self.mode)
 | 
					                    fill = ImageColor.getcolor(fill, self.mode)
 | 
				
			||||||
                if self.palette and not Image.isNumberType(fill):
 | 
					                if self.palette and not isinstance(fill, numbers.Number):
 | 
				
			||||||
                    fill = self.palette.getcolor(fill)
 | 
					                    fill = self.palette.getcolor(fill)
 | 
				
			||||||
                fill = self.draw.draw_ink(fill, self.mode)
 | 
					                fill = self.draw.draw_ink(fill, self.mode)
 | 
				
			||||||
        return ink, fill
 | 
					        return ink, fill
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user