Skip to content

Commit a831648

Browse files
committed
Add some vertical whitespace to a complex loop
1 parent 5e0e29b commit a831648

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

couchdb/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,19 +867,24 @@ def iterview(self, name, batch, wrapper=None, **options):
867867
if limit is not None and limit <= 0:
868868
raise ValueError('limit must be 1 or more')
869869
while True:
870+
870871
loop_limit = min(limit or batch, batch)
871872
# Get rows in batches, with one extra for start of next batch.
872873
options['limit'] = loop_limit + 1
873874
rows = list(self.view(name, wrapper, **options))
875+
874876
# Yield rows from this batch.
875877
for row in itertools.islice(rows, loop_limit):
876878
yield row
879+
877880
# Decrement limit counter.
878881
if limit is not None:
879882
limit -= min(len(rows), batch)
883+
880884
# Check if there is nothing else to yield.
881885
if len(rows) <= batch or (limit is not None and limit == 0):
882886
break
887+
883888
# Update options with start keys for next loop.
884889
options.update(startkey=rows[-1]['key'], startkey_docid=rows[-1]['id'], skip=0)
885890

0 commit comments

Comments
 (0)