Patchwork [3,of,4,py3] maplist: replace instances of map() with pycompat.maplist() [3 of 4]

login
register
mail settings
Submitter Pulkit Goyal
Date March 24, 2017, 3:18 p.m.
Message ID <86026839d8fd76528af1.1490368683@pulkit-goyal>
Download mbox | patch
Permalink /patch/19643/
State Rejected
Headers show

Comments

Pulkit Goyal - March 24, 2017, 3:18 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1490368126 -19800
#      Fri Mar 24 20:38:46 2017 +0530
# Node ID 86026839d8fd76528af12a7fd9a876488d257483
# Parent  1b471d88cab47d897afd5aa5ddda3031bd70a300
maplist: replace instances of map() with pycompat.maplist() [3 of 4]

Patch

diff -r 1b471d88cab4 -r 86026839d8fd mercurial/exchange.py
--- a/mercurial/exchange.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/exchange.py	Fri Mar 24 20:38:46 2017 +0530
@@ -26,6 +26,7 @@ 
     obsolete,
     phases,
     pushkey,
+    pycompat,
     scmutil,
     sslutil,
     streamclone,
@@ -609,7 +610,7 @@ 
     ui.debug("checking for updated bookmarks\n")
     ancestors = ()
     if pushop.revs:
-        revnums = map(repo.changelog.rev, pushop.revs)
+        revnums = pycompat.maplist(repo.changelog.rev, pushop.revs)
         ancestors = repo.changelog.ancestors(revnums, inclusive=True)
     remotebookmark = remote.listkeys('bookmarks')
 
diff -r 1b471d88cab4 -r 86026839d8fd mercurial/hbisect.py
--- a/mercurial/hbisect.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/hbisect.py	Fri Mar 24 20:38:46 2017 +0530
@@ -19,6 +19,7 @@ 
 )
 from . import (
     error,
+    pycompat,
 )
 
 def bisect(changelog, state):
@@ -202,7 +203,7 @@ 
     """
     state = load_state(repo)
     if status in ('good', 'bad', 'skip', 'current'):
-        return map(repo.changelog.rev, state[status])
+        return pycompat.maplist(repo.changelog.rev, state[status])
     else:
         # In the following sets, we do *not* call 'bisect()' with more
         # than one level of recursion, because that can be very, very
diff -r 1b471d88cab4 -r 86026839d8fd mercurial/store.py
--- a/mercurial/store.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/store.py	Fri Mar 24 20:38:46 2017 +0530
@@ -100,7 +100,7 @@ 
     '''
     e = '_'
     xchr = pycompat.bytechr
-    asciistr = list(map(xchr, range(127)))
+    asciistr = pycompat.maplist(xchr, range(127))
     capitals = list(range(ord("A"), ord("Z") + 1))
 
     cmap = dict((x, x) for x in asciistr)
diff -r 1b471d88cab4 -r 86026839d8fd mercurial/streamclone.py
--- a/mercurial/streamclone.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/streamclone.py	Fri Mar 24 20:38:46 2017 +0530
@@ -13,6 +13,7 @@ 
 from . import (
     branchmap,
     error,
+    pycompat,
     store,
     util,
 )
@@ -131,7 +132,7 @@ 
 
     l = fp.readline()
     try:
-        filecount, bytecount = map(int, l.split(' ', 1))
+        filecount, bytecount = pycompat.maplist(int, l.split(' ', 1))
     except (ValueError, TypeError):
         raise error.ResponseError(
             _('unexpected response from remote server:'), l)
diff -r 1b471d88cab4 -r 86026839d8fd mercurial/util.py
--- a/mercurial/util.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/util.py	Fri Mar 24 20:38:46 2017 +0530
@@ -1936,7 +1936,7 @@ 
                 datetime.timedelta(days=1)).strftime('%b %d')
 
     try:
-        when, offset = map(int, date.split(' '))
+        when, offset = pycompat.maplist(int, date.split(' '))
     except ValueError:
         # fill out defaults
         now = makedate()
@@ -3384,7 +3384,7 @@ 
                     pos = pos2
                 parts.append(z.flush())
 
-                if sum(map(len, parts)) < insize:
+                if sum(pycompat.maplist(len, parts)) < insize:
                     return ''.join(parts)
                 return None
 
@@ -3569,7 +3569,7 @@ 
                     pos = pos2
                 chunks.append(z.flush())
 
-                if sum(map(len, chunks)) < insize:
+                if sum(pycompat.maplist(len, chunks)) < insize:
                     return ''.join(chunks)
                 return None
 
diff -r 1b471d88cab4 -r 86026839d8fd mercurial/verify.py
--- a/mercurial/verify.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/verify.py	Fri Mar 24 20:38:46 2017 +0530
@@ -17,6 +17,7 @@ 
 
 from . import (
     error,
+    pycompat,
     revlog,
     scmutil,
     util,
@@ -103,7 +104,8 @@ 
                                     if self.lrugetctx(l)[f].filenode() == node]
                     except Exception:
                         pass
-                self.warn(_(" (expected %s)") % " ".join(map(str, linkrevs)))
+                self.warn(_(" (expected %s)") % " ".join(pycompat.maplist(str,
+                                                    linkrevs)))
             lr = None # can't be trusted
 
         try:
diff -r 1b471d88cab4 -r 86026839d8fd mercurial/wireproto.py
--- a/mercurial/wireproto.py	Fri Mar 24 20:37:42 2017 +0530
+++ b/mercurial/wireproto.py	Fri Mar 24 20:38:46 2017 +0530
@@ -157,12 +157,12 @@ 
 
 def decodelist(l, sep=' '):
     if l:
-        return map(bin, l.split(sep))
+        return pycompat.maplist(bin, l.split(sep))
     return []
 
 def encodelist(l, sep=' '):
     try:
-        return sep.join(map(hex, l))
+        return sep.join(pycompat.maplist(hex, l))
     except TypeError:
         raise