mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Flake8 fixes
This commit is contained in:
parent
b9a05b8516
commit
72d5218080
|
@ -883,7 +883,7 @@ class Image(object):
|
|||
try:
|
||||
t = trns_im.palette.getcolor(t)
|
||||
except:
|
||||
raise ValueError("Couldn't allocate a palette "+
|
||||
raise ValueError("Couldn't allocate a palette " +
|
||||
"color for transparency")
|
||||
trns_im.putpixel((0, 0), t)
|
||||
|
||||
|
|
|
@ -473,7 +473,7 @@ def _save(im, fp, tile, bufsize=0):
|
|||
e.setimage(im.im, b)
|
||||
if e.pushes_fd:
|
||||
e.setfd(fp)
|
||||
l,s = e.encode_to_pyfd()
|
||||
l, s = e.encode_to_pyfd()
|
||||
else:
|
||||
while True:
|
||||
l, s, d = e.encode(bufsize)
|
||||
|
@ -492,7 +492,7 @@ def _save(im, fp, tile, bufsize=0):
|
|||
e.setimage(im.im, b)
|
||||
if e.pushes_fd:
|
||||
e.setfd(fp)
|
||||
l,s = e.encode_to_pyfd()
|
||||
l, s = e.encode_to_pyfd()
|
||||
else:
|
||||
s = e.encode_to_file(fh, bufsize)
|
||||
if s < 0:
|
||||
|
|
|
@ -32,6 +32,7 @@ for r in range(8):
|
|||
for b in range(4):
|
||||
PALETTE = PALETTE + (o8((r*255)//7)+o8((g*255)//7)+o8((b*255)//3))
|
||||
|
||||
|
||||
def _accept(prefix):
|
||||
return prefix[:6] == _MAGIC
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ class TestFileEps(PillowTestCase):
|
|||
target = Image.open('Tests/images/pil_sample_rgb.jpg')
|
||||
self.assert_image_similar(cmyk_image, target, 10)
|
||||
|
||||
|
||||
def test_file_object(self):
|
||||
# issue 479
|
||||
image1 = Image.open(file1)
|
||||
|
|
|
@ -35,7 +35,7 @@ class TestFileJpeg2k(PillowTestCase):
|
|||
|
||||
im = Image.open('Tests/images/test-card-lossless.jp2')
|
||||
px = im.load()
|
||||
self.assertEqual(px[0,0], (0, 0, 0))
|
||||
self.assertEqual(px[0, 0], (0, 0, 0))
|
||||
self.assertEqual(im.mode, 'RGB')
|
||||
self.assertEqual(im.size, (640, 480))
|
||||
self.assertEqual(im.format, 'JPEG2000')
|
||||
|
|
|
@ -264,6 +264,7 @@ class TestImageCms(PillowTestCase):
|
|||
# Helper function to reduce precision of tuples of floats
|
||||
# recursively and then check equality.
|
||||
power = 10 ** digits
|
||||
|
||||
def truncate_tuple(tuple_or_float):
|
||||
return tuple(
|
||||
truncate_tuple(val) if isinstance(val, tuple)
|
||||
|
|
|
@ -20,7 +20,8 @@ TEST_IMAGE_SIZE = (10, 10)
|
|||
# the repr is that of a PIL.Image. Size and shape are 1 and (), not the
|
||||
# size and shape of the array. This causes failures in several tests.
|
||||
SKIP_NUMPY_ON_PYPY = hasattr(sys, 'pypy_version_info') and (
|
||||
sys.pypy_version_info <= (5,3,1,'final',0))
|
||||
sys.pypy_version_info <= (5, 3, 1, 'final', 0))
|
||||
|
||||
|
||||
class TestNumpy(PillowTestCase):
|
||||
|
||||
|
@ -144,7 +145,7 @@ class TestNumpy(PillowTestCase):
|
|||
img = Image.fromarray(a)
|
||||
|
||||
img_px = img.load()
|
||||
self.assertEqual(img_px[0,0], pixel_value)
|
||||
self.assertEqual(img_px[0, 0], pixel_value)
|
||||
|
||||
@unittest.skipIf(SKIP_NUMPY_ON_PYPY, "numpy.array(Image) is flaky on PyPy")
|
||||
def test_to_array(self):
|
||||
|
|
|
@ -64,7 +64,7 @@ def install():
|
|||
return
|
||||
|
||||
if fl_win or fl_cygwin:
|
||||
#windows barfs on multiprocessing installs
|
||||
# windows barfs on multiprocessing installs
|
||||
print("Single threaded build for windows")
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user