From 875acf76d7373fb79c550666cf1d54d87db9b0c7 Mon Sep 17 00:00:00 2001 From: Guillaume Andreu Sabater Date: Fri, 28 Oct 2022 14:59:18 +0200 Subject: [PATCH] Fixed `F`'s `asc` and `desc` args (#1213) * fixed F asc & desc signature * improved BaseExpression asc & desc signature --- django-stubs/db/models/expressions.pyi | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/django-stubs/db/models/expressions.pyi b/django-stubs/db/models/expressions.pyi index f3d2f32..0481e00 100644 --- a/django-stubs/db/models/expressions.pyi +++ b/django-stubs/db/models/expressions.pyi @@ -90,8 +90,19 @@ class BaseExpression: def copy(self: _SelfB) -> _SelfB: ... def get_group_by_cols(self: _SelfB, alias: Optional[str] = ...) -> List[_SelfB]: ... def get_source_fields(self) -> List[Optional[Field]]: ... - def asc(self, **kwargs: Any) -> OrderBy: ... - def desc(self, **kwargs: Any) -> OrderBy: ... + def asc( + self, + *, + descending: bool = ..., + nulls_first: bool = ..., + nulls_last: bool = ..., + ) -> OrderBy: ... + def desc( + self, + *, + nulls_first: bool = ..., + nulls_last: bool = ..., + ) -> OrderBy: ... def reverse_ordering(self) -> BaseExpression: ... def flatten(self) -> Iterator[BaseExpression]: ... def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @@ -121,7 +132,6 @@ class F(Combinable): def asc( self, *, - expression: Union[Expression, F, Subquery], descending: bool = ..., nulls_first: bool = ..., nulls_last: bool = ..., @@ -129,7 +139,6 @@ class F(Combinable): def desc( self, *, - expression: Union[Expression, F, Subquery], nulls_first: bool = ..., nulls_last: bool = ..., ) -> OrderBy: ...