D12218: black: blacken with 22.1.0

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Mar 2 00:26:22 UTC 2022


indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  black 22.1.0 is the first non-beta release of black. I think it makes
  sense for us to adopt this version of black.
  
  This commit blackens the repo with version 22.1.0.
  
  skip-blame: formatting only changes with black

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/byteify-strings.py
  contrib/check-config.py
  contrib/fuzz/mpatch_corpus.py
  contrib/hgclient.py
  contrib/perf.py
  contrib/python-zstandard/tests/test_decompressor.py
  contrib/revsetbenchmarks.py
  contrib/testparseutil.py
  hgext/fsmonitor/pywatchman/__init__.py
  hgext/fsmonitor/pywatchman/compat.py
  hgext/fsmonitor/pywatchman/encoding.py
  hgext/remotefilelog/basepack.py
  hgext/remotefilelog/datapack.py
  i18n/polib.py
  mercurial/bundlerepo.py
  mercurial/cext/bdiff.pyi
  mercurial/cext/parsers.pyi
  mercurial/changegroup.py
  mercurial/copies.py
  mercurial/dispatch.py
  mercurial/mail.py
  mercurial/patch.py
  mercurial/posix.py
  mercurial/pure/osutil.py
  mercurial/revlog.py
  mercurial/store.py
  mercurial/subrepo.py
  mercurial/urllibcompat.py
  mercurial/util.py
  mercurial/utils/cborutil.py
  mercurial/utils/compression.py
  mercurial/utils/procutil.py
  mercurial/utils/resourceutil.py
  mercurial/win32.py
  mercurial/worker.py
  setup.py
  tests/dumbhttp.py
  tests/fsmonitor-run-tests.py
  tests/hghave.py
  tests/killdaemons.py
  tests/test-cbor.py
  tests/test-remotefilelog-datapack.py
  tests/test-revlog-raw.py
  tests/test-stdio.py
  tests/test-verify-repo-operations.py

CHANGE DETAILS

diff --git a/tests/test-verify-repo-operations.py b/tests/test-verify-repo-operations.py
--- a/tests/test-verify-repo-operations.py
+++ b/tests/test-verify-repo-operations.py
@@ -619,8 +619,8 @@
     settings(
         timeout=-1,
         stateful_step_count=1000,
-        max_examples=10 ** 8,
-        max_iterations=10 ** 8,
+        max_examples=10**8,
+        max_iterations=10**8,
         database=writeonlydatabase(settings.default.database),
     ),
 )
diff --git a/tests/test-stdio.py b/tests/test-stdio.py
--- a/tests/test-stdio.py
+++ b/tests/test-stdio.py
@@ -22,7 +22,6 @@
         # On Python 3, file descriptors are non-inheritable by default.
         pass
 
-
 else:
     if pycompat.iswindows:
         # unused
