Example #1
0
File: conf.py Project: hyn6014/lbry
 def _parse_list(l):
     assert len(
         l) == 2, 'Max key fee is made up of two values: "AMOUNT CURRENCY".'
     try:
         amount = float(l[0])
     except ValueError:
         raise AssertionError(
             'First value in max key fee is a decimal: "AMOUNT CURRENCY"')
     currency = str(l[1]).upper()
     if currency not in CURRENCIES:
         raise InvalidCurrencyError(currency)
     return {'amount': amount, 'currency': currency}
Example #2
0
File: conf.py Project: hyn6014/lbry
 def validate(self, value):
     if value is not None:
         assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \
             f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"."
         if value["currency"] not in CURRENCIES:
             raise InvalidCurrencyError(value["currency"])