Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Fuchs committed Oct 23, 2024
1 parent 1d6a3bd commit 917950e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pdfminer/runlength.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# * public domain *
#

from typing import List


def rldecode(data: bytes) -> bytes:
"""RunLength decoder (Adobe version) implementation based on PDF Reference
Expand All @@ -19,15 +21,15 @@ def rldecode(data: bytes) -> bytes:
(2 to 128) times during decompression. A length value of 128
denotes EOD.
"""
decoded_array = []
decoded_array: List[int] = []
data_iter = iter(data)

while True:
length = next(data_iter, 128)
if length == 128:
break

if length >= 0 and length < 128:
if 0 <= length < 128:
decoded_array.extend((next(data_iter) for _ in range(length + 1)))

if length > 128:
Expand Down

0 comments on commit 917950e

Please sign in to comment.