Browse Source

Fix `print` syntax

Matteo Bonamassa 9 months ago
parent
commit
4ab2fa948a
1 changed files with 17 additions and 17 deletions
  1. 17 17
      whoall

+ 17 - 17
whoall

@@ -220,10 +220,10 @@ class Node(Thread):
                 strchuck += str(item) +' '
 
         # Print out hostname and connected users
-        print ' ' + self.qualifiedname() + ' '*(15-len(self.qualifiedname())) \
+        print(' ' + self.qualifiedname() + ' '*(15-len(self.qualifiedname())) \
                 + red + strlgod + normal + pink + strrgod + normal + green \
                 + strlocal + normal + blue + strremote + normal \
-                + turquoise + strchuck + normal
+                + turquoise + strchuck + normal)
 ### end class Node
 
 
@@ -335,7 +335,7 @@ for node in nodes:
 
 # Used for progressbar
 index = 0
-print ' Querying ' + str(num) + ' hosts...'
+print(' Querying ' + str(num) + ' hosts...')
 
 # Rejoin them when their work is done
 # NB a progress bar does not make much sense if join is not asynchronous (blue)
@@ -352,7 +352,7 @@ for node in nodes:
 
 if progressbar:
     # Newline
-    print '\n Done... (%(t).3f s)' % {'t': (time() - start)}
+    print('\n Done... (%(t).3f s)' % {'t': (time() - start)})
 
 if args.full or args.math or args.cuda:
 # Save down/unreachable/unavailable nodes to separate lists
@@ -382,37 +382,37 @@ cudanodes = [ node for node in nodes if node.location == 'CUDA' ]
 
 # Print out
 if len(lcm1nodes):
-    print splitters['LCM1']
+    print(splitters['LCM1'])
     for node in lcm1nodes:
         node.printlist()
 if len(lcm2nodes):
-    print splitters['LCM2']
+    print(splitters['LCM2'])
     for node in lcm2nodes:
         node.printlist()
 if len(cudanodes):
-    print splitters['CUDA']
+    print(splitters['CUDA'])
     for node in cudanodes:
         node.printlist()
 
 # Some final output
 if progressbar > 0:
-    print
-    print 'Legenda: ' + green + 'utente locale '+ normal \
+    print("\n")
+    print('Legenda: ' + green + 'utente locale '+ normal \
           + blue + 'utente remoto ' + normal + red + 'admin locale ' + normal \
-          + pink + 'admin remoto ' + normal + turquoise + 'nirvana' + normal
+          + pink + 'admin remoto ' + normal + turquoise + 'nirvana' + normal)
     # FIXME I don't think we need this. Cuda nodes have their own section
     # print "         I nodi contrassegnati con [C] sono i nodi CUDA."
     if args.math:
-        print "         I nodi contrassegnati con [M4] hanno Mathematica 4.0"
-        print "         I nodi contrassegnati con [M5] hanno Mathematica 5.2"
-    print
+        print("         I nodi contrassegnati con [M4] hanno Mathematica 4.0")
+        print("         I nodi contrassegnati con [M5] hanno Mathematica 5.2")
+    print("\n")
 
 # Only in full mode
 if args.full or args.math or args.cuda:
-    print red+'Empty: '+normal+emptylist
-    print red+'Timeout: '+normal+timeoutlist
-    print red+'Unreachable: '+normal+downlist
-    print red+'Unavailable: '+normal+unavlist
+    print(red+'Empty: '+normal+emptylist)
+    print(red+'Timeout: '+normal+timeoutlist)
+    print(red+'Unreachable: '+normal+downlist)
+    print(red+'Unavailable: '+normal+unavlist)
 
 # Exit gracefully
 exit(0)