Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
itminedu
synnefo
Commits
2c055047
Commit
2c055047
authored
Aug 05, 2013
by
Christos Stavrakakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
astakosclient: PEP8 fixes
This commit makes astakosclient PEP8 compliant.
parent
1c821f5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
astakosclient/astakosclient/__init__.py
astakosclient/astakosclient/__init__.py
+2
-2
astakosclient/astakosclient/keypath.py
astakosclient/astakosclient/keypath.py
+6
-6
astakosclient/astakosclient/services.py
astakosclient/astakosclient/services.py
+1
-1
astakosclient/astakosclient/tests.py
astakosclient/astakosclient/tests.py
+4
-3
No files found.
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