Allowed to use decimal in combinables (#454)

Co-authored-by: Szymon Pyżalski <spyzalski@egnyte.com>
This commit is contained in:
Szymon Pyżalski
2020-09-21 14:00:32 +02:00
committed by GitHub
parent 5ff99fd047
commit 2f7fac2eaf

View File

@@ -1,4 +1,5 @@
from datetime import datetime, timedelta 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 typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Iterable
from django.db.models.lookups import Lookup from django.db.models.lookups import Lookup
@@ -15,6 +16,8 @@ class SQLiteNumericMixin:
_Self = TypeVar("_Self") _Self = TypeVar("_Self")
_Numeric = Union[float, Decimal]
class Combinable: class Combinable:
ADD: str = ... ADD: str = ...
SUB: str = ... SUB: str = ...
@@ -27,25 +30,25 @@ class Combinable:
BITLEFTSHIFT: str = ... BITLEFTSHIFT: str = ...
BITRIGHTSHIFT: str = ... BITRIGHTSHIFT: str = ...
def __neg__(self: _Self) -> _Self: ... def __neg__(self: _Self) -> _Self: ...
def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, float, str]]) -> _Self: ... def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, _Numeric, str]]) -> _Self: ...
def __sub__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ... def __sub__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ...
def __mul__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ... def __mul__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ...
def __truediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ... def __truediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ...
def __itruediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ... def __itruediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ...
def __mod__(self: _Self, other: Union[int, Combinable]) -> _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 __and__(self: _Self, other: Combinable) -> _Self: ...
def bitand(self: _Self, other: int) -> _Self: ... def bitand(self: _Self, other: int) -> _Self: ...
def bitleftshift(self: _Self, other: int) -> _Self: ... def bitleftshift(self: _Self, other: int) -> _Self: ...
def bitrightshift(self: _Self, other: int) -> _Self: ... def bitrightshift(self: _Self, other: int) -> _Self: ...
def __or__(self: _Self, other: Combinable) -> _Self: ... def __or__(self: _Self, other: Combinable) -> _Self: ...
def bitor(self: _Self, other: int) -> _Self: ... def bitor(self: _Self, other: int) -> _Self: ...
def __radd__(self, other: Optional[Union[datetime, float, Combinable]]) -> Combinable: ... def __radd__(self, other: Optional[Union[datetime, _Numeric, Combinable]]) -> Combinable: ...
def __rsub__(self, other: Union[float, Combinable]) -> Combinable: ... def __rsub__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
def __rmul__(self, other: Union[float, Combinable]) -> Combinable: ... def __rmul__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
def __rtruediv__(self, other: Union[float, Combinable]) -> Combinable: ... def __rtruediv__(self, other: Union[_Numeric, Combinable]) -> Combinable: ...
def __rmod__(self, other: Union[int, 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 __rand__(self, other: Any) -> Combinable: ...
def __ror__(self, other: Any) -> Combinable: ... def __ror__(self, other: Any) -> Combinable: ...