def __init__(self, amount=None, currency=DEFAULT_CURRENCY,
amount_raw=None):
if not (amount is None) ^ (amount_raw is None):
raise ValueError("You must specify an amount or a raw amount")
if not isinstance(currency, Currency):
raise TypeError("You must specify a valid Currency")
if amount is not None:
if not isinstance(amount, numbers.Real):
raise TypeError("Amount must be an integer or float")
amount_raw = int(amount * 10**currency.precision)
if not isinstance(amount_raw, numbers.Integral):
raise TypeError("Amount must be an integer or float")
self.amount_raw = amount_raw
self.currency = currency
money.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录