Skip to content

Commit e06689e

Browse files
authored
Fix aiterator (#1449)
1 parent 67ec985 commit e06689e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

django-stubs/db/models/manager.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import datetime
2-
from collections.abc import Collection, Iterable, Iterator, MutableMapping, Sequence
2+
from collections.abc import AsyncIterator, Collection, Iterable, Iterator, MutableMapping, Sequence
33
from typing import Any, Generic, NoReturn, TypeVar, overload
44

55
from _typeshed import Self
@@ -37,7 +37,7 @@ class BaseManager(Generic[_T]):
3737
# NOTE: The following methods are in common with QuerySet, but note that the use of QuerySet as a return type
3838
# rather than a self-type (_QS), since Manager's QuerySet-like methods return QuerySets and not Managers.
3939
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
40-
async def aiterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
40+
def aiterator(self, chunk_size: int = ...) -> AsyncIterator[_T]: ...
4141
def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
4242
async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
4343
def get(self, *args: Any, **kwargs: Any) -> _T: ...

django-stubs/db/models/query.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
6464
# IMPORTANT: When updating any of the following methods' signatures, please ALSO modify
6565
# the corresponding method in BaseManager.
6666
def iterator(self, chunk_size: int = ...) -> Iterator[_Row]: ...
67+
def aiterator(self, chunk_size: int = ...) -> AsyncIterator[_Row]: ...
6768
def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
6869
async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
6970
def get(self, *args: Any, **kwargs: Any) -> _Row: ...
@@ -206,7 +207,6 @@ class RawQuerySet(Iterable[_T], Sized):
206207
@property
207208
def db(self) -> str: ...
208209
def iterator(self) -> Iterator[_T]: ...
209-
async def aiterator(self) -> Iterator[_T]: ...
210210
@property
211211
def model_fields(self) -> dict[str, str]: ...
212212
def prefetch_related(self, *lookups: Any) -> RawQuerySet[_T]: ...

0 commit comments

Comments
 (0)