← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:flake8-e741 into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:flake8-e741 into launchpad:master.

Commit message:
flake8: Fix E741 ambiguous variable name

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406626

Use a clearer variable name than "l" in these cases.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:flake8-e741 into launchpad:master.
diff --git a/lib/lp/archivepublisher/indices.py b/lib/lp/archivepublisher/indices.py
index d0ca89d..d737f7a 100644
--- a/lib/lp/archivepublisher/indices.py
+++ b/lib/lp/archivepublisher/indices.py
@@ -79,8 +79,8 @@ class IndexStanzaFields:
         return '\n'.join(output_lines)
 
 
-def format_file_list(l):
-    return ''.join('\n %s %s %s' % ((h,) + f) for (h, f) in l)
+def format_file_list(lst):
+    return ''.join('\n %s %s %s' % ((h,) + f) for (h, f) in lst)
 
 
 def format_description(summary, description):
diff --git a/lib/lp/registry/personmerge.py b/lib/lp/registry/personmerge.py
index 830c010..1767c8c 100644
--- a/lib/lp/registry/personmerge.py
+++ b/lib/lp/registry/personmerge.py
@@ -640,7 +640,8 @@ def _mergeLiveFS(cur, from_person, to_person):
     # This shouldn't use removeSecurityProxy.
     livefses = getUtility(ILiveFSSet).getByPerson(from_person)
     existing_names = [
-        l.name for l in getUtility(ILiveFSSet).getByPerson(to_person)]
+        livefs.name
+        for livefs in getUtility(ILiveFSSet).getByPerson(to_person)]
     for livefs in livefses:
         new_name = livefs.name
         count = 1
diff --git a/lib/lp/registry/scripts/distributionmirror_prober.py b/lib/lp/registry/scripts/distributionmirror_prober.py
index 5530c5a..7620cc7 100644
--- a/lib/lp/registry/scripts/distributionmirror_prober.py
+++ b/lib/lp/registry/scripts/distributionmirror_prober.py
@@ -249,8 +249,7 @@ class RedirectAwareProberProtocol(ProberProtocol):
 
     def handleHeader(self, key, value):
         key = key.lower()
-        l = self.headers.setdefault(key, [])
-        l.append(value)
+        self.headers.setdefault(key, []).append(value)
 
     def handleStatus(self, version, status, message):
         if int(status) in self.handled_redirect_statuses:
diff --git a/lib/lp/registry/scripts/productreleasefinder/log.py b/lib/lp/registry/scripts/productreleasefinder/log.py
index 112d2e6..81c989f 100644
--- a/lib/lp/registry/scripts/productreleasefinder/log.py
+++ b/lib/lp/registry/scripts/productreleasefinder/log.py
@@ -16,8 +16,8 @@ import logging
 def get_logger(name, parent=None):
     """Create a logging instance underneath the given parent."""
     if parent is None or parent == parent.root:
-        l = logging.getLogger(name)
+        logger = logging.getLogger(name)
     else:
-        l = logging.getLogger("%s.%s" % (parent.name, name))
+        logger = logging.getLogger("%s.%s" % (parent.name, name))
 
-    return l
+    return logger
diff --git a/lib/lp/registry/tests/test_personmerge.py b/lib/lp/registry/tests/test_personmerge.py
index 5c75436..8194a63 100644
--- a/lib/lp/registry/tests/test_personmerge.py
+++ b/lib/lp/registry/tests/test_personmerge.py
@@ -628,7 +628,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
         duplicate, mergee = self._do_merge(duplicate, mergee)
         livefses = getUtility(ILiveFSSet).getByPerson(mergee)
         self.assertEqual(2, livefses.count())
-        project_names = [l.metadata['project'] for l in livefses]
+        project_names = [livefs.metadata['project'] for livefs in livefses]
         self.assertEqual(['TO', 'FROM'], project_names)
         self.assertEqual(u'foo-1', livefses[1].name)
 
diff --git a/lib/lp/services/mail/tests/test_dkim.py b/lib/lp/services/mail/tests/test_dkim.py
index 2adb272..3100f67 100644
--- a/lib/lp/services/mail/tests/test_dkim.py
+++ b/lib/lp/services/mail/tests/test_dkim.py
@@ -139,9 +139,9 @@ class TestDKIM(TestCaseWithFactory):
                 + six.ensure_text(signed_message, errors='replace'))
 
     def assertDkimLogContains(self, substring):
-        l = self.get_dkim_log()
-        if l.find(substring) == -1:
-            self.fail("didn't find %r in log: %s" % (substring, l))
+        log = self.get_dkim_log()
+        if log.find(substring) == -1:
+            self.fail("didn't find %r in log: %s" % (substring, log))
 
     def makeMessageBytes(self, sender=None, from_address=None):
         if from_address is None:
diff --git a/lib/lp/services/profile/mem.py b/lib/lp/services/profile/mem.py
index 788d1fa..062fafe 100644
--- a/lib/lp/services/profile/mem.py
+++ b/lib/lp/services/profile/mem.py
@@ -230,9 +230,9 @@ if __name__ == "__main__":
     gc.set_debug(gc.DEBUG_LEAK)
 
     # make a leak
-    l = []
-    l.append(l)
-    del l
+    lst = []
+    lst.append(lst)
+    del lst
 
     # show the dirt ;-)
     dump_garbage()
diff --git a/lib/lp/testing/pgsql.py b/lib/lp/testing/pgsql.py
index 5ef18ba..c4dffc4 100644
--- a/lib/lp/testing/pgsql.py
+++ b/lib/lp/testing/pgsql.py
@@ -257,7 +257,7 @@ rw_main_slave:  dbname=%s
         debug = False
         if debug:
             sys.stderr.write('%0.2f starting %s\n' % (start, pid,))
-        l = None
+        lock = None
         lockname = '/tmp/lp.createdb.%s' % (self.template,)
         # Wait for the external lock.  Most LP tests use the
         # DatabaseLayer which does a double-indirect: it clones the
@@ -273,7 +273,7 @@ rw_main_slave:  dbname=%s
             try:
                 if debug:
                     sys.stderr.write('taking %s\n' % (pid,))
-                l = WriteLock(lockname)
+                lock = WriteLock(lockname)
                 if debug:
                     sys.stderr.write('%0.2f taken %s\n' % (time.time(), pid,))
                 break
@@ -281,7 +281,7 @@ rw_main_slave:  dbname=%s
                 if debug:
                     sys.stderr.write('blocked %s\n' % (pid,))
             time.sleep(random.random())
-        if l is None:
+        if lock is None:
             raise LockContention(lockname)
         try:
             # The clone may be delayed if gc has not disconnected other
@@ -337,7 +337,7 @@ rw_main_slave:  dbname=%s
                     '%0.2f (%0.2f) completed (%d retries) %s %s\n'
                     % (end, end - start, counter, pid, self.template))
         finally:
-            l.unlock()
+            lock.unlock()
             if debug:
                 sys.stderr.write('released %s\n' % (pid,))