mypy: Use Iterator[Any] as return type of queryset_iterator.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-11-01 22:58:36 -07:00 committed by Tim Abbott
parent 1197ff9655
commit 6c995db231
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import os import os
import ujson import ujson
from typing import Any, Generator from typing import Any, Iterator
from django.core.management.base import BaseCommand, CommandParser from django.core.management.base import BaseCommand, CommandParser
from django.db.models import QuerySet from django.db.models import QuerySet
@ -10,7 +10,7 @@ from zerver.models import Message
def queryset_iterator(queryset, chunksize=5000): def queryset_iterator(queryset, chunksize=5000):
# type: (QuerySet, int) -> Generator # type: (QuerySet, int) -> Iterator[Any]
queryset = queryset.order_by('id') queryset = queryset.order_by('id')
while queryset.exists(): while queryset.exists():
for row in queryset[:chunksize]: for row in queryset[:chunksize]: