Skip to content

Commit

Permalink
Removed or commented unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 24, 2015
1 parent e22e423 commit 9794aaf
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion PIL/FontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def compile(self):
glyph = self[i]
if 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
x = x + xx
if x > WIDTH:
Expand Down
2 changes: 1 addition & 1 deletion PIL/IptcImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def getiptcinfo(im):
offset += 2
# resource name (usually empty)
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
if offset & 1:
offset += 1
Expand Down
2 changes: 1 addition & 1 deletion PIL/PcfFontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _load_bitmaps(self, metrics):
for i in range(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
padindex = format & 3

Expand Down
4 changes: 2 additions & 2 deletions PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ def _load_libtiff(self):

# (self._compression, (extents tuple),
# 0, (rawmode, self._compression, fp))
ignored, extents, ignored_2, args = self.tile[0]
args = args + (self.ifd.offset,)
extents = self.tile[0][1]
args = self.tile[0][3] + (self.ifd.offset,)
decoder = Image._getdecoder(self.mode, 'libtiff', args,
self.decoderconfig)
try:
Expand Down
2 changes: 1 addition & 1 deletion Tests/bench_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def bench(mode):
get = im.im.getpixel
xy = 50, 50 # position shouldn't really matter
t0 = timeit.default_timer()
for i in range(1000000):
for _ in range(1000000):
get(xy)
print(mode, timeit.default_timer() - t0, "us")

Expand Down
6 changes: 3 additions & 3 deletions Tests/check_j2k_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ def test_leak_load(self):
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
setrlimit(RLIMIT_STACK, (stack_size, stack_size))
setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
for count in range(iterations):
for _ in range(iterations):
with Image.open(test_file) as im:
im.load()

def test_leak_save(self):
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
setrlimit(RLIMIT_STACK, (stack_size, stack_size))
setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
for count in range(iterations):
for _ in range(iterations):
with Image.open(test_file) as im:
im.load()
test_output = BytesIO()
im.save(test_output, "JPEG2000")
test_output.seek(0)
output = test_output.read()
test_output.read()


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions Tests/check_jpeg_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_qtables_leak(self):
qtables = [standard_l_qtable,
standard_chrominance_qtable]

for count in range(iterations):
for _ in range(iterations):
test_output = BytesIO()
im.save(test_output, "JPEG", qtables=qtables)

Expand Down Expand Up @@ -165,7 +165,7 @@ def test_exif_leak(self):
im = hopper('RGB')
exif = b'12345678'*4096

for count in range(iterations):
for _ in range(iterations):
test_output = BytesIO()
im.save(test_output, "JPEG", exif=exif)

Expand Down Expand Up @@ -199,7 +199,7 @@ def test_exif_leak(self):
def test_base_save(self):
im = hopper('RGB')

for count in range(iterations):
for _ in range(iterations):
test_output = BytesIO()
im.save(test_output, "JPEG")

Expand Down
2 changes: 1 addition & 1 deletion Tests/check_webp_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_leak_load(self):
with open(test_file, 'rb') as f:
im_data = f.read()
start_mem = self._get_mem_usage()
for count in range(iterations):
for _ in range(iterations):
with Image.open(BytesIO(im_data)) as im:
im.load()
mem = (self._get_mem_usage() - start_mem)
Expand Down

0 comments on commit 9794aaf

Please sign in to comment.