diff contrib/catapipe.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 ff562d711919
children 6000f5b25c9b
line wrap: on
line diff
--- a/contrib/catapipe.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/contrib/catapipe.py	Sun Oct 06 09:45:02 2019 -0400
@@ -53,15 +53,28 @@
 # Python version and OS
 timer = timeit.default_timer
 
+
 def main():
     parser = argparse.ArgumentParser()
-    parser.add_argument('pipe', type=str, nargs=1,
-                        help='Path of named pipe to create and listen on.')
-    parser.add_argument('output', default='trace.json', type=str, nargs='?',
-                        help='Path of json file to create where the traces '
-                             'will be stored.')
-    parser.add_argument('--debug', default=False, action='store_true',
-                        help='Print useful debug messages')
+    parser.add_argument(
+        'pipe',
+        type=str,
+        nargs=1,
+        help='Path of named pipe to create and listen on.',
+    )
+    parser.add_argument(
+        'output',
+        default='trace.json',
+        type=str,
+        nargs='?',
+        help='Path of json file to create where the traces ' 'will be stored.',
+    )
+    parser.add_argument(
+        '--debug',
+        default=False,
+        action='store_true',
+        help='Print useful debug messages',
+    )
     args = parser.parse_args()
     fn = args.pipe[0]
     os.mkfifo(fn)
@@ -86,19 +99,23 @@
                     payload_args = {}
                 pid = _threadmap[session]
                 ts_micros = (now - start) * 1000000
-                out.write(json.dumps(
-                    {
-                        "name": label,
-                        "cat": "misc",
-                        "ph": _TYPEMAP[verb],
-                        "ts": ts_micros,
-                        "pid": pid,
-                        "tid": 1,
-                        "args": payload_args,
-                    }))
+                out.write(
+                    json.dumps(
+                        {
+                            "name": label,
+                            "cat": "misc",
+                            "ph": _TYPEMAP[verb],
+                            "ts": ts_micros,
+                            "pid": pid,
+                            "tid": 1,
+                            "args": payload_args,
+                        }
+                    )
+                )
                 out.write(',\n')
     finally:
         os.unlink(fn)
 
+
 if __name__ == '__main__':
     main()