← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:rename-ignored-dummy-variables into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:rename-ignored-dummy-variables into launchpad:master.

Commit message:
Rename ignored "dummy" variables

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The Python convention is to use `_` for this sort of thing.  There was one place where I needed to use a different name because the module already used `from lp import _` for marking localizable text.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:rename-ignored-dummy-variables into launchpad:master.
diff --git a/cronscripts/foaf-update-karma-cache.py b/cronscripts/foaf-update-karma-cache.py
index 9f16cc9..844a518 100755
--- a/cronscripts/foaf-update-karma-cache.py
+++ b/cronscripts/foaf-update-karma-cache.py
@@ -250,7 +250,7 @@ class KarmaCacheUpdater(LaunchpadCronScript):
         # By calculating a scaling factor automatically, this slant will be
         # removed even as more events are added or scoring tweaked.
         points_per_category = {}
-        for dummy, category, dummy, dummy, points in results:
+        for _, category, _, _, points in results:
             if category not in points_per_category:
                 points_per_category[category] = 0
             points_per_category[category] += points
diff --git a/lib/lp/app/stories/basics/xx-opstats.rst b/lib/lp/app/stories/basics/xx-opstats.rst
index 3ddf507..0dcd7d6 100644
--- a/lib/lp/app/stories/basics/xx-opstats.rst
+++ b/lib/lp/app/stories/basics/xx-opstats.rst
@@ -398,7 +398,7 @@ But our database connections are broken.
     storm.exceptions.DisconnectionError:
     FATAL:  database "nonexistent" does not exist
 
-    >>> dummy = config.pop("no_db")
+    >>> _ = config.pop("no_db")
     >>> getUtility(IZStorm)._reset()
 
     >>> print(IStore(Person).find(Person, name="janitor").one().name)
diff --git a/lib/lp/app/widgets/date.py b/lib/lp/app/widgets/date.py
index 2b58da5..7925a3c 100644
--- a/lib/lp/app/widgets/date.py
+++ b/lib/lp/app/widgets/date.py
@@ -405,7 +405,7 @@ class DateTimeWidget(TextWidget):
             return self.context.missing_value
         self._checkSupportedFormat(input)
         try:
-            year, month, day, hour, minute, second, dummy_tz = parse(input)
+            year, month, day, hour, minute, second, _ = parse(input)
             second, micro = divmod(second, 1.0)
             micro = round_half_up(micro * 1000000)
             dt = datetime(year, month, day, hour, minute, int(second), micro)
diff --git a/lib/lp/app/widgets/image.py b/lib/lp/app/widgets/image.py
index 233d75e..4e6e027 100644
--- a/lib/lp/app/widgets/image.py
+++ b/lib/lp/app/widgets/image.py
@@ -156,7 +156,7 @@ class ImageChangeWidget(SimpleInputWidget):
             self._image.seek(0)
             content = self._image.read()
             filename = self._image.filename
-            type, dummy = guess_content_type(name=filename, body=content)
+            type, encoding = guess_content_type(name=filename, body=content)
 
             # This method may be called more than once in a single request. If
             # that's the case here we'll simply return the cached
diff --git a/lib/lp/bugs/browser/tests/bugtask-adding-views.rst b/lib/lp/bugs/browser/tests/bugtask-adding-views.rst
index 9c8e91b..6ce5037 100644
--- a/lib/lp/bugs/browser/tests/bugtask-adding-views.rst
+++ b/lib/lp/bugs/browser/tests/bugtask-adding-views.rst
@@ -573,7 +573,7 @@ this way, though.  If there are too many products using a given bugtracker,
 we'll present only the ones whose name is similar to what the user entered.
 
     >>> flush_database_updates()
-    >>> dummy = form.pop("create_new")
+    >>> _ = form.pop("create_new")
     >>> form["field.name"] = "foo"
     >>> form["field.display_name"] = "Foo, the return"
     >>> form["field.summary"] = "Foo"
@@ -606,7 +606,7 @@ sense and could fail when the user didn't have the necessary rights on the
 project in question.
 
     >>> login("no-priv@xxxxxxxxxxxxx")
-    >>> dummy = form.pop("field.actions.continue")
+    >>> _ = form.pop("field.actions.continue")
     >>> form["field.existing_product"] = "foo-product"
     >>> form["field.actions.use_existing_product"] = 1
     >>> bugtask_one = getUtility(IBugSet).get(1).bugtasks[0]
diff --git a/lib/lp/code/stories/codeimport/xx-failing-codeimport.rst b/lib/lp/code/stories/codeimport/xx-failing-codeimport.rst
index 8225582..b7800f6 100644
--- a/lib/lp/code/stories/codeimport/xx-failing-codeimport.rst
+++ b/lib/lp/code/stories/codeimport/xx-failing-codeimport.rst
@@ -14,7 +14,7 @@ Imports that have failed more than the configured
     ...     product=product, branch_name="trunk", registrant=owner
     ... )
     >>> for i in range(config.codeimport.consecutive_failure_limit):
