getting superevents() method working

parent 74fbb22b
......@@ -711,7 +711,7 @@ class GraceDb(GsiRest):
uri += "?" + urlencode({'query': query})
return self.get(uri).json()['numRows']
def createSuperevent(self, t_start, t_0, t_end, preferred_event=None,
def createSuperevent(self, t_start, t_0, t_end, preferred_event,
events=[], labels=None):
"""
Create a superevent.
......@@ -723,12 +723,9 @@ class GraceDb(GsiRest):
preferred_event: graceid corresponding to event which will be set
as the preferred event for this superevent
events: list of graceids corresponding to events which
should be attached to this superevent
should be attached to this superevent (optional)
labels: list of labels which should be attached to this
superevent at creation
t_start, t_0, and t_end are required. One of preferred_event or
events is required. Labels are not required.
superevent at creation (optional)
Example:
......@@ -738,10 +735,6 @@ class GraceDb(GsiRest):
>>> r.status
201
"""
# Check arguments
if not (events or preferred_event):
raise ValueError('Either preferred_event or events should be set')
# Process label args - convert non-empty strings to list
# to ensure consistent processing
if labels:
......@@ -771,9 +764,8 @@ class GraceDb(GsiRest):
't_start': t_start,
't_0': t_0,
't_end': t_end,
'preferred_event': preferred_event,
}
if preferred_event:
request_body['preferred_event'] = preferred_event
if events:
request_body['events'] = events
if labels:
......
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