diff mercurial/util.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children b0a4de6c14f8
line wrap: on
line diff
--- a/mercurial/util.py	Mon Jul 22 16:49:38 2024 +0200
+++ b/mercurial/util.py	Tue Jul 23 10:02:46 2024 +0200
@@ -1152,7 +1152,7 @@
 def version():
     """Return version information if available."""
     try:
-        from . import __version__  # type: ignore
+        from . import __version__
 
         return __version__.version
     except ImportError:
@@ -1328,7 +1328,7 @@
                 self[k] = f[k]
 
     def insert(self, position, key, value):
-        for i, (k, v) in enumerate(list(self.items())):
+        for (i, (k, v)) in enumerate(list(self.items())):
             if i == position:
                 self[key] = value
             if i >= position:
@@ -2724,10 +2724,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:
@@ -2751,7 +2751,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)
@@ -3081,12 +3081,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),
 )