py3: use %d in a few places
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 12 Oct 2018 18:40:32 +0200
changeset 40197 113adb1b3f24
parent 40196 2864f8d3fcd6
child 40198 9d3034348c4f
py3: use %d in a few places Differential Revision: https://phab.mercurial-scm.org/D5014
mercurial/statprof.py
--- a/mercurial/statprof.py	Fri Oct 12 18:37:42 2018 +0200
+++ b/mercurial/statprof.py	Fri Oct 12 18:40:32 2018 +0200
@@ -360,11 +360,11 @@
     with open(path, 'w+') as file:
         file.write("%f %f\n" % state.accumulated_time)
         for sample in state.samples:
-            time = str(sample.time)
+            time = sample.time
             stack = sample.stack
             sites = ['\1'.join([s.path, str(s.lineno), s.function])
                      for s in stack]
-            file.write("%s\0%s\n" % (time, '\0'.join(sites)))
+            file.write("%d\0%s\n" % (time, '\0'.join(sites)))
 
 def load_data(path):
     lines = open(path, 'r').read().splitlines()
@@ -566,7 +566,7 @@
                 stattuple = (stat.selfpercent(), stat.selfseconds(),
                              stat.site.lineno, source)
 
-                print('%33.0f%% %6.2f   line %s: %s' % (stattuple), file=fp)
+                print('%33.0f%% %6.2f   line %d: %s' % (stattuple), file=fp)
 
 def display_about_method(data, fp, function=None, **kwargs):
     if function is None:
@@ -734,7 +734,7 @@
             lines[line] = 1
 
     for line, count in lines.iteritems():
-        file.write("%s %s\n" % (line, count))
+        file.write("%s %d\n" % (line, count))
 
     file.close()