[PATCH 4 of 4 py3] maplist: replace instances of map() with pycompat.maplist() [4 of 4]

Pulkit Goyal 7895pulkit at gmail.com
Fri Mar 24 11:18:04 EDT 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1490368163 -19800
#      Fri Mar 24 20:39:23 2017 +0530
# Node ID a45b55d159b2b60d60de91f5b9cd1ccc4b2a75e4
# Parent  86026839d8fd76528af12a7fd9a876488d257483
maplist: replace instances of map() with pycompat.maplist() [4 of 4]

diff -r 86026839d8fd -r a45b55d159b2 mercurial/help.py
--- a/mercurial/help.py	Fri Mar 24 20:38:46 2017 +0530
+++ b/mercurial/help.py	Fri Mar 24 20:39:23 2017 +0530
@@ -23,6 +23,7 @@
     filemerge,
     fileset,
     minirst,
+    pycompat,
     revset,
     templatefilters,
     templatekw,
@@ -129,7 +130,7 @@
                }
     for names, header, doc in helptable:
         # Old extensions may use a str as doc.
-        if (sum(map(lowercontains, names))
+        if (sum(pycompat.maplist(lowercontains, names))
             or lowercontains(header)
             or (callable(doc) and lowercontains(doc(ui)))):
             results['topics'].append((names[0], header))
diff -r 86026839d8fd -r a45b55d159b2 mercurial/mail.py
--- a/mercurial/mail.py	Fri Mar 24 20:38:46 2017 +0530
+++ b/mercurial/mail.py	Fri Mar 24 20:39:23 2017 +0530
@@ -20,6 +20,7 @@
 from . import (
     encoding,
     error,
+    pycompat,
     sslutil,
     util,
 )
@@ -157,7 +158,7 @@
     '''send mail using sendmail.'''
     program = ui.config('email', 'method', 'smtp')
     cmdline = '%s -f %s %s' % (program, util.email(sender),
-                               ' '.join(map(util.email, recipients)))
+                            ' '.join(pycompat.maplist(util.email, recipients)))
     ui.note(_('sending mail: %s\n') % cmdline)
     fp = util.popen(cmdline, 'w')
     fp.write(msg)
diff -r 86026839d8fd -r a45b55d159b2 mercurial/minirst.py
--- a/mercurial/minirst.py	Fri Mar 24 20:38:46 2017 +0530
+++ b/mercurial/minirst.py	Fri Mar 24 20:39:23 2017 +0530
@@ -463,7 +463,7 @@
                      'warning': _('Warning!')}
 
 def formatoption(block, width):
-    desc = ' '.join(map(str.strip, block['lines']))
+    desc = ' '.join(pycompat.maplist(str.strip, block['lines']))
     colwidth = encoding.colwidth(block['optstr'])
     usablewidth = width - 1
     hanging = block['optstrwidth']
@@ -485,7 +485,7 @@
         hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
 
         defindent = indent + hang * ' '
-        text = ' '.join(map(str.strip, block['lines']))
+        text = ' '.join(pycompat.maplist(str.strip, block['lines']))
         return '%s\n%s\n' % (indent + admonition,
                              util.wrap(text, width=width,
                                        initindent=defindent,
@@ -523,7 +523,7 @@
         term = indent + block['lines'][0]
         hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
         defindent = indent + hang * ' '
-        text = ' '.join(map(str.strip, block['lines'][1:]))
+        text = ' '.join(pycompat.maplist(str.strip, block['lines'][1:]))
         return '%s\n%s\n' % (term, util.wrap(text, width=width,
                                              initindent=defindent,
                                              hangindent=defindent))
@@ -549,7 +549,7 @@
     elif block['type'] == 'option':
         return formatoption(block, width)
 
-    text = ' '.join(map(bytes.strip, block['lines']))
+    text = ' '.join(pycompat.maplist(bytes.strip, block['lines']))
     return util.wrap(text, width=width,
                      initindent=indent,
                      hangindent=subindent) + '\n'
@@ -578,7 +578,7 @@
 
         if btype == 'admonition':
             admonition = escape(_admonitiontitles[b['admonitiontitle']])
-            text = escape(' '.join(map(str.strip, lines)))
+            text = escape(' '.join(pycompat.maplist(str.strip, lines)))
             out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
         elif btype == 'paragraph':
             out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
@@ -608,7 +608,7 @@
         elif btype == 'definition':
             openlist('dl', level)
             term = escape(lines[0])
-            text = escape(' '.join(map(str.strip, lines[1:])))
+            text = escape(' '.join(pycompat.maplist(str.strip, lines[1:])))
             out.append(' <dt>%s\n <dd>%s\n' % (term, text))
         elif btype == 'bullet':
             bullet, head = lines[0].split(' ', 1)
@@ -620,12 +620,12 @@
         elif btype == 'field':
             openlist('dl', level)
             key = escape(b['key'])
-            text = escape(' '.join(map(str.strip, lines)))
+            text = escape(' '.join(pycompat.maplist(str.strip, lines)))
             out.append(' <dt>%s\n <dd>%s\n' % (key, text))
         elif btype == 'option':
             openlist('dl', level)
             opt = escape(b['optstr'])
-            desc = escape(' '.join(map(str.strip, lines)))
+            desc = escape(' '.join(pycompat.maplist(str.strip, lines)))
             out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
 
         # close lists if indent level of next block is lower
diff -r 86026839d8fd -r a45b55d159b2 mercurial/phases.py
--- a/mercurial/phases.py	Fri Mar 24 20:38:46 2017 +0530
+++ b/mercurial/phases.py	Fri Mar 24 20:39:23 2017 +0530
@@ -114,6 +114,7 @@
 )
 from . import (
     error,
+    pycompat,
     smartset,
     txnutil,
 )
@@ -204,7 +205,8 @@
         repo = repo.unfiltered()
         nativeroots = []
         for phase in trackedphases:
-            nativeroots.append(map(repo.changelog.rev, self.phaseroots[phase]))
+            nativeroots.append(pycompat.maplist(repo.changelog.rev,
+                    self.phaseroots[phase]))
         return repo.changelog.computephases(nativeroots)
 
     def _computephaserevspure(self, repo):
@@ -213,7 +215,7 @@
         self._phaserevs = revs
         self._populatephaseroots(repo)
         for phase in trackedphases:
-            roots = list(map(repo.changelog.rev, self.phaseroots[phase]))
+            roots = pycompat.maplist(repo.changelog.rev, self.phaseroots[phase])
             if roots:
                 for rev in roots:
                     revs[rev] = phase
diff -r 86026839d8fd -r a45b55d159b2 mercurial/pycompat.py
--- a/mercurial/pycompat.py	Fri Mar 24 20:38:46 2017 +0530
+++ b/mercurial/pycompat.py	Fri Mar 24 20:39:23 2017 +0530
@@ -259,7 +259,7 @@
 
     def _registeraliases(self, origin, items):
         """Add items that will be populated at the first access"""
-        items = map(sysstr, items)
+        items = maplist(sysstr, items)
         self._aliases.update(
             (item.replace(sysstr('_'), sysstr('')).lower(), (origin, item))
             for item in items)


More information about the Mercurial-devel mailing list