diff --git a/tests/test-revlog-raw.py b/tests/test-revlog-raw.py
--- a/tests/test-revlog-raw.py
+++ b/tests/test-revlog-raw.py
@@ -252,7 +252,7 @@
     That is to say, given any x, y where both x, and y are in range(2 ** n),
     there is an x followed immediately by y in the generated sequence.
     """
-    m = 2 ** n
+    m = 2**n
 
     # Gray Code. See https://en.wikipedia.org/wiki/Gray_code
     gray = lambda x: x ^ (x >> 1)
diff --git a/tests/test-remotefilelog-datapack.py b/tests/test-remotefilelog-datapack.py
--- a/tests/test-remotefilelog-datapack.py
+++ b/tests/test-remotefilelog-datapack.py
@@ -187,7 +187,7 @@
             content = b'put-something-here \n' * i
             node = self.getHash(content)
             meta = {
-                constants.METAKEYFLAG: i ** 4,
+                constants.METAKEYFLAG: i**4,
                 constants.METAKEYSIZE: len(content),
                 b'Z': b'random_string',
                 b'_': b'\0' * i,
diff --git a/tests/test-cbor.py b/tests/test-cbor.py
--- a/tests/test-cbor.py
+++ b/tests/test-cbor.py
@@ -218,11 +218,11 @@
         for size in lens:
             if size < 24:
                 hlen = 1
-            elif size < 2 ** 8:
+            elif size < 2**8:
                 hlen = 2
-            elif size < 2 ** 16:
+            elif size < 2**16:
                 hlen = 3
-            elif size < 2 ** 32:
+            elif size < 2**32:
                 hlen = 5
             else:
                 assert False
@@ -489,7 +489,7 @@
         )
 
     def testdecodepartialushort(self):
-        encoded = b''.join(cborutil.streamencode(2 ** 15))
+        encoded = b''.join(cborutil.streamencode(2**15))
 
         self.assertEqual(
             cborutil.decodeitem(encoded[0:1]),
@@ -501,7 +501,7 @@
         )
         self.assertEqual(
             cborutil.decodeitem(encoded[0:5]),
-            (True, 2 ** 15, 3, cborutil.SPECIAL_NONE),
+            (True, 2**15, 3, cborutil.SPECIAL_NONE),
         )
 
     def testdecodepartialshort(self):
@@ -521,7 +521,7 @@
         )
 
     def testdecodepartialulong(self):
-        encoded = b''.join(cborutil.streamencode(2 ** 28))
+        encoded = b''.join(cborutil.streamencode(2**28))
 
         self.assertEqual(
             cborutil.decodeitem(encoded[0:1]),
@@ -541,7 +541,7 @@
         )
         self.assertEqual(
             cborutil.decodeitem(encoded[0:5]),
-            (True, 2 ** 28, 5, cborutil.SPECIAL_NONE),
+            (True, 2**28, 5, cborutil.SPECIAL_NONE),
         )
 
     def testdecodepartiallong(self):
@@ -569,7 +569,7 @@
         )
 
     def testdecodepartialulonglong(self):
-        encoded = b''.join(cborutil.streamencode(2 ** 32))
+        encoded = b''.join(cborutil.streamencode(2**32))
 
         self.assertEqual(
             cborutil.decodeitem(encoded[0:1]),
@@ -605,7 +605,7 @@
         )
         self.assertEqual(
             cborutil.decodeitem(encoded[0:9]),
-            (True, 2 ** 32, 9, cborutil.SPECIAL_NONE),
+            (True, 2**32, 9, cborutil.SPECIAL_NONE),
         )
 
         with self.assertRaisesRegex(
diff --git a/tests/killdaemons.py b/tests/killdaemons.py
--- a/tests/killdaemons.py
+++ b/tests/killdaemons.py
@@ -77,7 +77,6 @@
             raise
         _check(ctypes.windll.kernel32.CloseHandle(handle))
 
-
 else:
 
     def kill(pid, logfn, tryhard=True):
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -42,7 +42,6 @@
             return p
         return p.decode('utf-8')
 
-
 else:
 
     def _sys2bytes(p):
diff --git a/tests/fsmonitor-run-tests.py b/tests/fsmonitor-run-tests.py
--- a/tests/fsmonitor-run-tests.py
+++ b/tests/fsmonitor-run-tests.py
@@ -33,7 +33,6 @@
     def _sys2bytes(p):
         return p.encode('utf-8')
 
-
 elif sys.version_info >= (3, 0, 0):
     print(
         '%s is only supported on Python 3.5+ and 2.7, not %s'
diff --git a/tests/dumbhttp.py b/tests/dumbhttp.py
--- a/tests/dumbhttp.py
+++ b/tests/dumbhttp.py
@@ -27,7 +27,6 @@
     class simplehttpserver(httpserver.httpserver):
         address_family = socket.AF_INET6
 
-
 else:
     simplehttpserver = httpserver.httpserver
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,6 @@
     def sysstr(s):
         return s.decode('latin-1')
 
-
 else:
     libdir_escape = 'string_escape'
 
diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -100,7 +100,6 @@
             del buf[pos:]
             return bytes(buf)
 
-
 else:
 
     def ismainthread():
diff --git a/mercurial/win32.py b/mercurial/win32.py
--- a/mercurial/win32.py
+++ b/mercurial/win32.py
@@ -362,7 +362,7 @@
     # See https://bugs.python.org/issue28474
     code = _kernel32.GetLastError()
     if code > 0x7FFFFFFF:
-        code -= 2 ** 32
+        code -= 2**32
     err = ctypes.WinError(code=code)  # pytype: disable=module-attr
     raise OSError(
         err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -45,7 +45,6 @@
         assert dirs[0] == b"mercurial"
         return os.path.join(_rootpath, *dirs[1:])
 
-
 else:
     datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
     _rootpath = os.path.dirname(datapath)
@@ -84,7 +83,6 @@
         for p in os.listdir(path):
             yield pycompat.fsencode(p)
 
-
 else:
     from .. import encoding
 
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -702,7 +702,6 @@
             if stdin is not None:
                 stdin.close()
 
-
 else:
 
     def runbgcommandpy3(
diff --git a/mercurial/utils/compression.py b/mercurial/utils/compression.py
--- a/mercurial/utils/compression.py
+++ b/mercurial/utils/compression.py
@@ -516,7 +516,7 @@
                 parts = []
                 pos = 0
                 while pos < insize:
-                    pos2 = pos + 2 ** 20
+                    pos2 = pos + 2**20
                     parts.append(z.compress(data[pos:pos2]))
                     pos = pos2
                 parts.append(z.flush())
diff --git a/mercurial/utils/cborutil.py b/mercurial/utils/cborutil.py
--- a/mercurial/utils/cborutil.py
+++ b/mercurial/utils/cborutil.py
@@ -255,7 +255,6 @@
     def _elementtointeger(b, i):
         return b[i]
 
-
 else:
 
     def _elementtointeger(b, i):
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2676,10 +2676,10 @@
 
         def splitbig(chunks):
             for chunk in chunks:
-                if len(chunk) > 2 ** 20:
+                if len(chunk) > 2**20:
                     pos = 0
                     while pos < len(chunk):
-                        end = pos + 2 ** 18
+                        end = pos + 2**18
                         yield chunk[pos:end]
                         pos = end
                 else:
@@ -2703,7 +2703,7 @@
         while left > 0:
             # refill the queue
             if not queue:
-                target = 2 ** 18
+                target = 2**18
                 for chunk in self.iter:
                     queue.append(chunk)
                     target -= len(chunk)
@@ -2945,7 +2945,6 @@
             # fp.readline deals with EINTR correctly, use it as a workaround.
             return iter(fp.readline, b'')
 
-
 else:
     # PyPy and CPython 3 do not have the EINTR issue thus no workaround needed.
     def iterfile(fp):
@@ -3078,12 +3077,12 @@
 
 
 _sizeunits = (
-    (b'm', 2 ** 20),
-    (b'k', 2 ** 10),
-    (b'g', 2 ** 30),
-    (b'kb', 2 ** 10),
-    (b'mb', 2 ** 20),
-    (b'gb', 2 ** 30),
+    (b'm', 2**20),
+    (b'k', 2**10),
+    (b'g', 2**30),
+    (b'kb', 2**10),
+    (b'mb', 2**20),
+    (b'gb', 2**30),
     (b'b', 1),
 )
 
diff --git a/mercurial/urllibcompat.py b/mercurial/urllibcompat.py
--- a/mercurial/urllibcompat.py
+++ b/mercurial/urllibcompat.py
@@ -146,7 +146,6 @@
     def hasdata(req):
         return req.data is not None
 
-
 else:
     # pytype: disable=import-error
     import BaseHTTPServer
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1187,16 +1187,12 @@
                 externals.append(path)
             elif item == 'missing':
                 missing.append(path)
-            if (
-                item
-                not in (
-                    '',
-                    'normal',
-                    'unversioned',
-                    'external',
-                )
-                or props not in ('', 'none', 'normal')
-            ):
+            if item not in (
+                '',
+                'normal',
+                'unversioned',
+                'external',
+            ) or props not in ('', 'none', 'normal'):
                 changes.append(path)
         for path in changes:
             for ext in externals:
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -30,7 +30,7 @@
 parsers = policy.importmod('parsers')
 # how much bytes should be read from fncache in one read
 # It is done to prevent loading large fncache files into memory
-fncache_chunksize = 10 ** 6
+fncache_chunksize = 10**6
 
 
 def _matchtrackedpath(path, matcher):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -218,7 +218,6 @@
         index, cache = parsers.parse_index_devel_nodemap(data, inline)
         return index, cache
 
-
 else:
     parse_index_v1_nodemap = None
 
diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -168,7 +168,6 @@
         ) // ctypes.sizeof(ctypes.c_int)
         return [rfds[i] for i in pycompat.xrange(rfdscount)]
 
-
 else:
     import msvcrt
 
diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -70,7 +70,6 @@
             fp.seek(0, os.SEEK_END)
         return fp
 
-
 else:
     # The underlying file object seeks as required in Python 3:
     # https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -600,7 +600,7 @@
         self.created = 0
         self.maxsize = maxsize
         if self.maxsize is None:
-            self.maxsize = 4 * (2 ** 20)
+            self.maxsize = 4 * (2**20)
         self.size = 0
         self.data = {}
 
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -491,7 +491,6 @@
         ep = email.parser.BytesParser()
         return ep.parsebytes(data)
 
-
 else:
 
     Generator = email.generator.Generator
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -228,7 +228,6 @@
             except IOError:
                 pass
 
-
 else:
 
     def initstdio():
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -917,11 +917,14 @@
         self.movewithdir = {} if movewithdir is None else movewithdir
 
     def __repr__(self):
-        return '<branch_copies\n  copy=%r\n  renamedelete=%r\n  dirmove=%r\n  movewithdir=%r\n>' % (
-            self.copy,
-            self.renamedelete,
-            self.dirmove,
-            self.movewithdir,
+        return (
+            '<branch_copies\n  copy=%r\n  renamedelete=%r\n  dirmove=%r\n  movewithdir=%r\n>'
+            % (
+                self.copy,
+                self.renamedelete,
+                self.dirmove,
+                self.movewithdir,
+            )
         )
 
 
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -250,7 +250,7 @@
                 yield chunkheader(len(chunk))
                 pos = 0
                 while pos < len(chunk):
-                    next = pos + 2 ** 20
+                    next = pos + 2**20
                     yield chunk[pos:next]
                     pos = next
             yield closechunk()
diff --git a/mercurial/cext/parsers.pyi b/mercurial/cext/parsers.pyi
--- a/mercurial/cext/parsers.pyi
+++ b/mercurial/cext/parsers.pyi
@@ -31,17 +31,17 @@
 class lazymanifest:
     def __init__(self, nodelen: int, data: bytes): ...
     def __iter__(self) -> Iterator[bytes]: ...
-
     def __len__(self) -> int: ...
     def __getitem__(self, item: bytes) -> Optional[Tuple[bytes, bytes]]: ...
     def __setitem__(self, key: bytes, value: Tuple[bytes, bytes]) -> None: ...
     def __delitem__(self, key: bytes) -> None: ...
-
     def iterkeys(self) -> Iterator[bytes]: ...
     def iterentries(self) -> Iterator[Tuple[bytes, bytes, bytes]]: ...
     def copy(self) -> lazymanifest: ...
     def filtercopy(self, matchfn: Callable[[bytes], bool]) -> lazymanifest: ...
-    def diff(self, other: lazymanifest, clean: Optional[bool]) -> Dict[bytes, Tuple[bytes, Tuple]]: ...
+    def diff(
+        self, other: lazymanifest, clean: Optional[bool]
+    ) -> Dict[bytes, Tuple[bytes, Tuple]]: ...
     def text(self) -> bytes: ...
 
 # From revlog.c
@@ -58,15 +58,33 @@
     def get_rev(self, value: bytes) -> Optional[int]: ...
     def has_node(self, value: Union[int, bytes]) -> bool: ...
     def rev(self, node: bytes) -> int: ...
-    def computephasesmapsets(self, root: Dict[int, Set[bytes]]) -> Tuple[int, Dict[int, Set[bytes]]]: ...
-    def reachableroots2(self, minroot: int, heads: List[int], roots: List[int], includepath: bool) -> List[int]: ...
+    def computephasesmapsets(
+        self, root: Dict[int, Set[bytes]]
+    ) -> Tuple[int, Dict[int, Set[bytes]]]: ...
+    def reachableroots2(
+        self,
+        minroot: int,
+        heads: List[int],
+        roots: List[int],
+        includepath: bool,
+    ) -> List[int]: ...
     def headrevs(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
-    def headrevsfiltered(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
+    def headrevsfiltered(
+        self, filteredrevs: Optional[List[int]]
+    ) -> List[int]: ...
     def issnapshot(self, value: int) -> bool: ...
-    def findsnapshots(self, cache: Dict[int, List[int]], start_rev: int) -> None: ...
-    def deltachain(self, rev: int, stop: int, generaldelta: bool) -> Tuple[List[int], bool]: ...
-    def slicechunktodensity(self, revs: List[int], targetdensity: float, mingapsize: int) -> List[List[int]]: ...
-    def append(self, value: Tuple[int, int, int, int, int, int, int, bytes]) -> None: ...
+    def findsnapshots(
+        self, cache: Dict[int, List[int]], start_rev: int
+    ) -> None: ...
+    def deltachain(
+        self, rev: int, stop: int, generaldelta: bool
+    ) -> Tuple[List[int], bool]: ...
+    def slicechunktodensity(
+        self, revs: List[int], targetdensity: float, mingapsize: int
+    ) -> List[List[int]]: ...
+    def append(
+        self, value: Tuple[int, int, int, int, int, int, int, bytes]
+    ) -> None: ...
     def partialmatch(self, node: bytes) -> bytes: ...
     def shortest(self, value: bytes) -> int: ...
     def stats(self) -> Dict[bytes, int]: ...
diff --git a/mercurial/cext/bdiff.pyi b/mercurial/cext/bdiff.pyi
--- a/mercurial/cext/bdiff.pyi
+++ b/mercurial/cext/bdiff.pyi
@@ -5,7 +5,9 @@
 
 version: int
 
-def bdiff(a: bytes, b: bytes): bytes
+def bdiff(a: bytes, b: bytes):
+    bytes
+
 def blocks(a: bytes, b: bytes) -> List[Tuple[int, int, int, int]]: ...
 def fixws(s: bytes, allws: bool) -> bytes: ...
 def splitnewlines(text: bytes) -> List[bytes]: ...
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -367,7 +367,7 @@
         with os.fdopen(fdtemp, 'wb') as fptemp:
             fptemp.write(header)
             while True:
-                chunk = readfn(2 ** 18)
+                chunk = readfn(2**18)
                 if not chunk:
                     break
                 fptemp.write(chunk)
diff --git a/i18n/polib.py b/i18n/polib.py
--- a/i18n/polib.py
+++ b/i18n/polib.py
@@ -65,7 +65,6 @@
     def u(s):
         return unicode(s, "unicode_escape")
 
-
 else:
     PY3 = True
     text_type = str
diff --git a/hgext/remotefilelog/datapack.py b/hgext/remotefilelog/datapack.py
--- a/hgext/remotefilelog/datapack.py
+++ b/hgext/remotefilelog/datapack.py
@@ -417,7 +417,7 @@
 
     def add(self, name, node, deltabasenode, delta, metadata=None):
         # metadata is a dict, ex. {METAKEYFLAG: flag}
-        if len(name) > 2 ** 16:
+        if len(name) > 2**16:
             raise RuntimeError(_(b"name too long %s") % name)
         if len(node) != 20:
             raise RuntimeError(_(b"node should be 20 bytes %s") % node)
diff --git a/hgext/remotefilelog/basepack.py b/hgext/remotefilelog/basepack.py
--- a/hgext/remotefilelog/basepack.py
+++ b/hgext/remotefilelog/basepack.py
@@ -49,7 +49,7 @@
 # bisect) with (8 step fanout scan + 1 step bisect)
 # 5 step bisect = log(2^16 / 8 / 255)  # fanout
 # 10 step fanout scan = 2^16 / (2^16 / 8)  # fanout space divided by entries
-SMALLFANOUTCUTOFF = 2 ** 16 // 8
+SMALLFANOUTCUTOFF = 2**16 // 8
 
 # The amount of time to wait between checking for new packs. This prevents an
 # exception when data is moved to a new pack after the process has already
@@ -288,7 +288,7 @@
 class basepack(versionmixin):
     # The maximum amount we should read via mmap before remmaping so the old
     # pages can be released (100MB)
-    MAXPAGEDIN = 100 * 1024 ** 2
+    MAXPAGEDIN = 100 * 1024**2
 
     SUPPORTED_VERSIONS = [2]
 
diff --git a/hgext/fsmonitor/pywatchman/encoding.py b/hgext/fsmonitor/pywatchman/encoding.py
--- a/hgext/fsmonitor/pywatchman/encoding.py
+++ b/hgext/fsmonitor/pywatchman/encoding.py
@@ -49,7 +49,6 @@
         # returns None.
         return sys.getfilesystemencoding()
 
-
 else:
     # Python 2 doesn't support surrogateescape, so use 'strict' by
     # default. Users can register a custom surrogateescape error handler and use
diff --git a/hgext/fsmonitor/pywatchman/compat.py b/hgext/fsmonitor/pywatchman/compat.py
--- a/hgext/fsmonitor/pywatchman/compat.py
+++ b/hgext/fsmonitor/pywatchman/compat.py
@@ -53,7 +53,6 @@
             value = None
             tb = None
 
-
 else:
     exec(
         """
