Use enumerate

This commit is contained in:
Hugo van Kemenade 2023-01-07 20:45:55 +02:00
parent 2df4865e42
commit 8d5eb71d26
2 changed files with 2 additions and 6 deletions

View File

@ -168,8 +168,7 @@ def test_mp_no_data():
def test_mp_attribute(test_file):
with Image.open(test_file) as im:
mpinfo = im._getmp()
frame_number = 0
for mpentry in mpinfo[0xB002]:
for frame_number, mpentry in enumerate(mpinfo[0xB002]):
mpattr = mpentry["Attribute"]
if frame_number:
assert not mpattr["RepresentativeImageFlag"]
@ -180,7 +179,6 @@ def test_mp_attribute(test_file):
assert mpattr["ImageDataFormat"] == "JPEG"
assert mpattr["MPType"] == "Multi-Frame Image: (Disparity)"
assert mpattr["Reserved"] == 0
frame_number += 1
@pytest.mark.parametrize("test_file", test_files)

View File

@ -238,15 +238,13 @@ def _layerinfo(fp, ct_bytes):
layers.append((name, mode, (x0, y0, x1, y1)))
# get tiles
i = 0
for name, mode, bbox in layers:
for i, (name, mode, bbox) in enumerate(layers):
tile = []
for m in mode:
t = _maketile(fp, m, bbox, 1)
if t:
tile.extend(t)
layers[i] = name, mode, bbox, tile
i += 1
return layers