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, global-statement,
inherit-non-class, inherit-non-class,
invalid-name, invalid-name,
len-as-condition,
locally-disabled, locally-disabled,
logging-not-lazy, logging-not-lazy,
missing-docstring, missing-docstring,
multiple-imports, multiple-imports,
no-else-return,
no-init, no-init,
no-member, no-member,
no-self-use, no-self-use,
not-context-manager,
pointless-string-statement, pointless-string-statement,
protected-access, protected-access,
redefined-builtin, redefined-builtin,

View file

@ -316,9 +316,9 @@ class Config(object):
if data_type is not None: if data_type is not None:
self._assert_valid_data_type(data_type) self._assert_valid_data_type(data_type)
return self._data[data_type][name] return self._data[data_type][name]
for data_type in self._search_order: for possible_data_type in self._search_order:
if name in self._data[data_type]: if name in self._data[possible_data_type]:
return self._data[data_type][name] return self._data[possible_data_type][name]
raise KeyError('{} is not a valid setting'.format(name)) raise KeyError('{} is not a valid setting'.format(name))
def set(self, name, value, data_types=(TYPE_RUNTIME,)): 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", log.warning("A request of type '%s' failed. Reason: %s, Error type: %s",
request_type, reason.getErrorMessage(), reason.type) request_type, reason.getErrorMessage(), reason.type)
self.update_local_score(-10.0) 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) self.peer.update_score(-10.0)
else: else:
self.peer.update_score(-2.0) 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(): for k, v in obj.iteritems():
if k == 'amount' or k == 'effective_amount': if k == 'amount' or k == 'effective_amount':
obj[k] = float(obj[k]) 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) obj[k] = format_json_out_amount_as_float(v)
elif isinstance(obj, list): elif isinstance(obj, list):