Skip to content

Commit

Permalink
refactor: simpler type specification for Numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobi-De committed Aug 10, 2023
1 parent 83cbe39 commit 21378d0
Showing 1 changed file with 5 additions and 43 deletions.
48 changes: 5 additions & 43 deletions dj_shop_cart/protocols.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from __future__ import annotations

from decimal import Decimal
from django.http import HttpRequest

try:
from typing import Protocol
from typing import Protocol, Union
except ImportError:
from typing_extensions import Protocol


from django.http import HttpRequest
Numeric = Union[float, int, Decimal]


class Storage(Protocol):
Expand All @@ -20,44 +23,3 @@ def save(self, data: dict) -> None:

def clear(self) -> None:
...


class Numeric(Protocol):
def __add__(self, *args, **kwargs) -> Numeric:
...

def __sub__(self, *args, **kwargs) -> Numeric:
...

def __mul__(self, *args, **kwargs) -> Numeric:
...

def __truediv__(self, *args, **kwargs) -> Numeric:
...

def __floordiv__(self, *args, **kwargs) -> Numeric:
...

def __mod__(self, *args, **kwargs) -> Numeric:
...

def __pow__(self, *args, **kwargs) -> Numeric:
...

def __lt__(self, *args, **kwargs) -> bool:
...

def __le__(self, *args, **kwargs) -> bool:
...

def __eq__(self, *args, **kwargs) -> bool:
...

def __ne__(self, *args, **kwargs) -> bool:
...

def __gt__(self, *args, **kwargs) -> bool:
...

def __ge__(self, *args, **kwargs) -> bool:
...

0 comments on commit 21378d0

Please sign in to comment.