mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Ambiguous variable name 'l'
This commit is contained in:
parent
e7cfa15216
commit
145589ef14
|
@ -67,13 +67,13 @@ class TestImageConvert(PillowTestCase):
|
|||
|
||||
f = self.tempfile('temp.png')
|
||||
|
||||
l = im.convert('L')
|
||||
self.assertEqual(l.info['transparency'], 0) # undone
|
||||
l.save(f)
|
||||
im_l = im.convert('L')
|
||||
self.assertEqual(im_l.info['transparency'], 0) # undone
|
||||
im_l.save(f)
|
||||
|
||||
rgb = im.convert('RGB')
|
||||
self.assertEqual(rgb.info['transparency'], (0, 0, 0)) # undone
|
||||
rgb.save(f)
|
||||
im_rgb = im.convert('RGB')
|
||||
self.assertEqual(im_rgb.info['transparency'], (0, 0, 0)) # undone
|
||||
im_rgb.save(f)
|
||||
|
||||
# ref https://github.com/python-pillow/Pillow/issues/664
|
||||
|
||||
|
@ -83,12 +83,12 @@ class TestImageConvert(PillowTestCase):
|
|||
im.info['transparency'] = 128
|
||||
|
||||
# Act
|
||||
rgba = im.convert('RGBA')
|
||||
im_rgba = im.convert('RGBA')
|
||||
|
||||
# Assert
|
||||
self.assertNotIn('transparency', rgba.info)
|
||||
self.assertNotIn('transparency', im_rgba.info)
|
||||
# https://github.com/python-pillow/Pillow/issues/2702
|
||||
self.assertEqual(rgba.palette, None)
|
||||
self.assertEqual(im_rgba.palette, None)
|
||||
|
||||
def test_trns_l(self):
|
||||
im = hopper('L')
|
||||
|
@ -96,19 +96,20 @@ class TestImageConvert(PillowTestCase):
|
|||
|
||||
f = self.tempfile('temp.png')
|
||||
|
||||
rgb = im.convert('RGB')
|
||||
self.assertEqual(rgb.info['transparency'], (128, 128, 128)) # undone
|
||||
rgb.save(f)
|
||||
im_rgb = im.convert('RGB')
|
||||
self.assertEqual(im_rgb.info['transparency'],
|
||||
(128, 128, 128)) # undone
|
||||
im_rgb.save(f)
|
||||
|
||||
p = im.convert('P')
|
||||
self.assertIn('transparency', p.info)
|
||||
p.save(f)
|
||||
im_p = im.convert('P')
|
||||
self.assertIn('transparency', im_p.info)
|
||||
im_p.save(f)
|
||||
|
||||
p = self.assert_warning(
|
||||
im_p = self.assert_warning(
|
||||
UserWarning,
|
||||
im.convert, 'P', palette=Image.ADAPTIVE)
|
||||
self.assertNotIn('transparency', p.info)
|
||||
p.save(f)
|
||||
self.assertNotIn('transparency', im_p.info)
|
||||
im_p.save(f)
|
||||
|
||||
def test_trns_RGB(self):
|
||||
im = hopper('RGB')
|
||||
|
@ -116,23 +117,24 @@ class TestImageConvert(PillowTestCase):
|
|||
|
||||
f = self.tempfile('temp.png')
|
||||
|
||||
l = im.convert('L')
|
||||
self.assertEqual(l.info['transparency'], l.getpixel((0, 0))) # undone
|
||||
l.save(f)
|
||||
im_l = im.convert('L')
|
||||
self.assertEqual(im_l.info['transparency'],
|
||||
im_l.getpixel((0, 0))) # undone
|
||||
im_l.save(f)
|
||||
|
||||
p = im.convert('P')
|
||||
self.assertIn('transparency', p.info)
|
||||
p.save(f)
|
||||
im_p = im.convert('P')
|
||||
self.assertIn('transparency', im_p.info)
|
||||
im_p.save(f)
|
||||
|
||||
p = im.convert('RGBA')
|
||||
self.assertNotIn('transparency', p.info)
|
||||
p.save(f)
|
||||
im_rgba = im.convert('RGBA')
|
||||
self.assertNotIn('transparency', im_rgba.info)
|
||||
im_rgba.save(f)
|
||||
|
||||
p = self.assert_warning(
|
||||
im_p = self.assert_warning(
|
||||
UserWarning,
|
||||
im.convert, 'P', palette=Image.ADAPTIVE)
|
||||
self.assertNotIn('transparency', p.info)
|
||||
p.save(f)
|
||||
self.assertNotIn('transparency', im_p.info)
|
||||
im_p.save(f)
|
||||
|
||||
def test_p_la(self):
|
||||
im = hopper('RGBA')
|
||||
|
|
|
@ -196,13 +196,13 @@ class TestImageCms(PillowTestCase):
|
|||
# not a linear luminance map. so L != 128:
|
||||
self.assertEqual(k, (137, 128, 128))
|
||||
|
||||
l = i_lab.getdata(0)
|
||||
a = i_lab.getdata(1)
|
||||
b = i_lab.getdata(2)
|
||||
l_data = i_lab.getdata(0)
|
||||
a_data = i_lab.getdata(1)
|
||||
b_data = i_lab.getdata(2)
|
||||
|
||||
self.assertEqual(list(l), [137] * 100)
|
||||
self.assertEqual(list(a), [128] * 100)
|
||||
self.assertEqual(list(b), [128] * 100)
|
||||
self.assertEqual(list(l_data), [137] * 100)
|
||||
self.assertEqual(list(a_data), [128] * 100)
|
||||
self.assertEqual(list(b_data), [128] * 100)
|
||||
|
||||
def test_lab_color(self):
|
||||
psRGB = ImageCms.createProfile("sRGB")
|
||||
|
|
|
@ -107,10 +107,10 @@ class ContainerIO(object):
|
|||
|
||||
:returns: A list of 8-bit strings.
|
||||
"""
|
||||
l = []
|
||||
lines = []
|
||||
while True:
|
||||
s = self.readline()
|
||||
if not s:
|
||||
break
|
||||
l.append(s)
|
||||
return l
|
||||
lines.append(s)
|
||||
return lines
|
||||
|
|
|
@ -110,11 +110,11 @@ class Stat(object):
|
|||
v = []
|
||||
for i in self.bands:
|
||||
s = 0
|
||||
l = self.count[i]//2
|
||||
half = self.count[i]//2
|
||||
b = i * 256
|
||||
for j in range(256):
|
||||
s = s + self.h[b+j]
|
||||
if s > l:
|
||||
if s > half:
|
||||
break
|
||||
v.append(j)
|
||||
return v
|
||||
|
|
|
@ -1245,7 +1245,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
self.info["resolution"] = xres, yres
|
||||
|
||||
# build tile descriptors
|
||||
x = y = l = 0
|
||||
x = y = layer = 0
|
||||
self.tile = []
|
||||
self.use_load_libtiff = False
|
||||
if STRIPOFFSETS in self.tag_v2:
|
||||
|
@ -1305,7 +1305,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
|
||||
else:
|
||||
for i, offset in enumerate(offsets):
|
||||
a = self._decoder(rawmode, l, i)
|
||||
a = self._decoder(rawmode, layer, i)
|
||||
self.tile.append(
|
||||
(self._compression,
|
||||
(0, min(y, ysize), w, min(y+h, ysize)),
|
||||
|
@ -1315,7 +1315,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
y = y + h
|
||||
if y >= self.size[1]:
|
||||
x = y = 0
|
||||
l += 1
|
||||
layer += 1
|
||||
a = None
|
||||
elif TILEOFFSETS in self.tag_v2:
|
||||
# tiled image
|
||||
|
@ -1324,7 +1324,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
a = None
|
||||
for o in self.tag_v2[TILEOFFSETS]:
|
||||
if not a:
|
||||
a = self._decoder(rawmode, l)
|
||||
a = self._decoder(rawmode, layer)
|
||||
# FIXME: this doesn't work if the image size
|
||||
# is not a multiple of the tile size...
|
||||
self.tile.append(
|
||||
|
@ -1336,7 +1336,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
x, y = 0, y + h
|
||||
if y >= self.size[1]:
|
||||
x = y = 0
|
||||
l += 1
|
||||
layer += 1
|
||||
a = None
|
||||
else:
|
||||
if DEBUG:
|
||||
|
|
Loading…
Reference in New Issue
Block a user