diff options
Diffstat (limited to 'type')
| -rw-r--r-- | type/centcount.py | 15 | ||||
| -rw-r--r-- | type/locations.py | 1 | ||||
| -rw-r--r-- | type/money.py | 15 | ||||
| -rw-r--r-- | type/people.py | 1 |
4 files changed, 21 insertions, 11 deletions
diff --git a/type/centcount.py b/type/centcount.py index 13f14b7..2cb99e0 100644 --- a/type/centcount.py +++ b/type/centcount.py @@ -50,7 +50,8 @@ class CentCount(object): if isinstance(other, CentCount): if self.currency == other.currency: return CentCount( - centcount=self.centcount + other.centcount, currency=self.currency + centcount=self.centcount + other.centcount, + currency=self.currency, ) else: raise TypeError('Incompatible currencies in add expression') @@ -64,7 +65,8 @@ class CentCount(object): if isinstance(other, CentCount): if self.currency == other.currency: return CentCount( - centcount=self.centcount - other.centcount, currency=self.currency + centcount=self.centcount - other.centcount, + currency=self.currency, ) else: raise TypeError('Incompatible currencies in add expression') @@ -79,7 +81,8 @@ class CentCount(object): raise TypeError('can not multiply monetary quantities') else: return CentCount( - centcount=int(self.centcount * float(other)), currency=self.currency + centcount=int(self.centcount * float(other)), + currency=self.currency, ) def __truediv__(self, other): @@ -113,7 +116,8 @@ class CentCount(object): if isinstance(other, CentCount): if self.currency == other.currency: return CentCount( - centcount=other.centcount - self.centcount, currency=self.currency + centcount=other.centcount - self.centcount, + currency=self.currency, ) else: raise TypeError('Incompatible currencies in sub expression') @@ -122,7 +126,8 @@ class CentCount(object): raise TypeError('In strict_mode only two moneys can be added') else: return CentCount( - centcount=int(other) - self.centcount, currency=self.currency + centcount=int(other) - self.centcount, + currency=self.currency, ) __rmul__ = __mul__ diff --git a/type/locations.py b/type/locations.py index 744f63a..24ab063 100644 --- a/type/locations.py +++ b/type/locations.py @@ -2,6 +2,7 @@ import enum + @enum.unique class Location(enum.Enum): UNKNOWN = 0 diff --git a/type/money.py b/type/money.py index d7e6ffa..39557aa 100644 --- a/type/money.py +++ b/type/money.py @@ -60,7 +60,8 @@ class Money(object): raise TypeError('In strict_mode only two moneys can be added') else: return Money( - amount=self.amount + Decimal(float(other)), currency=self.currency + amount=self.amount + Decimal(float(other)), + currency=self.currency, ) def __sub__(self, other): @@ -74,7 +75,8 @@ class Money(object): raise TypeError('In strict_mode only two moneys can be added') else: return Money( - amount=self.amount - Decimal(float(other)), currency=self.currency + amount=self.amount - Decimal(float(other)), + currency=self.currency, ) def __mul__(self, other): @@ -82,7 +84,8 @@ class Money(object): raise TypeError('can not multiply monetary quantities') else: return Money( - amount=self.amount * Decimal(float(other)), currency=self.currency + amount=self.amount * Decimal(float(other)), + currency=self.currency, ) def __truediv__(self, other): @@ -90,7 +93,8 @@ class Money(object): raise TypeError('can not divide monetary quantities') else: return Money( - amount=self.amount / Decimal(float(other)), currency=self.currency + amount=self.amount / Decimal(float(other)), + currency=self.currency, ) def __float__(self): @@ -119,7 +123,8 @@ class Money(object): raise TypeError('In strict_mode only two moneys can be added') else: return Money( - amount=Decimal(float(other)) - self.amount, currency=self.currency + amount=Decimal(float(other)) - self.amount, + currency=self.currency, ) __rmul__ = __mul__ diff --git a/type/people.py b/type/people.py index 1dc0421..1230db2 100644 --- a/type/people.py +++ b/type/people.py @@ -11,4 +11,3 @@ class Person(enum.Enum): AARON_AND_DANA = 4 AARON = 4 DANA = 4 - |
