Skip to content

Commit 4fa09e6

Browse files
authored
STY: Iterate directly over the list instead of using range (#1839)
1 parent 29e7eb9 commit 4fa09e6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pypdf/_page.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,11 @@ def _content_stream_rename(
644644
stream = ContentStream(stream, pdf)
645645
for operands, _operator in stream.operations:
646646
if isinstance(operands, list):
647-
for i in range(len(operands)):
648-
op = operands[i]
647+
for i, op in enumerate(operands):
649648
if isinstance(op, NameObject):
650649
operands[i] = rename.get(op, op)
651650
elif isinstance(operands, dict):
652-
for i in operands:
653-
op = operands[i]
651+
for i, op in operands.items():
654652
if isinstance(op, NameObject):
655653
operands[i] = rename.get(op, op)
656654
else:

0 commit comments

Comments
 (0)