You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by sh...@apache.org on 2017/06/06 10:17:03 UTC

incubator-predictionio-template-similar-product git commit: Python 3 support

Repository: incubator-predictionio-template-similar-product
Updated Branches:
  refs/heads/develop 8a3e549da -> a0585011e


Python 3 support


Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/commit/a0585011
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/tree/a0585011
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/diff/a0585011

Branch: refs/heads/develop
Commit: a0585011e5a94a2198690c0f18c478b87c01fdd8
Parents: 8a3e549
Author: Shinsuke Sugaya <sh...@apache.org>
Authored: Tue Jun 6 19:13:01 2017 +0900
Committer: Shinsuke Sugaya <sh...@yahoo.co.jp>
Committed: Tue Jun 6 19:13:01 2017 +0900

----------------------------------------------------------------------
 data/import_eventserver.py | 14 +++++++-------
 data/send_query.py         |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/blob/a0585011/data/import_eventserver.py
----------------------------------------------------------------------
diff --git a/data/import_eventserver.py b/data/import_eventserver.py
index 452358d..da5a604 100644
--- a/data/import_eventserver.py
+++ b/data/import_eventserver.py
@@ -11,13 +11,13 @@ SEED = 3
 def import_events(client):
   random.seed(SEED)
   count = 0
-  print client.get_status()
-  print "Importing data..."
+  print(client.get_status())
+  print("Importing data...")
 
   # generate 10 users, with user ids u1,u2,....,u10
   user_ids = ["u%s" % i for i in range(1, 11)]
   for user_id in user_ids:
-    print "Set user", user_id
+    print("Set user", user_id)
     client.create_event(
       event="$set",
       entity_type="user",
@@ -30,7 +30,7 @@ def import_events(client):
   categories = ["c%s" % i for i in range(1, 7)]
   item_ids = ["i%s" % i for i in range(1, 51)]
   for item_id in item_ids:
-    print "Set item", item_id
+    print("Set item", item_id)
     client.create_event(
       event="$set",
       entity_type="item",
@@ -44,7 +44,7 @@ def import_events(client):
   # each user randomly viewed 10 items
   for user_id in user_ids:
     for viewed_item in random.sample(item_ids, 10):
-      print "User", user_id ,"views item", viewed_item
+      print("User", user_id ,"views item", viewed_item)
       client.create_event(
         event="view",
         entity_type="user",
@@ -54,7 +54,7 @@ def import_events(client):
       )
       count += 1
 
-  print "%s events are imported." % count
+  print("%s events are imported." % count)
 
 if __name__ == '__main__':
   parser = argparse.ArgumentParser(
@@ -63,7 +63,7 @@ if __name__ == '__main__':
   parser.add_argument('--url', default="http://localhost:7070")
 
   args = parser.parse_args()
-  print args
+  print(args)
 
   client = predictionio.EventClient(
     access_key=args.access_key,

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/blob/a0585011/data/send_query.py
----------------------------------------------------------------------
diff --git a/data/send_query.py b/data/send_query.py
index f6d9c61..145d107 100644
--- a/data/send_query.py
+++ b/data/send_query.py
@@ -4,4 +4,4 @@ Send sample query to prediction engine
 
 import predictionio
 engine_client = predictionio.EngineClient(url="http://localhost:8000")
-print engine_client.send_query({"items": ["i1", "i3"], "num": 4})
+print(engine_client.send_query({"items": ["i1", "i3"], "num": 4}))