X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=type%2Fmoney.py;h=39557aacdf79dc31ca6e48d27f367305325e80b8;hb=f2600f30801c849fc1d139386e3ddc3c9eb43e30;hp=d7e6ffa2197c629949ecae30c855df5870cc3a3a;hpb=6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668;p=python_utils.git 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__