Patchwork D8104: cleanup: re-run black on the codebase

login
register
mail settings
Submitter phabricator
Date Feb. 10, 2020, 10:34 p.m.
Message ID <differential-rev-PHID-DREV-bz7jgcxwfip2fhvw4hmc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45090/
State Superseded
Headers show

Comments

phabricator - Feb. 10, 2020, 10:34 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Looks like a few patches have landed without having been blackened. I
  strongly suspect I should write a patch for baymax that blackens
  things on the way in...
  
  1. skip-blame automatic formatting

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8104

AFFECTED FILES
  mercurial/branchmap.py
  mercurial/changegroup.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/debugcommands.py
  mercurial/discovery.py
  mercurial/dispatch.py
  mercurial/help.py
  mercurial/posix.py
  mercurial/tags.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -720,7 +720,9 @@ 
 
         self._dirtyoffset = None
 
-        rawlentokeep = min(wantedlen, (rawlen / _fnodesrecsize) * _fnodesrecsize)
+        rawlentokeep = min(
+            wantedlen, (rawlen / _fnodesrecsize) * _fnodesrecsize
+        )
         if rawlen > rawlentokeep:
             # There's no easy way to truncate array instances. This seems
             # slightly less evil than copying a potentially large array slice.
diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -324,9 +324,8 @@ 
                     open(fullpath, b'w').close()
                 except IOError as inst:
                     if (
-                        inst[0]  # pytype: disable=unsupported-operands
-                        == errno.EACCES
-                    ):
+                        inst[0] == errno.EACCES
+                    ):  # pytype: disable=unsupported-operands
                         # If we can't write to cachedir, just pretend
                         # that the fs is readonly and by association
                         # that the fs won't support symlinks. This
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -152,6 +152,7 @@ 
     doc = b''.join(rst)
     return doc
 
+
 def parsedefaultmarker(text):
     """given a text 'abc (DEFAULT: def.ghi)',
     returns (b'abc', (b'def', b'ghi')). Otherwise return None"""
@@ -159,9 +160,10 @@ 
         marker = b' (DEFAULT: '
         pos = text.find(marker)
         if pos >= 0:
-            item = text[pos + len(marker):-1]
+            item = text[pos + len(marker) : -1]
             return text[:pos], item.split(b'.', 2)
 
+
 def optrst(header, options, verbose, ui):
     data = []
     multioccur = False
@@ -734,7 +736,9 @@ 
 
         if ui.verbose:
             rst.append(
-                optrst(_(b"global options"), commands.globalopts, ui.verbose, ui)
+                optrst(
+                    _(b"global options"), commands.globalopts, ui.verbose, ui
+                )
             )
 
         if not ui.verbose:
@@ -874,7 +878,9 @@ 
         elif ui.verbose:
             rst.append(
                 b'\n%s\n'
-                % optrst(_(b"global options"), commands.globalopts, ui.verbose, ui)
+                % optrst(
+                    _(b"global options"), commands.globalopts, ui.verbose, ui
+                )
             )
             if name == b'shortlist':
                 rst.append(
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -624,7 +624,7 @@ 
         except error.AmbiguousCommand:
             self.badalias = _(
                 b"alias '%s' resolves to ambiguous command '%s'"
-            ) % (self.name, cmd)
+            ) % (self.name, cmd,)
 
     def _populatehelp(self, ui, name, cmd, fn, defaulthelp=None):
         # confine strings to be passed to i18n.gettext()
diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -448,7 +448,7 @@ 
                 if branch not in (b'default', None):
                     errormsg = _(
                         b"push creates new remote head %s on branch '%s'!"
-                    ) % (short(dhs[0]), branch)
+                    ) % (short(dhs[0]), branch,)
                 elif repo[dhs[0]].bookmarks():
                     errormsg = _(
                         b"push creates new remote head %s "
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3429,6 +3429,7 @@ 
                     ui.write(node2str(node))
             ui.write(b'\n')
 
+
 @command(b'debugtagscache', [])
 def debugtagscache(ui, repo):
     """display the contents of .hg/cache/hgtagsfnodes1"""
@@ -3439,6 +3440,7 @@ 
         tagsnodedisplay = hex(tagsnode) if tagsnode else 'missing/invalid'
         ui.write(b'%s %s %s\n' % (r, hex(node), tagsnodedisplay))
 
+
 @command(
     b'debugtemplate',
     [
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6646,7 +6646,12 @@ 
         (b'i', b'ignored', None, _(b'show only ignored files')),
         (b'n', b'no-status', None, _(b'hide status prefix')),
         (b't', b'terse', _NOTTERSE, _(b'show the terse output (EXPERIMENTAL)')),
-        (b'C', b'copies', None, _(b'show source of copied files (DEFAULT: ui.statuscopies)')),
+        (
+            b'C',
+            b'copies',
+            None,
+            _(b'show source of copied files (DEFAULT: ui.statuscopies)'),
+        ),
         (
             b'0',
             b'print0',
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -170,7 +170,12 @@ 
 
 diffopts = [
     (b'a', b'text', None, _(b'treat all files as text')),
-    (b'g', b'git', None, _(b'use git extended diff format (DEFAULT: diff.git)')),
+    (
+        b'g',
+        b'git',
+        None,
+        _(b'use git extended diff format (DEFAULT: diff.git)'),
+    ),
     (b'', b'binary', None, _(b'generate binary diffs in git mode (default)')),
     (b'', b'nodates', None, _(b'omit dates from diff headers')),
 ]
@@ -209,7 +214,9 @@ 
             b'p',
             b'show-function',
             None,
-            _(b'show which function each change is in (DEFAULT: diff.showfunc)'),
+            _(
+                b'show which function each change is in (DEFAULT: diff.showfunc)'
+            ),
         ),
         (b'', b'reverse', None, _(b'produce a diff that undoes the changes')),
     ]
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -1149,8 +1149,8 @@ 
             if fastpathlinkrev:
                 assert not tree
                 return (
-                    manifests.__getitem__  # pytype: disable=unsupported-operands
-                )
+                    manifests.__getitem__
+                )  # pytype: disable=unsupported-operands
 
             def lookupmflinknode(x):
                 """Callback for looking up the linknode for manifests.
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -291,8 +291,8 @@ 
                     % (
                         _branchcachedesc(repo),
                         pycompat.bytestr(
-                            inst  # pytype: disable=wrong-arg-types
-                        ),
+                            inst
+                        ),  # pytype: disable=wrong-arg-types
                     )
                 )
             bcache = None