Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
G
gracedb-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Pound Singer
gracedb-client
Commits
f409df5e
Verified
Commit
f409df5e
authored
Sep 13, 2018
by
Tanner Prestegard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding Python 3.4+ compatibility to CLI
parent
2661890a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
ligo/gracedb/cli.py
ligo/gracedb/cli.py
+11
-8
No files found.
ligo/gracedb/cli.py
View file @
f409df5e
...
...
@@ -42,13 +42,13 @@ def output(*message):
def
defaultAccess
(
e
,
a
):
if
a
.
find
(
'.'
)
<
0
:
return
st
r
(
e
.
get
(
a
,
""
))
return
rep
r
(
e
.
get
(
a
,
""
))
rv
=
e
attrs
=
a
.
split
(
'.'
)
while
attrs
and
rv
:
rv
=
rv
.
get
(
attrs
[
0
],
""
)
attrs
=
attrs
[
1
:]
return
st
r
(
rv
)
return
rep
r
(
rv
)
#-----------------------------------------------------------------
# HTTP upload encoding
...
...
@@ -99,6 +99,9 @@ def derive_client(ClientBase=GraceDb):
if
not
hasattr
(
destfile
,
'read'
):
if
destfile
==
'-'
:
destfile
=
sys
.
stdout
# Python 2/3 compatibility
if
hasattr
(
destfile
,
'buffer'
):
destfile
=
destfile
.
buffer
else
:
destfile
=
open
(
destfile
,
"wb"
)
shutil
.
copyfileobj
(
response
,
destfile
)
...
...
@@ -399,7 +402,7 @@ Longer strings will be truncated.""" % {
tagDispName
=
args
[
4
]
graceid
=
args
[
1
]
logN
=
args
[
2
]
response
=
client
.
create
Tag
(
graceid
,
logN
,
tagName
,
tagDispName
)
response
=
client
.
add
Tag
(
graceid
,
logN
,
tagName
,
tagDispName
)
elif
args
[
0
]
==
'delete_tag'
:
error
(
"len args = %s"
%
len
(
args
))
error
(
"args = %s"
%
args
)
...
...
@@ -413,7 +416,7 @@ Longer strings will be truncated.""" % {
tagName
=
args
[
3
]
graceid
=
args
[
1
]
logN
=
args
[
2
]
response
=
client
.
delet
eTag
(
graceid
,
logN
,
tagName
)
response
=
client
.
remov
eTag
(
graceid
,
logN
,
tagName
)
elif
args
[
0
]
==
'label'
:
if
len
(
args
)
!=
3
:
op
.
error
(
"wrong number of arguments for label"
)
...
...
@@ -449,7 +452,7 @@ Longer strings will be truncated.""" % {
else
:
accessFun
=
{
"labels"
:
lambda
e
:
\
","
.
join
(
list
(
e
[
'labels'
]
.
keys
()
)),
","
.
join
(
list
(
e
[
'labels'
])),
"dataurl"
:
lambda
e
:
e
[
'links'
][
'files'
],
}
...
...
@@ -513,7 +516,7 @@ Longer strings will be truncated.""" % {
except
:
rv
=
response
try
:
rv
=
json
.
loads
(
rv
)
rv
=
json
.
loads
(
rv
.
decode
()
)
except
:
pass
...
...
@@ -538,9 +541,9 @@ Longer strings will be truncated.""" % {
rv
=
response
try
:
responseBody
=
json
.
loads
(
rv
)
responseBody
=
json
.
loads
(
rv
.
decode
()
)
except
:
responseBody
=
rv
responseBody
=
rv
.
decode
()
if
status
>=
400
:
exitCode
=
1
...
...
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