diff mercurial/dagparser.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 e7aa113b14f7
children 687b865b95ad
line wrap: on
line diff
--- a/mercurial/dagparser.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/mercurial/dagparser.py	Sun Oct 06 09:45:02 2019 -0400
@@ -15,9 +15,8 @@
     error,
     pycompat,
 )
-from .utils import (
-    stringutil,
-)
+from .utils import stringutil
+
 
 def parsedag(desc):
     '''parses a DAG from a concise textual description; generates events
@@ -267,7 +266,7 @@
             p1 = -1
             c = nextch()
         elif c == '\0':
-            return # in case it was preceded by whitespace
+            return  # in case it was preceded by whitespace
         else:
             s = ''
             i = 0
@@ -275,17 +274,21 @@
                 s += c
                 i += 1
                 c = nextch()
-            raise error.Abort(_('invalid character in dag description: '
-                               '%s...') % s)
+            raise error.Abort(
+                _('invalid character in dag description: ' '%s...') % s
+            )
+
 
-def dagtextlines(events,
-                 addspaces=True,
-                 wraplabels=False,
-                 wrapannotations=False,
-                 wrapcommands=False,
-                 wrapnonlinear=False,
-                 usedots=False,
-                 maxlinewidth=70):
+def dagtextlines(
+    events,
+    addspaces=True,
+    wraplabels=False,
+    wrapannotations=False,
+    wrapcommands=False,
+    wrapnonlinear=False,
+    usedots=False,
+    maxlinewidth=70,
+):
     '''generates single lines for dagtext()'''
 
     def wrapstring(text):
@@ -310,8 +313,13 @@
                 else:
                     for p in ps:
                         if p >= r:
-                            raise error.Abort(_("parent id %i is larger than "
-                                               "current id %i") % (p, r))
+                            raise error.Abort(
+                                _(
+                                    "parent id %i is larger than "
+                                    "current id %i"
+                                )
+                                % (p, r)
+                            )
                 wantr += 1
 
                 # new root?
@@ -372,10 +380,13 @@
                     yield '#' + data
                     yield '\n'
                 else:
-                    raise error.Abort(_("invalid event type in dag: "
-                                        "('%s', '%s')")
-                                      % (stringutil.escapestr(kind),
-                                         stringutil.escapestr(data)))
+                    raise error.Abort(
+                        _("invalid event type in dag: " "('%s', '%s')")
+                        % (
+                            stringutil.escapestr(kind),
+                            stringutil.escapestr(data),
+                        )
+                    )
         if run:
             yield '+%d' % run
 
@@ -395,14 +406,17 @@
     if line:
         yield line
 
-def dagtext(dag,
-            addspaces=True,
-            wraplabels=False,
-            wrapannotations=False,
-            wrapcommands=False,
-            wrapnonlinear=False,
-            usedots=False,
-            maxlinewidth=70):
+
+def dagtext(
+    dag,
+    addspaces=True,
+    wraplabels=False,
+    wrapannotations=False,
+    wrapcommands=False,
+    wrapnonlinear=False,
+    usedots=False,
+    maxlinewidth=70,
+):
     '''generates lines of a textual representation for a dag event stream
 
     events should generate what parsedag() does, so:
@@ -480,11 +494,15 @@
         '+1 :f +1 :p2 *f */p2'
 
     '''
-    return "\n".join(dagtextlines(dag,
-                                  addspaces,
-                                  wraplabels,
-                                  wrapannotations,
-                                  wrapcommands,
-                                  wrapnonlinear,
-                                  usedots,
-                                  maxlinewidth))
+    return "\n".join(
+        dagtextlines(
+            dag,
+            addspaces,
+            wraplabels,
+            wrapannotations,
+            wrapcommands,
+            wrapnonlinear,
+            usedots,
+            maxlinewidth,
+        )
+    )