changeset 41527:eb37d95cc486

py3: use integer division instead of `int(...)` call Changeset 38a82e0333c9 and 7f853549823b introduced explicit conversion to integer to work around the division behavior change from python2 to python3. Using the integer division operator is a simpler and clearer way to achieve this.
author Boris Feld <boris.feld@octobus.net>
date Sun, 03 Feb 2019 10:01:43 +0100
parents 1be7a9b994a2
children b7a0efb3c370
files hgext/remotefilelog/datapack.py tests/test-remotefilelog-datapack.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/datapack.py	Sun Feb 03 17:15:11 2019 +0530
+++ b/hgext/remotefilelog/datapack.py	Sun Feb 03 10:01:43 2019 +0100
@@ -242,8 +242,8 @@
             entry = index[end:end + entrylen]
         else:
             while start < end - entrylen:
-                mid = start  + (end - start) / 2
-                mid = int(mid - ((mid - params.indexstart) % entrylen))
+                mid = start + (end - start) // 2
+                mid = mid - ((mid - params.indexstart) % entrylen)
                 midnode = index[mid:mid + NODELENGTH]
                 if midnode == node:
                     entry = index[mid:mid + entrylen]
--- a/tests/test-remotefilelog-datapack.py	Sun Feb 03 17:15:11 2019 +0530
+++ b/tests/test-remotefilelog-datapack.py	Sun Feb 03 10:01:43 2019 +0100
@@ -292,7 +292,7 @@
 
         class testdatapackstore(datapack.datapackstore):
             # Ensures that we are not keeping everything in the cache.
-            DEFAULTCACHESIZE = int(numpacks / 2)
+            DEFAULTCACHESIZE = numpacks // 2
 
         store = testdatapackstore(uimod.ui(), packdir)