Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
2c055047
Commit
2c055047
authored
Aug 05, 2013
by
Christos Stavrakakis
Browse files
astakosclient: PEP8 fixes
This commit makes astakosclient PEP8 compliant.
parent
1c821f5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
astakosclient/astakosclient/__init__.py
View file @
2c055047
...
...
@@ -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
)
# ------------------------
...
...
astakosclient/astakosclient/keypath.py
View file @
2c055047
...
...
@@ -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
]
...
...
astakosclient/astakosclient/services.py
View file @
2c055047
...
...
@@ -49,8 +49,8 @@ astakos_services = {
'service_type'
:
"account"
,
'service_origin'
:
"astakos_account"
,
'allow_in_projects'
:
False
},
},
},
},
'astakos_identity'
:
{
'type'
:
'identity'
,
...
...
astakosclient/astakosclient/tests.py
View file @
2c055047
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment