Flake8 fixes

This commit is contained in:
Andrew Murray 2015-12-31 07:27:27 +11:00
parent 9ba3799980
commit a83bcec169
6 changed files with 24 additions and 21 deletions

View File

@ -132,7 +132,8 @@ class BmpImageFile(ImageFile.ImageFile):
SUPPORTED = {
32: [(0xff0000, 0xff00, 0xff, 0x0), (0xff0000, 0xff00, 0xff, 0xff000000), (0x0, 0x0, 0x0, 0x0)],
24: [(0xff0000, 0xff00, 0xff)],
16: [(0xf800, 0x7e0, 0x1f), (0x7c00, 0x3e0, 0x1f)]}
16: [(0xf800, 0x7e0, 0x1f), (0x7c00, 0x3e0, 0x1f)]
}
MASK_MODES = {
(32, (0xff0000, 0xff00, 0xff, 0x0)): "BGRX",
(32, (0xff0000, 0xff00, 0xff, 0xff000000)): "BGRA",

View File

@ -434,7 +434,7 @@ def _getexif(self):
else:
info = TiffImagePlugin.ImageFileDirectory_v1(head)
info.load(file)
exif[0x8825] = dict([(k,v[0]) if len(v) == 1 else (k,v) for k,v in info.items()])
exif[0x8825] = dict([(k, v[0]) if len(v) == 1 else (k, v) for k, v in info.items()])
return exif

View File

@ -170,7 +170,7 @@ class TestFileLibTiff(LibTiffTestCase):
'RowsPerStrip',
'StripOffsets']
for field in requested_fields:
self.assertTrue(field in reloaded, "%s not in metadata" %field)
self.assertTrue(field in reloaded, "%s not in metadata" % field)
def test_g3_compression(self):
i = Image.open('Tests/images/hopper_g4_500.tif')

View File

@ -17,11 +17,13 @@ class TestImageFontBitmap(PillowTestCase):
font='Tests/fonts/DejaVuSans.ttf', size=24)
font_bitmap = ImageFont.truetype(
font='Tests/fonts/DejaVuSans-bitmap.ttf', size=24)
size_outline, size_bitmap = font_outline.getsize(text), font_bitmap.getsize(text)
size_outline = font_outline.getsize(text)
size_bitmap = font_bitmap.getsize(text)
size_final = max(size_outline[0], size_bitmap[0]), max(size_outline[1], size_bitmap[1])
im_bitmap = Image.new('RGB', size_final, (255, 255, 255))
im_outline = im_bitmap.copy()
draw_bitmap, draw_outline = ImageDraw.Draw(im_bitmap), ImageDraw.Draw(im_outline)
draw_bitmap = ImageDraw.Draw(im_bitmap)
draw_outline = ImageDraw.Draw(im_outline)
# Metrics are different on the bitmap and ttf fonts,
# more so on some platforms and versions of freetype than others.