DataViews/CodeMetrics.py

changeset 406
eacf81fad150
parent 96
9624a110667d
child 791
9ec2ac20e54e
--- a/DataViews/CodeMetrics.py	Sun Jul 25 17:08:39 2010 +0200
+++ b/DataViews/CodeMetrics.py	Mon Jul 26 15:45:23 2010 +0200
@@ -57,7 +57,7 @@
         text = Utilities.convertLineEnds(text, os.linesep)
         
         if not text.endswith(os.linesep):
-            text = "%s%s" % (text, os.linesep)
+            text = "{0}{1}".format(text, os.linesep)
             
         self.lines = text.count(os.linesep)
         
@@ -77,7 +77,7 @@
                 else:
                     self.__addToken(toktype, toktext, srow, scol, line)
         except tokenize.TokenError as msg:
-            print("Token Error: %s" % str(msg))
+            print("Token Error: {0}".format(str(msg)))
             return
         
         return
@@ -175,7 +175,7 @@
 
             for key in ('start', 'end', 'lines', 'nloc', 'comments', 'empty'):
                 if counters.get(key, 0):
-                    msg += " %5d" % (counters[key],)
+                    msg += " {0:d}".format(counters[key])
                 else:
                     msg += " " * 6
 
@@ -276,7 +276,7 @@
     print("\nSummary")
     for key in ['files', 'lines', 'bytes', 'comments',
                 'empty lines', 'non-commentary lines']:
-        print(key.ljust(20) + "%6d" % total[key])
+        print(key.ljust(20) + "{0:d}".format(total[key]))
     
     sys.exit(0)
 

eric ide

mercurial