mirror of
https://github.com/HackSoftware/Django-Styleguide.git
synced 2024-11-29 13:03:47 +03:00
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
|
from typing import Generic, Iterator, Any, TypeVar, Optional, Dict, Tuple
|
||
|
from collections import Iterable
|
||
|
|
||
|
|
||
|
DjangoModel = TypeVar('DjangoModel')
|
||
|
|
||
|
|
||
|
class QuerySetType(Generic[DjangoModel], extra=Iterable):
|
||
|
"""
|
||
|
This type represents django.db.models.QuerySet interface.
|
||
|
|
||
|
Defined Types:
|
||
|
DjangoModel - model instance
|
||
|
QuerysetType[DjangoModel] - Queryset of DjangoModel instances
|
||
|
Iterator[DjangoModel] - Iterator of DjangoModel instances
|
||
|
"""
|
||
|
def __iter__(self) -> Iterator[DjangoModel]: ...
|
||
|
|
||
|
def all(self) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def order_by(self, *args: Any) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def count(self) -> int: ...
|
||
|
|
||
|
def filter(self, **kwargs: Any) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def exclude(self, **kwargs: Any) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def get(self, **kwargs: Any) -> DjangoModel: ...
|
||
|
|
||
|
def annotate(self, **kwargs: Any) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def first(self) -> Optional[DjangoModel]: ...
|
||
|
|
||
|
def update(self, **kwargs: Any) -> DjangoModel: ...
|
||
|
|
||
|
def delete(self, **kwargs: Any) -> Tuple[int, Dict[str, int]]: ...
|
||
|
|
||
|
def last(self) -> Optional[DjangoModel]: ...
|
||
|
|
||
|
def exists(self) -> bool: ...
|
||
|
|
||
|
def values(self, *args: Any) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def values_list(self, *args: Any) -> 'QuerySetType[DjangoModel]': ...
|
||
|
|
||
|
def __getitem__(self, index: int) -> DjangoModel: ...
|
||
|
|
||
|
def __len__(self) -> int: ...
|