Skip to content

Commit 2f7fac2

Browse files
zefciuSzymon Pyżalski
and
Szymon Pyżalski
authored
Allowed to use decimal in combinables (#454)
Co-authored-by: Szymon Pyżalski <[email protected]>
1 parent 5ff99fd commit 2f7fac2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

django-stubs/db/models/expressions.pyi

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime, timedelta
2+
from decimal import Decimal
23
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Iterable
34

45
from django.db.models.lookups import Lookup
@@ -15,6 +16,8 @@ class SQLiteNumericMixin:
1516

1617
_Self = TypeVar("_Self")
1718

19+
_Numeric = Union[float, Decimal]
20+
1821
class Combinable:
1922
ADD: str = ...
2023
SUB: str = ...
@@ -27,25 +30,25 @@ class Combinable:
2730
BITLEFTSHIFT: str = ...
2831
BITRIGHTSHIFT: str = ...
2932
def __neg__(self: _Self) -> _Self: ...
30-
def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, float, str]]) -> _Self: ...
31-
def __sub__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ...
32-
def __mul__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ...
33-
def __truediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ...
34-
def __itruediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ...
33+
def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, _Numeric, str]]) -> _Self: ...
34+
def __sub__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ...
35+
def __mul__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ...
36+
def __truediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ...
37+
def __itruediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ...
3538
def __mod__(self: _Self, other: Union[int, Combinable]) -> _Self: ...
36-
def __pow__(self: _Self, other: Union[float, Combinable]) -> _Self: ...
39+
def __pow__(self: _Self, other: Union[_Numeric, Combinable]) -> _Self: ...
3740
def __and__(self: _Self, other: Combinable) -> _Self: ...
3841
def bitand(self: _Self, other: int) -> _Self: ...
3942
def bitleftshift(self: _Self, other: int) -> _Self: ...
4043
def bitrightshift(self: _Self, other: int) -> _Self: ...
4144
def __or__(self: _Self, other: Combinable) -> _Self: ...
4245
def bitor(self: _Self, other: int) -> _Self: ...
43-
def __radd__(self, other: Optional[Union[datetime, float, Combinable]]) -> Combinable: ...
44-
def __rsub__(self, other: Union[float, Combinable]) -> Combinable: ...
45-
def __rmul__(self, other: Union[float, Combinable]) -> Combinable: ...
46-
def __rtruediv__(self, other: Union[float, Combinable]) -> Combinable: ...
46+
def __radd__(self, other: Optional[Union[datetime, _Numeric, Combinable]]) -> Combinable: ...
47+
def __rsub__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
48+
def __rmul__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
49+
def __rtruediv__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
4750
def __rmod__(self, other: Union[int, Combinable]) -> Combinable: ...
48-
def __rpow__(self, other: Union[float, Combinable]) -> Combinable: ...
51+
def __rpow__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
4952
def __rand__(self, other: Any) -> Combinable: ...
5053
def __ror__(self, other: Any) -> Combinable: ...
5154

0 commit comments

Comments
 (0)