stringutil: rename local email/names variables to their plural forms
authorConnor Sheehan <sheehan@mozilla.com>
Sat, 31 Mar 2018 10:21:39 -0400
changeset 37245 54b896f195d1
parent 37244 3685a79ea51b
child 37246 0e7550b0964c
stringutil: rename local email/names variables to their plural forms email and name variables are renamed to emails and names (respectively). This is because the email variable name shadows the email function within the stringutil module. Since we are renaming email, we also rename name for consistency. Differential Revision: https://phab.mercurial-scm.org/D3002
mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py	Sat Mar 31 10:13:42 2018 -0400
+++ b/mercurial/utils/stringutil.py	Sat Mar 31 10:21:39 2018 -0400
@@ -202,9 +202,9 @@
         if line.lstrip().startswith('#') or any(c not in line for c in '<>@'):
             continue
 
-        # name, email hold the parsed emails and names for each line
+        # names, emails hold the parsed emails and names for each line
         # name_builder holds the words in a persons name
-        name, email = [], []
+        names, emails = [], []
         namebuilder = []
 
         for element in line.split():
@@ -215,15 +215,15 @@
             elif element.startswith('<') and element.endswith('>'):
                 # We have found an email.
                 # Parse it, and finalize any names from earlier
-                email.append(element[1:-1])  # Slice off the "<>"
+                emails.append(element[1:-1])  # Slice off the "<>"
 
                 if namebuilder:
-                    name.append(' '.join(namebuilder))
+                    names.append(' '.join(namebuilder))
                     namebuilder = []
 
                 # Break if we have found a second email, any other
                 # data does not fit the spec for .mailmap
-                if len(email) > 1:
+                if len(emails) > 1:
                     break
 
             else:
@@ -231,13 +231,13 @@
                 namebuilder.append(element)
 
         mailmapkey = mailmapping(
-            email=email[-1],
-            name=name[-1] if len(name) == 2 else None,
+            email=emails[-1],
+            name=names[-1] if len(names) == 2 else None,
         )
 
         mailmap[mailmapkey] = mailmapping(
-            email=email[0],
-            name=name[0] if name else None,
+            email=emails[0],
+            name=names[0] if names else None,
         )
 
     return mailmap