Skip to content

Commit 88fcad9

Browse files
committed
Reformat iterchunks() method for easier readability
1 parent a5cd8a2 commit 88fcad9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

couchdb/http.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,24 @@ def iterchunks(self):
170170
assert self.chunked
171171
buffer = []
172172
while True:
173+
173174
if self.resp.isclosed():
174175
break
176+
175177
chunksz = int(self.resp.fp.readline().strip(), 16)
176178
if not chunksz:
177179
self.resp.fp.read(2) #crlf
178180
self.resp.close()
179181
self._release_conn()
180182
break
183+
181184
chunk = self.resp.fp.read(chunksz)
182185
for ln in chunk.splitlines(True):
183-
end = (ln == b'\n') and not buffer # end of response
184186

187+
end = ln == b'\n' and not buffer # end of response
185188
if not ln or end:
186189
break
190+
187191
buffer.append(ln)
188192
if ln.endswith(b'\n'):
189193
yield b''.join(buffer)

0 commit comments

Comments
 (0)