Commit 2c055047 authored by Christos Stavrakakis's avatar Christos Stavrakakis

astakosclient: PEP8 fixes

This commit makes astakosclient PEP8 compliant.
parent 1c821f5c
......@@ -201,8 +201,8 @@ class AstakosClient():
else:
return None
except Exception as err:
self.logger.error("Cannot parse response \"%s\" with simplejson: %s"
% (data, str(err)))
msg = "Cannot parse response \"%s\" with simplejson: %s"
self.logger.error(msg % (data, str(err)))
raise InvalidResponse(str(err), data)
# ------------------------
......
......@@ -30,6 +30,7 @@
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
import copy
def dict_merge(a, b):
......@@ -119,10 +120,9 @@ def del_path(container, path, sep='.', collect=True):
"""
name_path, node_path, basename = \
lookup_path(container, path, sep=sep, createpath=False)
lookup_path(container, path, sep=sep, createpath=False)
lastnode = node_path.pop()
lastname = basename
try:
if basename in lastnode:
del lastnode[basename]
......@@ -157,7 +157,7 @@ def get_path(container, path, sep='.'):
"""
name_path, node_path, basename = \
lookup_path(container, path, sep=sep, createpath=False)
lookup_path(container, path, sep=sep, createpath=False)
name_path.append(basename)
node = node_path[-1]
......@@ -186,16 +186,16 @@ def set_path(container, path, value, sep='.',
Traceback (most recent call last):
KeyError: "'a.b.x': path not found"
>>> set_path({'a': {'b': {'c': 'd'}}}, 'a.b.x.d', 1, createpath=True)
>>> set_path({'a': {'b': {'c': 'd'}}}, 'a.b.c', 1)
>>> set_path({'a': {'b': {'c': 'd'}}}, 'a.b.c', 1, overwrite=False)
Traceback (most recent call last):
ValueError: will not overwrite path 'a.b.c'
"""
name_path, node_path, basename = \
lookup_path(container, path, sep=sep, createpath=createpath)
lookup_path(container, path, sep=sep, createpath=createpath)
name_path.append(basename)
node = node_path[-1]
......
......@@ -49,8 +49,8 @@ astakos_services = {
'service_type': "account",
'service_origin': "astakos_account",
'allow_in_projects': False},
},
},
},
'astakos_identity': {
'type': 'identity',
......
......@@ -1046,8 +1046,8 @@ class TestCommissions(unittest.TestCase):
global token_1, commission_description
_mock_request([_request_ok])
try:
client = \
AstakosClient("https://example.com", use_pool=True, pool_size=2)
client = AstakosClient("https://example.com", use_pool=True,
pool_size=2)
response = client.get_commission_info(token_1, 57)
except Exception as err:
self.fail("Shouldn't raise Exception %s" % err)
......@@ -1142,7 +1142,8 @@ class TestCommissions(unittest.TestCase):
_mock_request([_request_ok])
try:
client = AstakosClient("https://example.com")
result = client.resolve_commissions(token_1, [56, 57], [56, 58, 59])
result = client.resolve_commissions(token_1, [56, 57],
[56, 58, 59])
except Exception as err:
self.fail("Shouldn't raise Exception %s" % err)
self.assertEqual(result, resolve_commissions_rep)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment