diff tools/load_tracker.py @ 5376:64b05e24dbd8

Python 3 preparation: convert print to a function. Tool-assisted patch. It is possible that some "from __future__ import print_function" are not in fact needed, if a file only uses print() with a single string as an argument and so would work fine in Python 2 without that import.
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 09:54:52 +0000
parents 6e9b9743de89
children 2120f77554d5
line wrap: on
line diff
--- a/tools/load_tracker.py	Sat Jul 21 23:07:16 2018 +1000
+++ b/tools/load_tracker.py	Tue Jul 24 09:54:52 2018 +0000
@@ -5,13 +5,14 @@
 Load up the indicated tracker with N issues and N/100 users.
 '''
 
+from __future__ import print_function
 import sys, os, random
 from roundup import instance
 
 # open the instance
 if len(sys.argv) < 2:
-    print "Error: Not enough arguments"
-    print __doc__.strip()%(sys.argv[0])
+    print("Error: Not enough arguments")
+    print(__doc__.strip()%(sys.argv[0]))
     sys.exit(1)
 tracker_home = sys.argv[1]
 N = int(sys.argv[2])
@@ -58,7 +59,7 @@
         # add some users
         M = N/100
         for i in range(M):
-            print '\ruser', i, '       ',
+            print('\ruser', i, '       ', end=' ')
             sys.stdout.flush()
             if i/17 == 0:
                 db.user.create(username=names[i%17])
@@ -68,11 +69,11 @@
     # assignable user list
     users = db.user.list()
     users.remove(db.user.lookup('anonymous'))
-    print
+    print()
 
     # now create the issues
     for i in range(N):
-        print '\rissue', i, '       ',
+        print('\rissue', i, '       ', end=' ')
         sys.stdout.flush()
         # in practise, about 90% of issues are resolved
         if random.random() > .9:
@@ -86,7 +87,7 @@
             assignedto=random.choice(users))
         if not i%1000:
             db.commit()
-    print
+    print()
 
     db.commit()
 finally:

Roundup Issue Tracker: http://roundup-tracker.org/