Skip to content

Commit 82349a7

Browse files
committed
Override signature of query-returning methods in InheritanceManager
1 parent a7a4b49 commit 82349a7

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

model_utils/managers.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,78 @@ class InheritanceManagerMixin(Generic[ModelT]):
226226
_queryset_class = InheritanceQuerySet
227227

228228
if TYPE_CHECKING:
229+
from collections.abc import Sequence
230+
231+
def none(self) -> InheritanceQuerySet[ModelT]:
232+
...
233+
234+
def all(self) -> InheritanceQuerySet[ModelT]:
235+
...
236+
229237
def filter(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
230238
...
231239

240+
def exclude(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
241+
...
242+
243+
def complex_filter(self, filter_obj: Any) -> InheritanceQuerySet[ModelT]:
244+
...
245+
246+
def union(self, *other_qs: Any, all: bool = ...) -> InheritanceQuerySet[ModelT]:
247+
...
248+
249+
def intersection(self, *other_qs: Any) -> InheritanceQuerySet[ModelT]:
250+
...
251+
252+
def difference(self, *other_qs: Any) -> InheritanceQuerySet[ModelT]:
253+
...
254+
255+
def select_for_update(
256+
self, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ..., no_key: bool = ...
257+
) -> InheritanceQuerySet[ModelT]:
258+
...
259+
260+
def select_related(self, *fields: Any) -> InheritanceQuerySet[ModelT]:
261+
...
262+
263+
def prefetch_related(self, *lookups: Any) -> InheritanceQuerySet[ModelT]:
264+
...
265+
266+
def annotate(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
267+
...
268+
269+
def alias(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
270+
...
271+
272+
def order_by(self, *field_names: Any) -> InheritanceQuerySet[ModelT]:
273+
...
274+
275+
def distinct(self, *field_names: Any) -> InheritanceQuerySet[ModelT]:
276+
...
277+
278+
def extra(
279+
self,
280+
select: dict[str, Any] | None = ...,
281+
where: list[str] | None = ...,
282+
params: list[Any] | None = ...,
283+
tables: list[str] | None = ...,
284+
order_by: Sequence[str] | None = ...,
285+
select_params: Sequence[Any] | None = ...,
286+
) -> InheritanceQuerySet[Any]:
287+
...
288+
289+
def reverse(self) -> InheritanceQuerySet[ModelT]:
290+
...
291+
292+
def defer(self, *fields: Any) -> InheritanceQuerySet[ModelT]:
293+
...
294+
295+
def only(self, *fields: Any) -> InheritanceQuerySet[ModelT]:
296+
...
297+
298+
def using(self, alias: str | None) -> InheritanceQuerySet[ModelT]:
299+
...
300+
232301
def get_queryset(self) -> InheritanceQuerySet[ModelT]:
233302
model: type[ModelT] = self.model # type: ignore[attr-defined]
234303
return self._queryset_class(model)

0 commit comments

Comments
 (0)