File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -137,17 +137,20 @@ def lzw_decode(data, code_size):
137
137
"""Decode LZW-compressed data."""
138
138
dictionary = LZWDict (code_size )
139
139
bit = 0
140
- byte = next (data ) # pylint: disable=stop-iteration-return
141
140
try :
142
- while True :
143
- code = 0
144
- for i in range (dictionary .code_len ):
145
- code |= ((byte >> bit ) & 0x01 ) << i
146
- bit += 1
147
- if bit >= 8 :
148
- bit = 0
149
- byte = next (data ) # pylint: disable=stop-iteration-return
150
- yield dictionary .decode (code )
151
- except EndOfData :
152
- while True :
153
- next (data ) # pylint: disable=stop-iteration-return
141
+ byte = next (data ) # pylint: disable=stop-iteration-return
142
+ try :
143
+ while True :
144
+ code = 0
145
+ for i in range (dictionary .code_len ):
146
+ code |= ((byte >> bit ) & 0x01 ) << i
147
+ bit += 1
148
+ if bit >= 8 :
149
+ bit = 0
150
+ byte = next (data ) # pylint: disable=stop-iteration-return
151
+ yield dictionary .decode (code )
152
+ except EndOfData :
153
+ while True :
154
+ next (data ) # pylint: disable=stop-iteration-return
155
+ except StopIteration :
156
+ pass
You can’t perform that action at this time.
0 commit comments