diff mercurial/lsprof.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 2372284d9457
children c59eb1560c44
line wrap: on
line diff
--- a/mercurial/lsprof.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/lsprof.py	Sun Oct 06 09:48:39 2019 -0400
@@ -8,7 +8,7 @@
 # PyPy doesn't expose profiler_entry from the module.
 profiler_entry = getattr(_lsprof, 'profiler_entry', None)
 
-__all__ = ['profile', 'Stats']
+__all__ = [b'profile', b'Stats']
 
 
 def profile(f, *args, **kwds):
@@ -33,9 +33,9 @@
         # profiler_entries isn't defined when running under PyPy.
         if profiler_entry:
             if crit not in profiler_entry.__dict__:
-                raise ValueError("Can't sort by %s" % crit)
+                raise ValueError(b"Can't sort by %s" % crit)
         elif self.data and not getattr(self.data[0], crit, None):
-            raise ValueError("Can't sort by %s" % crit)
+            raise ValueError(b"Can't sort by %s" % crit)
 
         self.data.sort(key=lambda x: getattr(x, crit), reverse=True)
         for e in self.data:
@@ -49,16 +49,16 @@
         d = self.data
         if top is not None:
             d = d[:top]
-        cols = "% 12d %12d %11.4f %11.4f   %s\n"
-        hcols = "% 12s %12s %12s %12s %s\n"
+        cols = b"% 12d %12d %11.4f %11.4f   %s\n"
+        hcols = b"% 12s %12s %12s %12s %s\n"
         file.write(
             hcols
             % (
-                "CallCount",
-                "Recursive",
-                "Total(s)",
-                "Inline(s)",
-                "module:lineno(function)",
+                b"CallCount",
+                b"Recursive",
+                b"Total(s)",
+                b"Inline(s)",
+                b"module:lineno(function)",
             )
         )
         count = 0
@@ -86,7 +86,7 @@
                             se.reccallcount,
                             se.totaltime,
                             se.inlinetime,
-                            "    %s" % label(se.code),
+                            b"    %s" % label(se.code),
                         )
                     )
                     count += 1
@@ -147,7 +147,7 @@
 
     sys.argv = sys.argv[1:]
     if not sys.argv:
-        print("usage: lsprof.py <script> <arguments...>", file=sys.stderr)
+        print(b"usage: lsprof.py <script> <arguments...>", file=sys.stderr)
         sys.exit(2)
     sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])))
     stats = profile(execfile, sys.argv[0], globals(), locals())