diff --git a/django-stubs/db/models/expressions.pyi b/django-stubs/db/models/expressions.pyi index 086aaae..e4372ac 100644 --- a/django-stubs/db/models/expressions.pyi +++ b/django-stubs/db/models/expressions.pyi @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from decimal import Decimal from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Iterable from django.db.models.lookups import Lookup @@ -15,6 +16,8 @@ class SQLiteNumericMixin: _Self = TypeVar("_Self") +_Numeric = Union[float, Decimal] + class Combinable: ADD: str = ... SUB: str = ... @@ -27,25 +30,25 @@ class Combinable: BITLEFTSHIFT: str = ... BITRIGHTSHIFT: str = ... def __neg__(self: _Self) -> _Self: ... - def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, float, str]]) -> _Self: ... - def __sub__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ... - def __mul__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ... - def __truediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ... - def __itruediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ... + def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, _Numeric, str]]) -> _Self: ... + def __sub__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ... + def __mul__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ... + def __truediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ... + def __itruediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ... def __mod__(self: _Self, other: Union[int, Combinable]) -> _Self: ... - def __pow__(self: _Self, other: Union[float, Combinable]) -> _Self: ... + def __pow__(self: _Self, other: Union[_Numeric, Combinable]) -> _Self: ... def __and__(self: _Self, other: Combinable) -> _Self: ... def bitand(self: _Self, other: int) -> _Self: ... def bitleftshift(self: _Self, other: int) -> _Self: ... def bitrightshift(self: _Self, other: int) -> _Self: ... def __or__(self: _Self, other: Combinable) -> _Self: ... def bitor(self: _Self, other: int) -> _Self: ... - def __radd__(self, other: Optional[Union[datetime, float, Combinable]]) -> Combinable: ... - def __rsub__(self, other: Union[float, Combinable]) -> Combinable: ... - def __rmul__(self, other: Union[float, Combinable]) -> Combinable: ... - def __rtruediv__(self, other: Union[float, Combinable]) -> Combinable: ... + def __radd__(self, other: Optional[Union[datetime, _Numeric, Combinable]]) -> Combinable: ... + def __rsub__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... + def __rmul__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... + def __rtruediv__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... def __rmod__(self, other: Union[int, Combinable]) -> Combinable: ... - def __rpow__(self, other: Union[float, Combinable]) -> Combinable: ... + def __rpow__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... def __rand__(self, other: Any) -> Combinable: ... def __ror__(self, other: Any) -> Combinable: ...