forked from LBRYCommunity/lbry-sdk
refactor asserts due to PYTHONOPTIMIZE flag
This commit is contained in:
parent
777cda2cd3
commit
4f6f226b18
3 changed files with 9 additions and 6 deletions
|
@ -28,6 +28,7 @@ at anytime.
|
|||
* Announcing by head blob is turned on by default
|
||||
* Updated reflector server dns
|
||||
* Moved tests into the lbrynet package.
|
||||
* Refactor some assert statements to accommodate the PYTHONOPTIMIZE flag set for Android.
|
||||
|
||||
### Added
|
||||
* Added WAL pragma to sqlite3
|
||||
|
|
|
@ -361,8 +361,8 @@ class Config(object):
|
|||
return name in self.get_valid_setting_names()
|
||||
|
||||
def _assert_valid_setting(self, name):
|
||||
assert self._is_valid_setting(name), \
|
||||
KeyError('{} is not a valid setting'.format(name))
|
||||
if not self._is_valid_setting(name):
|
||||
raise AssertionError(KeyError('{} is not a valid setting'.format(name)))
|
||||
|
||||
def _validate_settings(self, data):
|
||||
invalid_settings = set(data.keys()) - set(self.get_valid_setting_names())
|
||||
|
@ -371,8 +371,8 @@ class Config(object):
|
|||
|
||||
def _assert_editable_setting(self, name):
|
||||
self._assert_valid_setting(name)
|
||||
assert name not in self._fixed_defaults, \
|
||||
ValueError('{} is not an editable setting'.format(name))
|
||||
if name in self._fixed_defaults:
|
||||
raise AssertionError(ValueError('{} is not an editable setting'.format(name)))
|
||||
|
||||
def _validate_currency(self, currency):
|
||||
if currency not in self._fixed_defaults['CURRENCIES'].keys():
|
||||
|
|
|
@ -17,8 +17,10 @@ COINBASE_FEE = 0.0 #add fee
|
|||
|
||||
class ExchangeRate(object):
|
||||
def __init__(self, market, spot, ts):
|
||||
assert int(time.time()) - ts < 600
|
||||
assert spot > 0
|
||||
if not int(time.time()) - ts < 600:
|
||||
raise AssertionError()
|
||||
if not spot > 0:
|
||||
raise AssertionError()
|
||||
self.currency_pair = (market[0:3], market[3:6])
|
||||
self.spot = spot
|
||||
self.ts = ts
|
||||
|
|
Loading…
Reference in a new issue