Skip to content

Commit 716100c

Browse files
Lorenzo Morandinibrunobord
authored andcommitted
Fixed PendingDeprecationWarning: generator 'chunkator_page' raised StopIteration
1 parent 32a38ce commit 716100c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chunkator/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def chunkator_page(source_qs, chunk_size, query_log=None):
4242
nb_items = len(page)
4343

4444
if nb_items == 0:
45-
raise StopIteration
45+
return -1
4646

4747
last_item = page[-1]
4848
# source_qs._fields exists *and* is not none when using "values()"
@@ -54,7 +54,7 @@ def chunkator_page(source_qs, chunk_size, query_log=None):
5454
yield page
5555

5656
if nb_items < chunk_size:
57-
raise StopIteration
57+
return -1
5858

5959

6060
def chunkator(source_qs, chunk_size, query_log=None):

0 commit comments

Comments
 (0)