Skip to content

Commit

Permalink
Improve types for QuerySet.contains and bulk_create (#1134)
Browse files Browse the repository at this point in the history
* Improve types for QuerySet.contains and bulk_create

* models.Model
  • Loading branch information
adamchainz authored Aug 28, 2022
1 parent bfad3b0 commit 3622a61
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions django-stubs/db/models/query.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,22 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
def create(self, **kwargs: Any) -> _T: ...
async def acreate(self, **kwargs: Any) -> _T: ...
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 = ...,
update_conflicts: bool = ...,
update_fields: Optional[Collection[str]] = ...,
unique_fields: Optional[Collection[str]] = ...,
) -> List[_T]: ...
async def abulk_create(
self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ...
self,
objs: Iterable[_T],
batch_size: Optional[int] = ...,
ignore_conflicts: bool = ...,
update_conflicts: bool = ...,
update_fields: Optional[Collection[str]] = ...,
unique_fields: Optional[Collection[str]] = ...,
) -> List[_T]: ...
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: ...
Expand Down Expand Up @@ -98,8 +110,8 @@ class _QuerySet(Generic[_T, _Row], Collection[_Row], Reversible[_Row], Sized):
async def aexists(self) -> bool: ...
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 contains(self, obj: models.Model) -> bool: ...
async def acontains(self, obj: models.Model) -> bool: ...
def raw(
self,
raw_query: str,
Expand Down

0 comments on commit 3622a61

Please sign in to comment.