This commit is contained in:
Alex Grintsvayg 2017-04-19 16:00:36 -04:00
parent d2f01a214d
commit 492cbc83c9
4 changed files with 8 additions and 5 deletions

View file

@ -82,13 +82,16 @@ disable=
global-statement,
inherit-non-class,
invalid-name,
len-as-condition,
locally-disabled,
logging-not-lazy,
missing-docstring,
multiple-imports,
no-else-return,
no-init,
no-member,
no-self-use,
not-context-manager,
pointless-string-statement,
protected-access,
redefined-builtin,

View file

@ -316,9 +316,9 @@ class Config(object):
if data_type is not None:
self._assert_valid_data_type(data_type)
return self._data[data_type][name]
for data_type in self._search_order:
if name in self._data[data_type]:
return self._data[data_type][name]
for possible_data_type in self._search_order:
if name in self._data[possible_data_type]:
return self._data[possible_data_type][name]
raise KeyError('{} is not a valid setting'.format(name))
def set(self, name, value, data_types=(TYPE_RUNTIME,)):

View file

@ -215,7 +215,7 @@ class RequestHelper(object):
log.warning("A request of type '%s' failed. Reason: %s, Error type: %s",
request_type, reason.getErrorMessage(), reason.type)
self.update_local_score(-10.0)
if isinstance(reason, InvalidResponseError) or isinstance(reason, NoResponseError):
if isinstance(reason, (InvalidResponseError, NoResponseError)):
self.peer.update_score(-10.0)
else:
self.peer.update_score(-2.0)

View file

@ -2745,7 +2745,7 @@ def format_json_out_amount_as_float(obj):
for k, v in obj.iteritems():
if k == 'amount' or k == 'effective_amount':
obj[k] = float(obj[k])
if isinstance(v, dict) or isinstance(v, list):
if isinstance(v, (dict, list)):
obj[k] = format_json_out_amount_as_float(v)
elif isinstance(obj, list):