-    ...     dummy = make_finished_import(
+    ...     _ = make_finished_import(
     ...         code_import, CodeImportResultStatus.FAILURE, factory=factory
     ...     )
     ...
diff --git a/lib/lp/registry/doc/person-karma.rst b/lib/lp/registry/doc/person-karma.rst
index e57ff19..2091cbd 100644
--- a/lib/lp/registry/doc/person-karma.rst
+++ b/lib/lp/registry/doc/person-karma.rst
@@ -39,7 +39,7 @@ assigned to a given person.
     >>> karma_helper = KarmaAssignedEventListener()
     >>> karma_helper.register_listener()
 
-    >>> dummy = salgado.assignKarma("specreviewed", product=firefox)
+    >>> _ = salgado.assignKarma("specreviewed", product=firefox)
     Karma added: action=specreviewed, product=firefox
 
     >>> karma_helper.unregister_listener()
@@ -82,11 +82,11 @@ karma.
 
     >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
     >>> janitor = getUtility(ILaunchpadCelebrities).janitor
-    >>> dummy = janitor.assignKarma("specreviewed", product=firefox)
+    >>> _ = janitor.assignKarma("specreviewed", product=firefox)
     <BLANKLINE>
 
     >>> ubuntu_team = getUtility(IPersonSet).getByName("ubuntu-team")
-    >>> dummy = janitor.assignKarma("specreviewed", product=firefox)
+    >>> _ = janitor.assignKarma("specreviewed", product=firefox)
     <BLANKLINE>
 
 
diff --git a/lib/lp/registry/doc/person.rst b/lib/lp/registry/doc/person.rst
index f90db65..8721bea 100644
--- a/lib/lp/registry/doc/person.rst
+++ b/lib/lp/registry/doc/person.rst
@@ -475,7 +475,7 @@ these are actual people.  Sometimes, though, these should actually be
 teams, so we provide an easy way to turn one of these auto created
 entries into teams.
 
-    >>> not_a_person, dummy = personset.createPersonAndEmail(
+    >>> not_a_person, _ = personset.createPersonAndEmail(
     ...     "foo@xxxxxxxxxx",
     ...     PersonCreationRationale.SOURCEPACKAGEIMPORT,
     ...     comment="when the ed package was imported into Ubuntu Feisty",
diff --git a/lib/lp/registry/doc/teammembership-email-notification.rst b/lib/lp/registry/doc/teammembership-email-notification.rst
index 3568d33..5123960 100644
--- a/lib/lp/registry/doc/teammembership-email-notification.rst
+++ b/lib/lp/registry/doc/teammembership-email-notification.rst
@@ -186,7 +186,7 @@ The same goes for approving a proposed member.
     # stub.test_emails
 
     >>> run_mail_jobs()
-    >>> dummy = pop_notifications()
+    >>> _ = pop_notifications()
 
     >>> setStatus(
     ...     daf_membership,
@@ -1063,7 +1063,7 @@ notification email contain subscription information.
     >>> team_one, list_one = factory.makeTeamAndMailingList(
     ...     "team-one", owner.name
     ... )
-    >>> dummy = pop_notifications()
+    >>> _ = pop_notifications()
     >>> member = factory.makePerson(
     ...     name="team-member", email="team-member@xxxxxxxxxxx"
     ... )
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index 857bf84..ccf1fe8 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -1236,7 +1236,7 @@ class Distribution(
         assert (
             url is not None
         ), "A mirror must provide at least one HTTP/HTTPS/FTP URL."
-        dummy, host, dummy, dummy, dummy, dummy = urlparse(url)
+        _, host, _, _, _, _ = urlparse(url)
         name = sanitize_name("%s-%s" % (host, content.name.lower()))
 
         orig_name = name
diff --git a/lib/lp/registry/scripts/distributionmirror_prober.py b/lib/lp/registry/scripts/distributionmirror_prober.py
index f0014c3..dc23c67 100644
--- a/lib/lp/registry/scripts/distributionmirror_prober.py
+++ b/lib/lp/registry/scripts/distributionmirror_prober.py
@@ -463,7 +463,7 @@ class ProberFactory(protocol.ClientFactory):
         # use it as the host we're going to connect to.
         proxy = config.launchpad.http_proxy
         if proxy:
-            scheme, host, port, dummy = _parse(proxy)
+            scheme, host, port, _ = _parse(proxy)
             path = url
 
         self.connect_scheme = scheme
@@ -1080,7 +1080,7 @@ def should_skip_host(host):
 
 def _parse(url, defaultPort=None):
     """Parse the given URL returning the scheme, host, port and path."""
-    scheme, host, path, dummy, dummy, dummy = urlparse(url)
+    scheme, host, path, _, _, _ = urlparse(url)
     if ":" in host:
         host, port = host.split(":")
         assert port.isdigit()
diff --git a/lib/lp/registry/vocabularies.py b/lib/lp/registry/vocabularies.py
index 59a48a8..9d12f8f 100644
--- a/lib/lp/registry/vocabularies.py
+++ b/lib/lp/registry/vocabularies.py
@@ -1236,7 +1236,7 @@ class ProductReleaseVocabulary(SQLObjectVocabularyBase):
     def getTermByToken(self, token):
         """See `IVocabularyTokenized`."""
         try:
-            productname, productseriesname, dummy = token.split("/", 2)
+            productname, productseriesname, _ = token.split("/", 2)
         except ValueError:
             raise LookupError(token)
 
diff --git a/lib/lp/translations/stories/standalone/xx-pofile-translate-alternative-language.rst b/lib/lp/translations/stories/standalone/xx-pofile-translate-alternative-language.rst
index 38448fb..2968d00 100644
--- a/lib/lp/translations/stories/standalone/xx-pofile-translate-alternative-language.rst
+++ b/lib/lp/translations/stories/standalone/xx-pofile-translate-alternative-language.rst
@@ -11,7 +11,7 @@ in the form's main language.
 
     >>> login(ANONYMOUS)
     >>> utility = getUtility(IPOTemplateSet)
-    >>> dummy = utility.populateSuggestivePOTemplatesCache()
+    >>> _ = utility.populateSuggestivePOTemplatesCache()
     >>> logout()
 
     >>> def get_alternative_languages_widget(browser):
diff --git a/lib/lp/translations/stories/standalone/xx-pofile-translate-dismiss-suggestions.rst b/lib/lp/translations/stories/standalone/xx-pofile-translate-dismiss-suggestions.rst
index 246fde1..9b4833f 100644
--- a/lib/lp/translations/stories/standalone/xx-pofile-translate-dismiss-suggestions.rst
+++ b/lib/lp/translations/stories/standalone/xx-pofile-translate-dismiss-suggestions.rst
@@ -10,7 +10,7 @@ suggestions can be dismissed to keep them off the page.
 
     >>> login(ANONYMOUS)
     >>> utility = getUtility(IPOTemplateSet)
-    >>> dummy = utility.populateSuggestivePOTemplatesCache()
+    >>> _ = utility.populateSuggestivePOTemplatesCache()
     >>> logout()
 
 
diff --git a/lib/lp/translations/stories/standalone/xx-pofile-translate-legal-warning.rst b/lib/lp/translations/stories/standalone/xx-pofile-translate-legal-warning.rst
index c76e1f7..56ca46e 100644
--- a/lib/lp/translations/stories/standalone/xx-pofile-translate-legal-warning.rst
+++ b/lib/lp/translations/stories/standalone/xx-pofile-translate-legal-warning.rst
@@ -16,7 +16,7 @@ from the upstream project.
 
     >>> login(ANONYMOUS)
     >>> utility = getUtility(IPOTemplateSet)
-    >>> dummy = utility.populateSuggestivePOTemplatesCache()
+    >>> _ = utility.populateSuggestivePOTemplatesCache()
     >>> logout()
 
     >>> browser = setupBrowser(auth="Basic carlos@xxxxxxxxxxxxx:test")
diff --git a/lib/lp/translations/stories/standalone/xx-pofile-translate.rst b/lib/lp/translations/stories/standalone/xx-pofile-translate.rst
index f1b6855..87e3a30 100644
--- a/lib/lp/translations/stories/standalone/xx-pofile-translate.rst
+++ b/lib/lp/translations/stories/standalone/xx-pofile-translate.rst
@@ -20,7 +20,7 @@ xx-pofile-translate-performance.rst
 
     >>> login(ANONYMOUS)
     >>> utility = getUtility(IPOTemplateSet)
-    >>> dummy = utility.populateSuggestivePOTemplatesCache()
+    >>> _ = utility.populateSuggestivePOTemplatesCache()
     >>> logout()
 
 
diff --git a/lib/lp/translations/stories/standalone/xx-translationmessage-translate.rst b/lib/lp/translations/stories/standalone/xx-translationmessage-translate.rst
index f7dae8b..75b503f 100644
--- a/lib/lp/translations/stories/standalone/xx-translationmessage-translate.rst
+++ b/lib/lp/translations/stories/standalone/xx-translationmessage-translate.rst
@@ -11,7 +11,7 @@ The suggestive-templates cache needs to be up to date.
 
     >>> login(ANONYMOUS)
     >>> utility = getUtility(IPOTemplateSet)
-    >>> dummy = utility.populateSuggestivePOTemplatesCache()
+    >>> _ = utility.populateSuggestivePOTemplatesCache()
     >>> logout()
 
 
diff --git a/lib/lp/translations/stories/translationgroups/xx-translationgroups.rst b/lib/lp/translations/stories/translationgroups/xx-translationgroups.rst
index e703fcc..a2e7dc6 100644
--- a/lib/lp/translations/stories/translationgroups/xx-translationgroups.rst
+++ b/lib/lp/translations/stories/translationgroups/xx-translationgroups.rst
@@ -1286,7 +1286,7 @@ suggestions in Spanish.
     ... )
 
     >>> utility = getUtility(IPOTemplateSet)
-    >>> dummy = utility.populateSuggestivePOTemplatesCache()
+    >>> _ = utility.populateSuggestivePOTemplatesCache()
 
     >>> logout()