mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Flake8 fixes
This commit is contained in:
parent
9ba3799980
commit
a83bcec169
|
@ -130,9 +130,10 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
# ----------------- Process BMP with Bitfields compression (not palette)
|
||||
if file_info['compression'] == self.BITFIELDS:
|
||||
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)]}
|
||||
32: [(0xff0000, 0xff00, 0xff, 0x0), (0xff0000, 0xff00, 0xff, 0xff000000), (0x0, 0x0, 0x0, 0x0)],
|
||||
24: [(0xff0000, 0xff00, 0xff)],
|
||||
16: [(0xf800, 0x7e0, 0x1f), (0x7c00, 0x3e0, 0x1f)]
|
||||
}
|
||||
MASK_MODES = {
|
||||
(32, (0xff0000, 0xff00, 0xff, 0x0)): "BGRX",
|
||||
(32, (0xff0000, 0xff00, 0xff, 0xff000000)): "BGRA",
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -320,8 +320,8 @@ class TestFileJpeg(PillowTestCase):
|
|||
# dict of qtable lists
|
||||
self.assert_image_similar(im,
|
||||
self.roundtrip(im, qtables={
|
||||
0: standard_l_qtable,
|
||||
1: standard_chrominance_qtable
|
||||
0: standard_l_qtable,
|
||||
1: standard_chrominance_qtable
|
||||
}), 30)
|
||||
|
||||
# not a sequence
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -113,7 +113,7 @@ class TestFileTiff(PillowTestCase):
|
|||
self.assert_warning(UserWarning, i._getexif)
|
||||
except struct.error:
|
||||
self.fail(
|
||||
"Bad EXIF data passed incorrect values to _binary unpack")
|
||||
"Bad EXIF data passed incorrect values to _binary unpack")
|
||||
|
||||
def test_save_rgba(self):
|
||||
im = hopper("RGBA")
|
||||
|
@ -245,18 +245,18 @@ class TestFileTiff(PillowTestCase):
|
|||
im = Image.open(filename)
|
||||
# v2 interface
|
||||
self.assertEqual(
|
||||
im.tag_v2.as_dict(),
|
||||
{256: 55, 257: 43, 258: (8, 8, 8, 8), 259: 1,
|
||||
262: 2, 296: 2, 273: (8,), 338: (1,), 277: 4,
|
||||
279: (9460,), 282: 72.0, 283: 72.0, 284: 1})
|
||||
im.tag_v2.as_dict(),
|
||||
{256: 55, 257: 43, 258: (8, 8, 8, 8), 259: 1,
|
||||
262: 2, 296: 2, 273: (8,), 338: (1,), 277: 4,
|
||||
279: (9460,), 282: 72.0, 283: 72.0, 284: 1})
|
||||
|
||||
# legacy interface
|
||||
self.assertEqual(
|
||||
im.tag.as_dict(),
|
||||
{256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,),
|
||||
262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,),
|
||||
279: (9460,), 282: ((720000, 10000),),
|
||||
283: ((720000, 10000),), 284: (1,)})
|
||||
im.tag.as_dict(),
|
||||
{256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,),
|
||||
262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,),
|
||||
279: (9460,), 282: ((720000, 10000),),
|
||||
283: ((720000, 10000),), 284: (1,)})
|
||||
|
||||
def test__delitem__(self):
|
||||
filename = "Tests/images/pil136.tiff"
|
||||
|
|
|
@ -14,14 +14,16 @@ class TestImageFontBitmap(PillowTestCase):
|
|||
def test_similar(self):
|
||||
text = 'EmbeddedBitmap'
|
||||
font_outline = ImageFont.truetype(
|
||||
font='Tests/fonts/DejaVuSans.ttf', size=24)
|
||||
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)
|
||||
font='Tests/fonts/DejaVuSans-bitmap.ttf', size=24)
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user