mirror of https://github.com/zulip/zulip.git
mypy: Use Iterator[Any] as return type of queryset_iterator.
This commit is contained in:
parent
1197ff9655
commit
6c995db231
|
@ -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]:
|
||||||
|
|
Loading…
Reference in New Issue