Removed or commented unused variables

This commit is contained in:
Andrew Murray 2015-04-08 21:12:37 +10:00
parent e22e4239e5
commit 9794aafc37
8 changed files with 14 additions and 13 deletions

View File

@ -78,7 +78,8 @@ class FontFile:
glyph = self[i] glyph = self[i]
if glyph: if glyph:
d, dst, src, im = glyph d, dst, src, im = glyph
xx, yy = src[2] - src[0], src[3] - src[1] xx = src[2] - src[0]
# yy = src[3] - src[1]
x0, y0 = x, y x0, y0 = x, y
x = x + xx x = x + xx
if x > WIDTH: if x > WIDTH:

View File

@ -222,7 +222,7 @@ def getiptcinfo(im):
offset += 2 offset += 2
# resource name (usually empty) # resource name (usually empty)
name_len = i8(app[offset]) name_len = i8(app[offset])
name = app[offset+1:offset+1+name_len] # name = app[offset+1:offset+1+name_len]
offset = 1 + offset + name_len offset = 1 + offset + name_len
if offset & 1: if offset & 1:
offset += 1 offset += 1

View File

@ -204,7 +204,7 @@ class PcfFontFile(FontFile.FontFile):
for i in range(4): for i in range(4):
bitmapSizes.append(i32(fp.read(4))) bitmapSizes.append(i32(fp.read(4)))
byteorder = format & 4 # non-zero => MSB # byteorder = format & 4 # non-zero => MSB
bitorder = format & 8 # non-zero => MSB bitorder = format & 8 # non-zero => MSB
padindex = format & 3 padindex = format & 3

View File

@ -731,8 +731,8 @@ class TiffImageFile(ImageFile.ImageFile):
# (self._compression, (extents tuple), # (self._compression, (extents tuple),
# 0, (rawmode, self._compression, fp)) # 0, (rawmode, self._compression, fp))
ignored, extents, ignored_2, args = self.tile[0] extents = self.tile[0][1]
args = args + (self.ifd.offset,) args = self.tile[0][3] + (self.ifd.offset,)
decoder = Image._getdecoder(self.mode, 'libtiff', args, decoder = Image._getdecoder(self.mode, 'libtiff', args,
self.decoderconfig) self.decoderconfig)
try: try:

View File

@ -10,7 +10,7 @@ def bench(mode):
get = im.im.getpixel get = im.im.getpixel
xy = 50, 50 # position shouldn't really matter xy = 50, 50 # position shouldn't really matter
t0 = timeit.default_timer() t0 = timeit.default_timer()
for i in range(1000000): for _ in range(1000000):
get(xy) get(xy)
print(mode, timeit.default_timer() - t0, "us") print(mode, timeit.default_timer() - t0, "us")

View File

@ -21,7 +21,7 @@ class TestJpegLeaks(PillowTestCase):
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
setrlimit(RLIMIT_STACK, (stack_size, stack_size)) setrlimit(RLIMIT_STACK, (stack_size, stack_size))
setrlimit(RLIMIT_AS, (mem_limit, mem_limit)) setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
for count in range(iterations): for _ in range(iterations):
with Image.open(test_file) as im: with Image.open(test_file) as im:
im.load() im.load()
@ -29,13 +29,13 @@ class TestJpegLeaks(PillowTestCase):
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
setrlimit(RLIMIT_STACK, (stack_size, stack_size)) setrlimit(RLIMIT_STACK, (stack_size, stack_size))
setrlimit(RLIMIT_AS, (mem_limit, mem_limit)) setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
for count in range(iterations): for _ in range(iterations):
with Image.open(test_file) as im: with Image.open(test_file) as im:
im.load() im.load()
test_output = BytesIO() test_output = BytesIO()
im.save(test_output, "JPEG2000") im.save(test_output, "JPEG2000")
test_output.seek(0) test_output.seek(0)
output = test_output.read() test_output.read()
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -101,7 +101,7 @@ post-patch:
qtables = [standard_l_qtable, qtables = [standard_l_qtable,
standard_chrominance_qtable] standard_chrominance_qtable]
for count in range(iterations): for _ in range(iterations):
test_output = BytesIO() test_output = BytesIO()
im.save(test_output, "JPEG", qtables=qtables) im.save(test_output, "JPEG", qtables=qtables)
@ -165,7 +165,7 @@ post patch:
im = hopper('RGB') im = hopper('RGB')
exif = b'12345678'*4096 exif = b'12345678'*4096
for count in range(iterations): for _ in range(iterations):
test_output = BytesIO() test_output = BytesIO()
im.save(test_output, "JPEG", exif=exif) im.save(test_output, "JPEG", exif=exif)
@ -199,7 +199,7 @@ base case:
def test_base_save(self): def test_base_save(self):
im = hopper('RGB') im = hopper('RGB')
for count in range(iterations): for _ in range(iterations):
test_output = BytesIO() test_output = BytesIO()
im.save(test_output, "JPEG") im.save(test_output, "JPEG")

View File

@ -28,7 +28,7 @@ class TestWebPLeaks(PillowTestCase):
with open(test_file, 'rb') as f: with open(test_file, 'rb') as f:
im_data = f.read() im_data = f.read()
start_mem = self._get_mem_usage() start_mem = self._get_mem_usage()
for count in range(iterations): for _ in range(iterations):
with Image.open(BytesIO(im_data)) as im: with Image.open(BytesIO(im_data)) as im:
im.load() im.load()
mem = (self._get_mem_usage() - start_mem) mem = (self._get_mem_usage() - start_mem)