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
d71f7221
Verified
Commit
d71f7221
authored
May 31, 2018
by
Tanner Prestegard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup of utility functions
parent
50dc2dfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
ligo/gracedb/utils.py
ligo/gracedb/utils.py
+10
-9
No files found.
ligo/gracedb/utils.py
View file @
d71f7221
...
...
@@ -14,6 +14,7 @@ SUPEREVENT_PREFIXES = ['S', 'GW']
superevent_prefix_regex
=
re
.
compile
(
r
'^({prefixes})\d+'
.
format
(
prefixes
=
"|"
.
join
(
SUPEREVENT_PREFIXES
)))
# Decorator for class methods so that they work for events or superevents
def
event_or_superevent
(
func
):
@
wraps
(
func
)
...
...
@@ -35,7 +36,7 @@ def handle_str_or_list_arg(arg, arg_name):
elif
isinstance
(
arg
,
list
):
pass
else
:
raise
TypeError
(
"{0} arg is {1}, should be str or list"
\
raise
TypeError
(
"{0} arg is {1}, should be str or list"
.
format
(
arg_name
,
type
(
arg
)))
return
arg
...
...
@@ -50,7 +51,7 @@ def cleanListInput(list_arg):
stringified_value
=
str
(
list_arg
)
return
stringified_value
if
not
isinstance
(
list_arg
,
six
.
string_types
):
stringified_list
=
','
.
join
(
map
(
str
,
list_arg
))
stringified_list
=
','
.
join
(
map
(
str
,
list_arg
))
return
stringified_list
...
...
@@ -66,15 +67,15 @@ def get_dt_from_openssl_output(s):
# So we first have to split off the bit after the equal sign.
try
:
date_string
=
s
.
split
(
'='
)[
1
].
strip
()
except
:
err
=
'Openssl output not understood
.'
except
Exception
as
e
:
err
=
'Openssl output not understood
: {0}'
.
format
(
e
)
return
dt
,
err
# Next, attempt to parse the date with strptime.
try
:
dt
=
datetime
.
strptime
(
date_string
,
"%b %d %H:%M:%S %Y %Z"
)
except
:
err
=
'Could not parse time string from openssl
.'
except
Exception
as
e
:
err
=
'Could not parse time string from openssl
: {0}'
.
format
(
e
)
return
dt
,
err
return
dt
,
err
...
...
@@ -124,7 +125,7 @@ class safe_netrc(netrc):
file
)
if
(
prop
.
st_mode
&
(
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)):
raise
NetrcParseError
(
"~/.netrc access too permissive: access"
" permissions must restrict access to only"
" the owner"
,
file
)
"~/.netrc access too permissive: access"
" permissions must restrict access to only"
" the owner"
,
file
)
return
netrc
.
_parse
(
self
,
file
,
fp
,
*
args
,
**
kwargs
)
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