Improve types for QuerySet.contains and bulk_create (#1134)

* Improve types for QuerySet.contains and bulk_create

* models.Model
This commit is contained in:
Adam Johnson
2022-08-28 09:37:37 +01:00
committed by GitHub
parent bfad3b05c1
commit 3622a61442

View File

@@ -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: ...
@@ -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,