mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-22 20:01:30 +08:00
Add async queryset for Django 4.1 (#1131)
* Add async queryset for Django 4.1 * dedup * fix to async
This commit is contained in:
@@ -50,26 +50,51 @@ class BaseManager(Generic[_T]):
|
|||||||
# NOTE: The following methods are in common with QuerySet, but note that the use of QuerySet as a return type
|
# NOTE: The following methods are in common with QuerySet, but note that the use of QuerySet as a return type
|
||||||
# rather than a self-type (_QS), since Manager's QuerySet-like methods return QuerySets and not Managers.
|
# rather than a self-type (_QS), since Manager's QuerySet-like methods return QuerySets and not Managers.
|
||||||
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
|
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
|
||||||
|
async def aiterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
|
||||||
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
|
async def aaggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||||
|
async def aget(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||||
def create(self, **kwargs: Any) -> _T: ...
|
def create(self, **kwargs: Any) -> _T: ...
|
||||||
|
async def acreate(self, **kwargs: Any) -> _T: ...
|
||||||
def bulk_create(
|
def bulk_create(
|
||||||
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
|
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
|
||||||
) -> List[_T]: ...
|
) -> List[_T]: ...
|
||||||
|
async def abulk_create(
|
||||||
|
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
|
||||||
|
) -> List[_T]: ...
|
||||||
def bulk_update(self, objs: Iterable[_T], fields: Sequence[str], batch_size: Optional[int] = ...) -> int: ...
|
def bulk_update(self, objs: Iterable[_T], fields: Sequence[str], batch_size: Optional[int] = ...) -> int: ...
|
||||||
|
async def abulk_update(self, objs: Iterable[_T], fields: Sequence[str], batch_size: Optional[int] = ...) -> int: ...
|
||||||
def get_or_create(self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
def get_or_create(self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
||||||
|
async def aget_or_create(
|
||||||
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
|
) -> Tuple[_T, bool]: ...
|
||||||
def update_or_create(
|
def update_or_create(
|
||||||
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
) -> Tuple[_T, bool]: ...
|
) -> Tuple[_T, bool]: ...
|
||||||
|
async def aupdate_or_create(
|
||||||
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
|
) -> Tuple[_T, bool]: ...
|
||||||
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
|
async def aearliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
|
async def alatest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
def first(self) -> Optional[_T]: ...
|
def first(self) -> Optional[_T]: ...
|
||||||
|
async def afirst(self) -> Optional[_T]: ...
|
||||||
def last(self) -> Optional[_T]: ...
|
def last(self) -> Optional[_T]: ...
|
||||||
|
async def alast(self) -> Optional[_T]: ...
|
||||||
def in_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
def in_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
||||||
|
async def ain_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
||||||
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
||||||
|
async def adelete(self) -> Tuple[int, Dict[str, int]]: ...
|
||||||
def update(self, **kwargs: Any) -> int: ...
|
def update(self, **kwargs: Any) -> int: ...
|
||||||
|
async def aupdate(self, **kwargs: Any) -> int: ...
|
||||||
def exists(self) -> bool: ...
|
def exists(self) -> bool: ...
|
||||||
|
async def aexists(self) -> bool: ...
|
||||||
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
||||||
|
async def aexplain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
||||||
|
def contains(self, objs: Iterable[_T]) -> bool: ...
|
||||||
|
async def acontains(self, objs: Iterable[_T]) -> bool: ...
|
||||||
def raw(
|
def raw(
|
||||||
self,
|
self,
|
||||||
raw_query: str,
|
raw_query: str,
|
||||||
@@ -93,6 +118,7 @@ class BaseManager(Generic[_T]):
|
|||||||
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||||
def complex_filter(self, filter_obj: Any) -> QuerySet[_T]: ...
|
def complex_filter(self, filter_obj: Any) -> QuerySet[_T]: ...
|
||||||
def count(self) -> int: ...
|
def count(self) -> int: ...
|
||||||
|
async def acount(self) -> int: ...
|
||||||
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ...
|
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ...
|
||||||
def intersection(self, *other_qs: Any) -> QuerySet[_T]: ...
|
def intersection(self, *other_qs: Any) -> QuerySet[_T]: ...
|
||||||
def difference(self, *other_qs: Any) -> QuerySet[_T]: ...
|
def difference(self, *other_qs: Any) -> QuerySet[_T]: ...
|
||||||
|
|||||||
@@ -57,25 +57,49 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
|
|||||||
# the corresponding method in BaseManager.
|
# the corresponding method in BaseManager.
|
||||||
def iterator(self, chunk_size: int = ...) -> Iterator[_Row]: ...
|
def iterator(self, chunk_size: int = ...) -> Iterator[_Row]: ...
|
||||||
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
|
async def aaggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
def get(self, *args: Any, **kwargs: Any) -> _Row: ...
|
def get(self, *args: Any, **kwargs: Any) -> _Row: ...
|
||||||
|
async def aget(self, *args: Any, **kwargs: Any) -> _Row: ...
|
||||||
def create(self, **kwargs: Any) -> _T: ...
|
def create(self, **kwargs: Any) -> _T: ...
|
||||||
|
async def acreate(self, **kwargs: Any) -> _T: ...
|
||||||
def bulk_create(
|
def bulk_create(
|
||||||
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
|
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
|
||||||
) -> List[_T]: ...
|
) -> List[_T]: ...
|
||||||
|
async def abulk_create(
|
||||||
|
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
|
||||||
|
) -> List[_T]: ...
|
||||||
def bulk_update(self, objs: Iterable[_T], fields: Iterable[str], batch_size: Optional[int] = ...) -> int: ...
|
def bulk_update(self, objs: Iterable[_T], fields: Iterable[str], batch_size: Optional[int] = ...) -> int: ...
|
||||||
|
async def abulk_update(self, objs: Iterable[_T], fields: Iterable[str], batch_size: Optional[int] = ...) -> int: ...
|
||||||
def get_or_create(self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
def get_or_create(self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
||||||
|
async def aget_or_create(
|
||||||
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
|
) -> Tuple[_T, bool]: ...
|
||||||
def update_or_create(
|
def update_or_create(
|
||||||
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
) -> Tuple[_T, bool]: ...
|
) -> Tuple[_T, bool]: ...
|
||||||
|
async def aupdate_or_create(
|
||||||
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
|
) -> Tuple[_T, bool]: ...
|
||||||
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _Row: ...
|
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _Row: ...
|
||||||
|
async def aearliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _Row: ...
|
||||||
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _Row: ...
|
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _Row: ...
|
||||||
|
async def alatest(self, *fields: Any, field_name: Optional[Any] = ...) -> _Row: ...
|
||||||
def first(self) -> Optional[_Row]: ...
|
def first(self) -> Optional[_Row]: ...
|
||||||
|
async def afirst(self) -> Optional[_Row]: ...
|
||||||
def last(self) -> Optional[_Row]: ...
|
def last(self) -> Optional[_Row]: ...
|
||||||
|
async def alast(self) -> Optional[_Row]: ...
|
||||||
def in_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
def in_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
||||||
|
async def ain_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
||||||
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
||||||
|
async def adelete(self) -> Tuple[int, Dict[str, int]]: ...
|
||||||
def update(self, **kwargs: Any) -> int: ...
|
def update(self, **kwargs: Any) -> int: ...
|
||||||
|
async def aupdate(self, **kwargs: Any) -> int: ...
|
||||||
def exists(self) -> bool: ...
|
def exists(self) -> bool: ...
|
||||||
|
async def aexists(self) -> bool: ...
|
||||||
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
||||||
|
async def aexplain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
||||||
|
def contains(self, objs: Iterable[_T]) -> bool: ...
|
||||||
|
async def acontains(self, objs: Iterable[_T]) -> bool: ...
|
||||||
def raw(
|
def raw(
|
||||||
self,
|
self,
|
||||||
raw_query: str,
|
raw_query: str,
|
||||||
@@ -99,6 +123,7 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
|
|||||||
def exclude(self: _QS, *args: Any, **kwargs: Any) -> _QS: ...
|
def exclude(self: _QS, *args: Any, **kwargs: Any) -> _QS: ...
|
||||||
def complex_filter(self, filter_obj: Any) -> _QS: ...
|
def complex_filter(self, filter_obj: Any) -> _QS: ...
|
||||||
def count(self) -> int: ...
|
def count(self) -> int: ...
|
||||||
|
async def acount(self) -> int: ...
|
||||||
def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ...
|
def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ...
|
||||||
def intersection(self: _QS, *other_qs: Any) -> _QS: ...
|
def intersection(self: _QS, *other_qs: Any) -> _QS: ...
|
||||||
def difference(self: _QS, *other_qs: Any) -> _QS: ...
|
def difference(self: _QS, *other_qs: Any) -> _QS: ...
|
||||||
@@ -164,6 +189,7 @@ class RawQuerySet(Iterable[_T], Sized):
|
|||||||
@property
|
@property
|
||||||
def db(self) -> str: ...
|
def db(self) -> str: ...
|
||||||
def iterator(self) -> Iterator[_T]: ...
|
def iterator(self) -> Iterator[_T]: ...
|
||||||
|
async def aiterator(self) -> Iterator[_T]: ...
|
||||||
@property
|
@property
|
||||||
def model_fields(self) -> Dict[str, str]: ...
|
def model_fields(self) -> Dict[str, str]: ...
|
||||||
def prefetch_related(self, *lookups: Any) -> RawQuerySet[_T]: ...
|
def prefetch_related(self, *lookups: Any) -> RawQuerySet[_T]: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user