diff mercurial/lsprof.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 56ea22fa55f0
children 687b865b95ad
line wrap: on
line diff
--- a/mercurial/lsprof.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/mercurial/lsprof.py	Sun Oct 06 09:45:02 2019 -0400
@@ -10,6 +10,7 @@
 
 __all__ = ['profile', 'Stats']
 
+
 def profile(f, *args, **kwds):
     """XXX docstring"""
     p = Profiler()
@@ -50,21 +51,44 @@
             d = d[:top]
         cols = "% 12d %12d %11.4f %11.4f   %s\n"
         hcols = "% 12s %12s %12s %12s %s\n"
-        file.write(hcols % ("CallCount", "Recursive", "Total(s)",
-                            "Inline(s)", "module:lineno(function)"))
+        file.write(
+            hcols
+            % (
+                "CallCount",
+                "Recursive",
+                "Total(s)",
+                "Inline(s)",
+                "module:lineno(function)",
+            )
+        )
         count = 0
         for e in d:
-            file.write(cols % (e.callcount, e.reccallcount, e.totaltime,
-                               e.inlinetime, label(e.code)))
+            file.write(
+                cols
+                % (
+                    e.callcount,
+                    e.reccallcount,
+                    e.totaltime,
+                    e.inlinetime,
+                    label(e.code),
+                )
+            )
             count += 1
             if limit is not None and count == limit:
                 return
             ccount = 0
             if climit and e.calls:
                 for se in e.calls:
-                    file.write(cols % (se.callcount, se.reccallcount,
-                                       se.totaltime, se.inlinetime,
-                                       "    %s" % label(se.code)))
+                    file.write(
+                        cols
+                        % (
+                            se.callcount,
+                            se.reccallcount,
+                            se.totaltime,
+                            se.inlinetime,
+                            "    %s" % label(se.code),
+                        )
+                    )
                     count += 1
                     ccount += 1
                     if limit is not None and count == limit:
@@ -87,8 +111,10 @@
                     if not isinstance(se.code, str):
                         e.calls[j] = type(se)((label(se.code),) + se[1:])
 
+
 _fn2mod = {}
 
+
 def label(code):
     if isinstance(code, str):
         if sys.version_info.major >= 3:
@@ -115,8 +141,10 @@
 
     return res
 
+
 if __name__ == '__main__':
     import os
+
     sys.argv = sys.argv[1:]
     if not sys.argv:
         print("usage: lsprof.py <script> <arguments...>", file=sys.stderr)