diff --git a/hgext/fsmonitor/pywatchman/__init__.py b/hgext/fsmonitor/pywatchman/__init__.py
--- a/hgext/fsmonitor/pywatchman/__init__.py
+++ b/hgext/fsmonitor/pywatchman/__init__.py
@@ -213,7 +213,6 @@
             )
         )
 
-
 else:
 
     def log(fmt, *args):
diff --git a/contrib/testparseutil.py b/contrib/testparseutil.py
--- a/contrib/testparseutil.py
+++ b/contrib/testparseutil.py
@@ -54,7 +54,6 @@
     def opentext(f):
         return open(f, 'r')
 
-
 else:
     bytestr = str
     sysstr = identity
diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
--- a/contrib/revsetbenchmarks.py
+++ b/contrib/revsetbenchmarks.py
@@ -192,7 +192,7 @@
 
 def formattiming(value):
     """format a value to strictly 8 char, dropping some precision if needed"""
-    if value < 10 ** 7:
+    if value < 10**7:
         return ('%.6f' % value)[:8]
     else:
         # value is HUGE very unlikely to happen (4+ month run)
diff --git a/contrib/python-zstandard/tests/test_decompressor.py b/contrib/python-zstandard/tests/test_decompressor.py
--- a/contrib/python-zstandard/tests/test_decompressor.py
+++ b/contrib/python-zstandard/tests/test_decompressor.py
@@ -189,7 +189,7 @@
         # Will get OverflowError on some Python distributions that can't
         # handle really large integers.
         with self.assertRaises((MemoryError, OverflowError)):
