Skip to content

Commit d2f7124

Browse files
committed
PIOTEAM-41. Change eventTime to event_time.
1 parent de0ff61 commit d2f7124

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

predictionio/__init__.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def delete_event(self, event_id):
180180

181181
## Below are helper functions
182182

183-
def aset_user(self, uid, properties={}, eventTime=None):
184-
eventTime = now_if_none(eventTime)
183+
def aset_user(self, uid, properties={}, event_time=None):
184+
event_time = now_if_none(event_time)
185185

186186
"""set properties of an user"""
187187
return self.acreate_event({
@@ -190,15 +190,15 @@ def aset_user(self, uid, properties={}, eventTime=None):
190190
"entityId" : uid,
191191
"properties" : properties,
192192
"appId" : self.app_id,
193-
"eventTime": eventTime.isoformat(),
193+
"eventTime": event_time.isoformat(),
194194
})
195195

196-
def set_user(self, uid, properties={}, eventTime=None):
197-
return self.aset_user(uid, properties, eventTime).get_response()
196+
def set_user(self, uid, properties={}, event_time=None):
197+
return self.aset_user(uid, properties, event_time).get_response()
198198

199-
def aunset_user(self, uid, properties, eventTime=None):
199+
def aunset_user(self, uid, properties, event_time=None):
200200
"""unset properties of an user"""
201-
eventTime = now_if_none(eventTime)
201+
event_time = now_if_none(event_time)
202202

203203
# check properties={}, it cannot be empty
204204
return self.acreate_event({
@@ -207,71 +207,71 @@ def aunset_user(self, uid, properties, eventTime=None):
207207
"entityId" : uid,
208208
"properties" : properties,
209209
"appId" : self.app_id,
210-
"eventTime": eventTime.isoformat(),
210+
"eventTime": event_time.isoformat(),
211211
})
212212

213-
def unset_user(self, uid, properties, eventTime=None):
214-
return self.aunset_user(uid, properties, eventTime).get_response()
213+
def unset_user(self, uid, properties, event_time=None):
214+
return self.aunset_user(uid, properties, event_time).get_response()
215215

216-
def adelete_user(self, uid, eventTime=None):
216+
def adelete_user(self, uid, event_time=None):
217217
"""set properties of an user"""
218-
eventTime = now_if_none(eventTime)
218+
event_time = now_if_none(event_time)
219219
return self.acreate_event({
220220
"event" : "$delete",
221221
"entityType" : "pio_user",
222222
"entityId" : uid,
223223
"appId": self.app_id,
224-
"eventTime": eventTime.isoformat(),
224+
"eventTime": event_time.isoformat(),
225225
})
226226

227-
def delete_user(self, uid, eventTime=None):
228-
return self.adelete_user(uid, eventTime).get_response()
227+
def delete_user(self, uid, event_time=None):
228+
return self.adelete_user(uid, event_time).get_response()
229229

230-
def aset_item(self, iid, properties={}, eventTime=None):
231-
eventTime = now_if_none(eventTime)
230+
def aset_item(self, iid, properties={}, event_time=None):
231+
event_time = now_if_none(event_time)
232232
return self.acreate_event({
233233
"event" : "$set",
234234
"entityType" : "pio_item",
235235
"entityId" : iid,
236236
"properties" : properties,
237237
"appId" : self.app_id,
238-
"eventTime": eventTime.isoformat(),
238+
"eventTime": event_time.isoformat(),
239239
})
240240

241-
def set_item(self, iid, properties={}, eventTime=None):
241+
def set_item(self, iid, properties={}, event_time=None):
242242
return self.aset_item(iid, properties).get_response()
243243

244-
def aunset_item(self, iid, properties={}, eventTime=None):
245-
eventTime = now_if_none(eventTime)
244+
def aunset_item(self, iid, properties={}, event_time=None):
245+
event_time = now_if_none(event_time)
246246
return self.acreate_event({
247247
"event" : "$unset",
248248
"entityType" : "pio_item",
249249
"entityId" : iid,
250250
"properties" : properties,
251251
"appId" : self.app_id,
252-
"eventTime": eventTime.isoformat(),
252+
"eventTime": event_time.isoformat(),
253253
})
254254

255-
def unset_item(self, iid, properties={}, eventTime=None):
256-
return self.aunset_item(iid, properties, eventTime).get_response()
255+
def unset_item(self, iid, properties={}, event_time=None):
256+
return self.aunset_item(iid, properties, event_time).get_response()
257257

258-
def adelete_item(self, iid, eventTime=None):
258+
def adelete_item(self, iid, event_time=None):
259259
"""set properties of an user"""
260-
eventTime = now_if_none(eventTime)
260+
event_time = now_if_none(event_time)
261261
return self.acreate_event({
262262
"event" : "$delete",
263263
"entityType" : "pio_item",
264264
"entityId" : iid,
265265
"appId": self.app_id,
266-
"eventTime": eventTime.isoformat(),
266+
"eventTime": event_time.isoformat(),
267267
})
268268

269-
def delete_item(self, iid, eventTime=None):
270-
return self.adelete_item(iid, eventTime).get_response()
269+
def delete_item(self, iid, event_time=None):
270+
return self.adelete_item(iid, event_time).get_response()
271271

272272
def arecord_user_action_on_item(self, action, uid, iid, properties={},
273-
eventTime=None):
274-
eventTime = now_if_none(eventTime)
273+
event_time=None):
274+
event_time = now_if_none(event_time)
275275
return self.acreate_event({
276276
"event" : action,
277277
"entityType" : "pio_user",
@@ -280,20 +280,20 @@ def arecord_user_action_on_item(self, action, uid, iid, properties={},
280280
"targetEntityId": iid,
281281
"properties" : properties,
282282
"appId" : self.app_id,
283-
"eventTime": eventTime.isoformat(),
283+
"eventTime": event_time.isoformat(),
284284
})
285285

286286
def record_user_action_on_item(self, action, uid, iid, properties={},
287-
eventTime=None):
287+
event_time=None):
288288
return self.arecord_user_action_on_item(
289-
action, uid, iid, properties, eventTime).get_response()
289+
action, uid, iid, properties, event_time).get_response()
290290

291291

292-
class PredictionClient(BaseClient):
292+
class EngineClient(BaseClient):
293293
"""Client for extracting prediction results from PredictionIO Engine."""
294294
def __init__(self, url="http://localhost:8000", threads=1,
295295
qsize=0, timeout=5):
296-
super(PredictionClient, self).__init__(url, threads, qsize, timeout)
296+
super(EngineClient, self).__init__(url, threads, qsize, timeout)
297297

298298
def asend_query(self, data):
299299
path = "/"

0 commit comments

Comments
 (0)