-            dctx.decompress(compressed, max_output_size=2 ** 62)
+            dctx.decompress(compressed, max_output_size=2**62)
 
     def test_dictionary(self):
         samples = []
@@ -238,7 +238,7 @@
         cctx = zstd.ZstdCompressor(write_content_size=False)
         frame = cctx.compress(source)
 
-        dctx = zstd.ZstdDecompressor(max_window_size=2 ** zstd.WINDOWLOG_MIN)
+        dctx = zstd.ZstdDecompressor(max_window_size=2**zstd.WINDOWLOG_MIN)
 
         with self.assertRaisesRegex(
             zstd.ZstdError,
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -128,7 +128,6 @@
     def revlog(opener, *args, **kwargs):
         return mercurial.revlog.revlog(opener, perf_rl_kind, *args, **kwargs)
 
-
 except (ImportError, AttributeError):
     perf_rl_kind = None
 
@@ -258,7 +257,6 @@
                 commands.norepo += b' %s' % b' '.join(parsealiases(name))
             return _command(name, list(options), synopsis)
 
-
 else:
     # for "historical portability":
     # define "@command" annotation locally, because cmdutil.command
@@ -1596,7 +1594,7 @@
 
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
-    mercurial.revlog._prereadsize = 2 ** 24  # disable lazy parser in old hg
+    mercurial.revlog._prereadsize = 2**24  # disable lazy parser in old hg
     if opts[b'no_lookup']:
         if opts['rev']:
             raise error.Abort('--no-lookup and --rev are mutually exclusive')
@@ -1655,7 +1653,7 @@
 
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
-    mercurial.revlog._prereadsize = 2 ** 24  # disable lazy parser in old hg
+    mercurial.revlog._prereadsize = 2**24  # disable lazy parser in old hg
 
     unfi = repo.unfiltered()
     clearcaches = opts[b'clear_caches']
@@ -1832,7 +1830,7 @@
     timer, fm = gettimer(ui, opts)
     import mercurial.revlog
 
-    mercurial.revlog._prereadsize = 2 ** 24  # disable lazy parser in old hg
+    mercurial.revlog._prereadsize = 2**24  # disable lazy parser in old hg
     n = scmutil.revsingle(repo, rev).node()
 
     try:
diff --git a/contrib/hgclient.py b/contrib/hgclient.py
--- a/contrib/hgclient.py
+++ b/contrib/hgclient.py
@@ -22,7 +22,6 @@
         pargs = [re.sub(br'''\bb(['"])''', br'\1', b'%s' % a) for a in args]
         stdout.write(b' '.join(pargs) + b'\n')
 
-
 else:
     import cStringIO
 
diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py
--- a/contrib/fuzz/mpatch_corpus.py
+++ b/contrib/fuzz/mpatch_corpus.py
@@ -27,7 +27,6 @@
             """Py2 calls __repr__ for `bytes(foo)`, forward to __bytes__"""
             return self.__bytes__()
 
-
 else:
 
     class py2reprhack(object):
diff --git a/contrib/check-config.py b/contrib/check-config.py
--- a/contrib/check-config.py
+++ b/contrib/check-config.py
@@ -58,7 +58,6 @@
             return b
         return b.decode('utf8')
 
-
 else:
     mkstr = lambda x: x
 
diff --git a/contrib/byteify-strings.py b/contrib/byteify-strings.py
--- a/contrib/byteify-strings.py
+++ b/contrib/byteify-strings.py
@@ -213,19 +213,15 @@
             fn = t.string
 
             # *attr() builtins don't accept byte strings to 2nd argument.
-            if (
-                fn
-                in (
-                    'getattr',
-                    'setattr',
-                    'hasattr',
-                    'safehasattr',
-                    'wrapfunction',
-                    'wrapclass',
-                    'addattr',
-                )
-                and (opts['allow-attr-methods'] or not _isop(i - 1, '.'))
-            ):
+            if fn in (
+                'getattr',
+                'setattr',
+                'hasattr',
+                'safehasattr',
+                'wrapfunction',
+                'wrapclass',
+                'addattr',
+            ) and (opts['allow-attr-methods'] or not _isop(i - 1, '.')):
                 arg1idx = _findargnofcall(1)
                 if arg1idx is not None:
                     _ensuresysstr(arg1idx)



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list