Merge ~cjwatson/launchpad:bugbear-unused-loop-variables into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 11b5b04333d8f08a8ba21a1cffadba29759a05bd
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:bugbear-unused-loop-variables
Merge into: launchpad:master
Diff against target: 3604 lines (+335/-344)
186 files modified
charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py (+1/-1)
configs/development/gunicorn.conf.py (+1/-1)
database/schema/fti.py (+2/-2)
database/schema/online_fti_updater.py (+4/-6)
database/schema/preflight.py (+2/-2)
lib/lp/answers/model/question.py (+1/-1)
lib/lp/archivepublisher/publishing.py (+3/-3)
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+1/-1)
lib/lp/archivepublisher/signing.py (+1/-1)
lib/lp/archivepublisher/tests/test_publisher.py (+1/-1)
lib/lp/archivepublisher/tests/test_publisherconfig.py (+1/-1)
lib/lp/archivepublisher/tests/test_signing.py (+1/-1)
lib/lp/archivepublisher/tests/test_sync_signingkeys.py (+1/-1)
lib/lp/archiveuploader/ocirecipeupload.py (+1/-1)
lib/lp/archiveuploader/uploadprocessor.py (+1/-1)
lib/lp/blueprints/browser/tests/test_sprint.py (+3/-3)
lib/lp/blueprints/model/tests/test_sprint.py (+1/-1)
lib/lp/blueprints/tests/test_specification.py (+1/-1)
lib/lp/bugs/browser/bugcomment.py (+1/-1)
lib/lp/bugs/browser/bugsubscription.py (+1/-1)
lib/lp/bugs/browser/tests/test_bug_views.py (+2/-2)
lib/lp/bugs/browser/tests/test_bugnomination.py (+4/-4)
lib/lp/bugs/browser/tests/test_bugtarget_tags.py (+2/-2)
lib/lp/bugs/browser/tests/test_bugtask.py (+3/-3)
lib/lp/bugs/browser/tests/test_expose.py (+1/-1)
lib/lp/bugs/model/bugnotification.py (+1/-1)
lib/lp/bugs/model/tests/test_bug.py (+4/-4)
lib/lp/bugs/model/tests/test_bugsummary.py (+3/-3)
lib/lp/bugs/model/tests/test_bugtask.py (+1/-1)
lib/lp/bugs/scripts/bugnotification.py (+1/-1)
lib/lp/bugs/scripts/checkwatches/tests/test_scheduler.py (+1/-1)
lib/lp/bugs/scripts/tests/test_bugnotification.py (+5/-9)
lib/lp/bugs/tests/bug.py (+1/-1)
lib/lp/bugs/tests/externalbugtracker.py (+2/-2)
lib/lp/bugs/tests/test_bug_messages_webservice.py (+1/-1)
lib/lp/bugs/tests/test_bugnotification.py (+1/-1)
lib/lp/bugs/tests/test_bugs_webservice.py (+3/-3)
lib/lp/bugs/tests/test_bugsearch_conjoined.py (+2/-2)
lib/lp/bugs/tests/test_bugsubscription.py (+1/-1)
lib/lp/bugs/tests/test_bugtracker.py (+1/-1)
lib/lp/bugs/tests/test_bugwatch.py (+1/-1)
lib/lp/bugs/tests/test_cve.py (+1/-1)
lib/lp/bugs/tests/test_doc.py (+1/-1)
lib/lp/buildmaster/browser/tests/test_builder_views.py (+1/-1)
lib/lp/buildmaster/tests/test_webservice.py (+1/-1)
lib/lp/charms/tests/test_charmbase.py (+1/-1)
lib/lp/charms/tests/test_charmrecipe.py (+5/-5)
lib/lp/charms/tests/test_charmrecipebuild.py (+1/-1)
lib/lp/code/browser/branchlisting.py (+1/-1)
lib/lp/code/browser/gitrepository.py (+2/-2)
lib/lp/code/browser/tests/test_branch.py (+5/-5)
lib/lp/code/browser/tests/test_branchlisting.py (+2/-2)
lib/lp/code/browser/tests/test_branchmergeproposal.py (+1/-1)
lib/lp/code/browser/tests/test_branchmergeproposallisting.py (+3/-3)
lib/lp/code/browser/tests/test_codereviewcomment.py (+1/-1)
lib/lp/code/browser/tests/test_gitlisting.py (+2/-2)
lib/lp/code/browser/tests/test_gitref.py (+2/-2)
lib/lp/code/model/branchjob.py (+1/-1)
lib/lp/code/model/branchmergeproposal.py (+2/-2)
lib/lp/code/model/diff.py (+1/-1)
lib/lp/code/model/tests/test_branch.py (+1/-1)
lib/lp/code/model/tests/test_branchcloud.py (+6/-6)
lib/lp/code/model/tests/test_branchcollection.py (+5/-5)
lib/lp/code/model/tests/test_branchmergeproposal.py (+1/-1)
lib/lp/code/model/tests/test_branchpuller.py (+2/-2)
lib/lp/code/model/tests/test_cibuild.py (+1/-1)
lib/lp/code/model/tests/test_codeimportjob.py (+3/-3)
lib/lp/code/model/tests/test_codereviewinlinecomment.py (+1/-1)
lib/lp/code/model/tests/test_gitcollection.py (+1/-1)
lib/lp/code/model/tests/test_gitrepository.py (+5/-5)
lib/lp/code/model/tests/test_revision.py (+2/-2)
lib/lp/code/model/tests/test_revisioncache.py (+3/-3)
lib/lp/code/model/tests/test_sourcepackagerecipe.py (+1/-1)
lib/lp/code/scripts/tests/test_repack_git_repositories.py (+1/-1)
lib/lp/code/tests/helpers.py (+1/-1)
lib/lp/codehosting/scanner/buglinks.py (+1/-1)
lib/lp/codehosting/tests/test_rewrite.py (+2/-2)
lib/lp/codehosting/upgrade.py (+1/-1)
lib/lp/oci/tests/test_ocirecipe.py (+3/-3)
lib/lp/oci/tests/test_ocirecipebuild.py (+1/-1)
lib/lp/registry/browser/person.py (+1/-1)
lib/lp/registry/browser/tests/test_distributionsourcepackage.py (+1/-1)
lib/lp/registry/browser/tests/test_distroseries.py (+4/-4)
lib/lp/registry/browser/tests/test_mailinglists.py (+1/-1)
lib/lp/registry/browser/tests/test_milestone.py (+4/-4)
lib/lp/registry/browser/tests/test_person.py (+1/-1)
lib/lp/registry/browser/tests/test_person_contact.py (+4/-4)
lib/lp/registry/browser/tests/test_person_webservice.py (+1/-1)
lib/lp/registry/browser/tests/test_pillar_sharing.py (+1/-1)
lib/lp/registry/model/person.py (+9/-2)
lib/lp/registry/model/pillar.py (+1/-3)
lib/lp/registry/model/product.py (+1/-1)
lib/lp/registry/personmerge.py (+2/-2)
lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py (+1/-1)
lib/lp/registry/services/tests/test_sharingservice.py (+14/-14)
lib/lp/registry/tests/test_accesspolicy.py (+1/-1)
lib/lp/registry/tests/test_distroseries.py (+1/-1)
lib/lp/registry/tests/test_distroseries_vocabularies.py (+2/-2)
lib/lp/registry/tests/test_distroseriesdifference.py (+1/-1)
lib/lp/registry/tests/test_milestone.py (+5/-5)
lib/lp/registry/tests/test_milestonetag.py (+2/-2)
lib/lp/registry/tests/test_notification.py (+2/-2)
lib/lp/registry/tests/test_person.py (+1/-1)
lib/lp/registry/tests/test_product.py (+1/-1)
lib/lp/registry/tests/test_productseries.py (+8/-8)
lib/lp/registry/tests/test_teammembership.py (+1/-1)
lib/lp/scripts/garbo.py (+2/-2)
lib/lp/scripts/tests/test_garbo.py (+4/-4)
lib/lp/scripts/utilities/importpedant.py (+1/-1)
lib/lp/scripts/utilities/warninghandler.py (+1/-1)
lib/lp/services/database/postgresql.py (+1/-1)
lib/lp/services/database/sqlbase.py (+2/-2)
lib/lp/services/features/flags.py (+2/-2)
lib/lp/services/gpg/handler.py (+2/-2)
lib/lp/services/helpers.py (+1/-1)
lib/lp/services/job/tests/test_celeryjob.py (+2/-2)
lib/lp/services/job/tests/test_runner.py (+1/-1)
lib/lp/services/librarianserver/librariangc.py (+3/-3)
lib/lp/services/librarianserver/tests/test_db_outage.py (+1/-1)
lib/lp/services/librarianserver/tests/test_swift.py (+1/-1)
lib/lp/services/mail/tests/test_mailbox.py (+1/-1)
lib/lp/services/oauth/tests/test_tokens.py (+2/-2)
lib/lp/services/osutils.py (+1/-1)
lib/lp/services/profile/profile.py (+2/-2)
lib/lp/services/profile/tests.py (+1/-1)
lib/lp/services/scripts/tests/__init__.py (+1/-1)
lib/lp/services/spriteutils.py (+1/-1)
lib/lp/services/stacktrace.py (+1/-1)
lib/lp/services/testing/__init__.py (+1/-1)
lib/lp/services/testing/parallel.py (+1/-1)
lib/lp/services/testing/tests/test_customresult.py (+1/-1)
lib/lp/services/tests/test_command_spawner.py (+1/-1)
lib/lp/services/tests/test_timeout.py (+1/-1)
lib/lp/services/twistedsupport/tests/test_task.py (+1/-1)
lib/lp/services/webapp/metazcml.py (+1/-1)
lib/lp/services/webapp/publisher.py (+1/-8)
lib/lp/services/webapp/tests/test_batching.py (+3/-3)
lib/lp/services/webapp/tests/test_error.py (+1/-1)
lib/lp/services/webhooks/model.py (+1/-1)
lib/lp/services/webservice/tests/test_wadllib.py (+1/-1)
lib/lp/services/worlddata/tests/test_language.py (+1/-1)
lib/lp/snappy/tests/test_snap.py (+7/-7)
lib/lp/snappy/tests/test_snapbuild.py (+1/-1)
lib/lp/soyuz/adapters/tests/test_overrides.py (+5/-5)
lib/lp/soyuz/browser/tests/test_archive_packages.py (+2/-2)
lib/lp/soyuz/browser/tests/test_archivesubscription.py (+1/-1)
lib/lp/soyuz/browser/tests/test_build_views.py (+1/-1)
lib/lp/soyuz/browser/tests/test_queue.py (+3/-3)
lib/lp/soyuz/model/distroseriespackagecache.py (+1/-1)
lib/lp/soyuz/scripts/tests/test_copypackage.py (+1/-1)
lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py (+1/-1)
lib/lp/soyuz/tests/test_archive.py (+2/-2)
lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py (+2/-2)
lib/lp/soyuz/tests/test_distroseriesdifferencejob.py (+2/-2)
lib/lp/soyuz/tests/test_livefs.py (+1/-1)
lib/lp/soyuz/tests/test_livefsbuild.py (+1/-1)
lib/lp/soyuz/tests/test_packagecopyjob.py (+1/-1)
lib/lp/soyuz/tests/test_processacceptedbugsjob.py (+2/-2)
lib/lp/soyuz/tests/test_publishing.py (+1/-1)
lib/lp/testing/__init__.py (+3/-3)
lib/lp/testing/dbuser.py (+1/-1)
lib/lp/testing/factory.py (+2/-2)
lib/lp/testing/fixture.py (+1/-1)
lib/lp/testing/layers.py (+1/-1)
lib/lp/testing/swift/fakeswift.py (+1/-1)
lib/lp/testing/yuixhr.py (+1/-1)
lib/lp/tests/test_opensource.py (+1/-1)
lib/lp/translations/browser/tests/test_distroseries_views.py (+1/-1)
lib/lp/translations/browser/tests/test_translationimportqueueentry.py (+1/-1)
lib/lp/translations/model/currenttranslations.py (+1/-1)
lib/lp/translations/model/translationpolicy.py (+2/-2)
lib/lp/translations/model/translationsoverview.py (+1/-1)
lib/lp/translations/pottery/detect_intltool.py (+1/-1)
lib/lp/translations/tests/test_translationimportqueue.py (+2/-2)
lib/lp/translations/tests/test_translationsplitter.py (+3/-2)
lib/lp/translations/tests/test_translationtemplatesbuild.py (+1/-1)
lib/lp/translations/utilities/gettext_po_parser.py (+1/-1)
lib/lp/translations/utilities/tests/test_translation_importer.py (+1/-1)
lib/lp/translations/utilities/xpi_header.py (+1/-1)
scripts/librarian-report.py (+1/-3)
scripts/memcached-stats.py (+1/-1)
test_on_merge.py (+1/-1)
utilities/community-contributions.py (+1/-1)
utilities/generate-external-bug-status-docs (+1/-1)
utilities/pgmassacre.py (+1/-1)
utilities/pgstats.py (+1/-1)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+454057@code.launchpad.net

Commit message

Remove/rename unused loop variables

Description of the change

`flake8-bugbear` points out:

  B007: Loop control variable not used within the loop body. If this is intended, start the name with an underscore.

In most cases I just changed the variable name to `_` to ignore it. In some cases there was already a `from lp import _` that would have been shadowed by that approach, so I added a prefix instead. In a few cases the code could be simplified in other ways, or the loop variable wasn't actually unused because `flake8-bugbear` was confused by the use of `vars()`.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

There are a couple of spots where we could use `.values()` instead of `.items()` and save the unpacking.

I do not think so, but maybe I miss something?

review: Approve
11b5b04... by Colin Watson

Remove some unnecessary uses of dict.items

Revision history for this message
Colin Watson (cjwatson) wrote :

Quite right - I'd tried to fix that as I went along but clearly missed a few. Done now, thanks.

Revision history for this message
Ines Almeida (ines-almeida) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py b/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py
2index f9c42dd..0952de6 100644
3--- a/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py
4+++ b/charm/launchpad-debian-importer/reactive/launchpad-debian-importer.py
5@@ -27,7 +27,7 @@ def configure():
6 config = get_service_config()
7 config["debian_suites"] = yaml.safe_load(config["debian_suites"])
8 config["debian_components"] = []
9- for suite, components in config["debian_suites"].items():
10+ for components in config["debian_suites"].values():
11 for component in components:
12 if component not in config["debian_components"]:
13 config["debian_components"].append(component)
14diff --git a/configs/development/gunicorn.conf.py b/configs/development/gunicorn.conf.py
15index e2c2ed5..e8dd59b 100644
16--- a/configs/development/gunicorn.conf.py
17+++ b/configs/development/gunicorn.conf.py
18@@ -10,7 +10,7 @@ CONFIG_DIR = os.path.dirname(__file__)
19 def find_files(directory, pattern):
20 """Find files in `directory` matching `pattern`."""
21 result = []
22- for root, dirs, files in os.walk(directory):
23+ for root, _, files in os.walk(directory):
24 for basename in files:
25 matches = fnmatch(basename, pattern)
26 if matches:
27diff --git a/database/schema/fti.py b/database/schema/fti.py
28index 3bb2342..2177ad0 100755
29--- a/database/schema/fti.py
30+++ b/database/schema/fti.py
31@@ -190,7 +190,7 @@ def sexecute(con, sql):
32
33 def nullify(con):
34 """Set all fti index columns to NULL"""
35- for table, ignored in ALL_FTI:
36+ for table, _ in ALL_FTI:
37 table = quote_identifier(table)
38 log.info("Removing full text index data from %s", table)
39 sexecute(con, "ALTER TABLE %s DISABLE TRIGGER tsvectorupdate" % table)
40@@ -205,7 +205,7 @@ def liverebuild(con):
41 batch_size = 50
42
43 cur = con.cursor()
44- for table, ignored in ALL_FTI:
45+ for table, _ in ALL_FTI:
46 table = quote_identifier(table)
47 cur.execute("SELECT max(id) FROM %s" % table)
48 max_id = cur.fetchone()[0]
49diff --git a/database/schema/online_fti_updater.py b/database/schema/online_fti_updater.py
50index 7712111..26ea97b 100755
51--- a/database/schema/online_fti_updater.py
52+++ b/database/schema/online_fti_updater.py
53@@ -20,14 +20,12 @@ def main():
54 con.set_isolation_level(0) # autocommit
55 cur = con.cursor()
56
57- for table, ignored in ALL_FTI:
58- print("Doing %(table)s" % vars(), end="")
59- cur.execute("SELECT id FROM %(table)s" % vars())
60+ for table, _ in ALL_FTI:
61+ print("Doing %s" % table, end="")
62+ cur.execute("SELECT id FROM %s" % table)
63 ids = [row[0] for row in cur.fetchall()]
64 for id in ids:
65- cur.execute(
66- "UPDATE %(table)s SET fti=NULL WHERE id=%(id)s" % vars()
67- )
68+ cur.execute("UPDATE %s SET fti=NULL WHERE id=%s" % (table, id))
69 if id % 100 == 0:
70 print(".", end="")
71 print()
72diff --git a/database/schema/preflight.py b/database/schema/preflight.py
73index 5ac9309..f5c42f6 100755
74--- a/database/schema/preflight.py
75+++ b/database/schema/preflight.py
76@@ -310,7 +310,7 @@ class DatabasePreflight:
77 """Report what patches are due to be applied from this tree."""
78 con = self.lpmain_primary_node.con
79 upgrade.log = self.log
80- for patch_num, patch_file in upgrade.get_patchlist(con):
81+ for _, patch_file in upgrade.get_patchlist(con):
82 self.log.info("%s is pending", os.path.basename(patch_file))
83
84 def check_all(self):
85@@ -381,7 +381,7 @@ class KillConnectionsPreflight(DatabasePreflight):
86 """
87 % sqlvalues(SYSTEM_USERS)
88 )
89- for pid, datname, usename, ignored in cur.fetchall():
90+ for pid, datname, usename, _ in cur.fetchall():
91 all_clear = False
92 if loop_count == num_tries - 1:
93 self.log.fatal(
94diff --git a/lib/lp/answers/model/question.py b/lib/lp/answers/model/question.py
95index af02476..bd760b9 100644
96--- a/lib/lp/answers/model/question.py
97+++ b/lib/lp/answers/model/question.py
98@@ -1045,7 +1045,7 @@ class QuestionSet:
99 # Only packages with open questions are included in the query
100 # result, so initialize each package to 0.
101 counts = {package: 0 for package in packages}
102- for distro_id, spn_id, open_questions in results:
103+ for _, spn_id, open_questions in results:
104 # The SourcePackageNames here should already be pre-fetched,
105 # so that .get(spn_id) won't issue a DB query.
106 sourcepackagename = sourcepackagename_set.get(spn_id)
107diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
108index 0bb7985..622a07f 100644
109--- a/lib/lp/archivepublisher/publishing.py
110+++ b/lib/lp/archivepublisher/publishing.py
111@@ -1882,7 +1882,7 @@ class DirectoryHash:
112 ]
113 with open(path, "rb") as in_file:
114 for chunk in iter(lambda: in_file.read(256 * 1024), b""):
115- for checksum_file, hashobj in hashes:
116+ for _, hashobj in hashes:
117 hashobj.update(chunk)
118
119 for checksum_file, hashobj in hashes:
120@@ -1894,10 +1894,10 @@ class DirectoryHash:
121
122 def add_dir(self, path):
123 """Recursively add a directory path to be checksummed."""
124- for dirpath, dirnames, filenames in os.walk(path):
125+ for dirpath, _, filenames in os.walk(path):
126 for filename in filenames:
127 self.add(os.path.join(dirpath, filename))
128
129 def close(self):
130- for checksum_path, checksum_file, archive_hash in self.checksum_hash:
131+ for _, checksum_file, _ in self.checksum_hash:
132 checksum_file.close()
133diff --git a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
134index 1e94d67..df1e6ea 100644
135--- a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
136+++ b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
137@@ -351,7 +351,7 @@ class PublishFTPMaster(LaunchpadCronScript):
138 def setUpDirs(self):
139 """Create archive roots and such if they did not yet exist."""
140 for distro_configs in self.configs.values():
141- for archive_purpose, archive_config in distro_configs.items():
142+ for archive_config in distro_configs.values():
143 archiveroot = archive_config.archiveroot
144 if not file_exists(archiveroot):
145 self.logger.debug("Creating archive root %s.", archiveroot)
146diff --git a/lib/lp/archivepublisher/signing.py b/lib/lp/archivepublisher/signing.py
147index cad47f1..36f5681 100644
148--- a/lib/lp/archivepublisher/signing.py
149+++ b/lib/lp/archivepublisher/signing.py
150@@ -282,7 +282,7 @@ class SigningUpload(CustomUpload):
151 SigningKeyType.FIT: self.signFit,
152 }
153
154- for dirpath, dirnames, filenames in os.walk(self.tmpdir):
155+ for dirpath, _, filenames in os.walk(self.tmpdir):
156 for filename in filenames:
157 file_path = os.path.join(dirpath, filename)
158 if filename.endswith(".efi"):
159diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
160index be57298..354ca4a 100644
161--- a/lib/lp/archivepublisher/tests/test_publisher.py
162+++ b/lib/lp/archivepublisher/tests/test_publisher.py
163@@ -2710,7 +2710,7 @@ class TestPublisher(TestPublisherBase):
164 self.assertTrue(
165 os.path.exists(os.path.join(self.config.distsroot, expected))
166 )
167- for pocket, suffix in pocketsuffix.items():
168+ for suffix in pocketsuffix.values():
169 path = os.path.join(self.config.distsroot, "devel%s" % suffix)
170 expected_path = os.path.join(
171 self.config.distsroot, expected + suffix
172diff --git a/lib/lp/archivepublisher/tests/test_publisherconfig.py b/lib/lp/archivepublisher/tests/test_publisherconfig.py
173index e883dab..960f4eb 100644
174--- a/lib/lp/archivepublisher/tests/test_publisherconfig.py
175+++ b/lib/lp/archivepublisher/tests/test_publisherconfig.py
176@@ -55,7 +55,7 @@ class TestPublisherConfig(TestCaseWithFactory):
177 # Only one config for each distro is allowed.
178
179 def make_conflicting_configs():
180- for counter in range(2):
181+ for _ in range(2):
182 self.factory.makePublisherConfig(self.distribution)
183 IStore(PublisherConfig).flush()
184
185diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
186index 26f6500..11259d7 100644
187--- a/lib/lp/archivepublisher/tests/test_signing.py
188+++ b/lib/lp/archivepublisher/tests/test_signing.py
189@@ -71,7 +71,7 @@ class SignedMatches(Matcher):
190
191 def match(self, base):
192 content = []
193- for root, dirs, files in os.walk(base):
194+ for root, _, files in os.walk(base):
195 content.extend(
196 [os.path.relpath(os.path.join(root, f), base) for f in files]
197 )
198diff --git a/lib/lp/archivepublisher/tests/test_sync_signingkeys.py b/lib/lp/archivepublisher/tests/test_sync_signingkeys.py
199index 7e8a1bb..e31d8bd 100644
200--- a/lib/lp/archivepublisher/tests/test_sync_signingkeys.py
201+++ b/lib/lp/archivepublisher/tests/test_sync_signingkeys.py
202@@ -87,7 +87,7 @@ class TestSyncSigningKeysScript(TestCaseWithFactory):
203 return script
204
205 def makeArchives(self):
206- for i in range(10):
207+ for _ in range(10):
208 self.factory.makeArchive()
209 conditions = PublisherConfig.distribution_id == Archive.distribution_id
210 return IStore(Archive).find(Archive, conditions).order_by(Archive.id)
211diff --git a/lib/lp/archiveuploader/ocirecipeupload.py b/lib/lp/archiveuploader/ocirecipeupload.py
212index 6d692f9..b25d5a9 100644
213--- a/lib/lp/archiveuploader/ocirecipeupload.py
214+++ b/lib/lp/archiveuploader/ocirecipeupload.py
215@@ -51,7 +51,7 @@ class OCIRecipeUpload:
216
217 # Foreach id in digest file, find matching layer
218 for single_digest in digests:
219- for diff_id, data in single_digest.items():
220+ for data in single_digest.values():
221 digest = data["digest"]
222 layer_id = data["layer_id"]
223 layer_path = os.path.join(
224diff --git a/lib/lp/archiveuploader/uploadprocessor.py b/lib/lp/archiveuploader/uploadprocessor.py
225index 9093bdc..7cda7bc 100644
226--- a/lib/lp/archiveuploader/uploadprocessor.py
227+++ b/lib/lp/archiveuploader/uploadprocessor.py
228@@ -295,7 +295,7 @@ class UploadHandler:
229 """
230 changes_files = []
231
232- for dirpath, dirnames, filenames in os.walk(self.upload_path):
233+ for dirpath, _, filenames in os.walk(self.upload_path):
234 relative_path = dirpath[len(self.upload_path) + 1 :]
235 for filename in filenames:
236 if filename.endswith(".changes"):
237diff --git a/lib/lp/blueprints/browser/tests/test_sprint.py b/lib/lp/blueprints/browser/tests/test_sprint.py
238index dadc252..14723d3 100644
239--- a/lib/lp/blueprints/browser/tests/test_sprint.py
240+++ b/lib/lp/blueprints/browser/tests/test_sprint.py
241@@ -27,7 +27,7 @@ class TestSprintIndex(BrowserTestCase):
242 def test_query_count(self):
243 sprint = self.factory.makeSprint()
244 with person_logged_in(sprint.owner):
245- for x in range(30):
246+ for _ in range(30):
247 sprint.attend(
248 self.factory.makePerson(),
249 sprint.time_starts,
250@@ -39,7 +39,7 @@ class TestSprintIndex(BrowserTestCase):
251 def test_blueprint_listing_query_count(self):
252 """Set a maximum number of queries for sprint blueprint lists."""
253 sprint = self.factory.makeSprint()
254- for count in range(10):
255+ for _ in range(10):
256 blueprint = self.factory.makeSpecification()
257 link = blueprint.linkSprint(sprint, blueprint.owner)
258 link.acceptBy(sprint.owner)
259@@ -50,7 +50,7 @@ class TestSprintIndex(BrowserTestCase):
260 def test_proprietary_blueprint_listing_query_count(self):
261 """Set a maximum number of queries for sprint blueprint lists."""
262 sprint = self.factory.makeSprint()
263- for count in range(10):
264+ for _ in range(10):
265 blueprint = self.factory.makeSpecification(
266 information_type=InformationType.PROPRIETARY
267 )
268diff --git a/lib/lp/blueprints/model/tests/test_sprint.py b/lib/lp/blueprints/model/tests/test_sprint.py
269index 5c5ba93..74b44a9 100644
270--- a/lib/lp/blueprints/model/tests/test_sprint.py
271+++ b/lib/lp/blueprints/model/tests/test_sprint.py
272@@ -73,7 +73,7 @@ class TestSpecifications(TestCaseWithFactory):
273 def test_specifications_quantity(self):
274 # Ensure the quantity controls the maximum number of entries.
275 sprint = self.factory.makeSprint()
276- for count in range(10):
277+ for _ in range(10):
278 self.makeSpec(sprint)
279 self.assertEqual(10, sprint.specifications(None).count())
280 result = sprint.specifications(None, quantity=None).count()
281diff --git a/lib/lp/blueprints/tests/test_specification.py b/lib/lp/blueprints/tests/test_specification.py
282index 728bcf5..c0ff34a 100644
283--- a/lib/lp/blueprints/tests/test_specification.py
284+++ b/lib/lp/blueprints/tests/test_specification.py
285@@ -808,7 +808,7 @@ class TestSpecifications(TestCaseWithFactory):
286 # Ensure the quantity controls the maximum number of entries.
287 context = getUtility(ISpecificationSet)
288 product = self.factory.makeProduct()
289- for count in range(10):
290+ for _ in range(10):
291 self.factory.makeSpecification(product=product)
292 self.assertEqual(20, context.specifications(None).count())
293 result = context.specifications(None, quantity=None).count()
294diff --git a/lib/lp/bugs/browser/bugcomment.py b/lib/lp/bugs/browser/bugcomment.py
295index 0f653f6..9306de5 100644
296--- a/lib/lp/bugs/browser/bugcomment.py
297+++ b/lib/lp/bugs/browser/bugcomment.py
298@@ -191,7 +191,7 @@ def group_comments_with_activity(comments, activities):
299
300 event_windows = gen_event_windows(events)
301 event_windows_grouper = groupby(event_windows, itemgetter(0))
302- for window_index, window_group in event_windows_grouper:
303+ for _, window_group in event_windows_grouper:
304 window_group = [(kind, event) for (index, kind, event) in window_group]
305 for kind, event in window_group:
306 if kind is comment_kind:
307diff --git a/lib/lp/bugs/browser/bugsubscription.py b/lib/lp/bugs/browser/bugsubscription.py
308index eaf3ea6..4514f80 100644
309--- a/lib/lp/bugs/browser/bugsubscription.py
310+++ b/lib/lp/bugs/browser/bugsubscription.py
311@@ -591,7 +591,7 @@ class BugPortletSubscribersWithDetails(LaunchpadView):
312 """
313 data = []
314 details = list(bug.getDirectSubscribersWithDetails())
315- for person, subscribed_by, subscription in details:
316+ for person, _subscribed_by, subscription in details:
317 can_edit = subscription.canBeUnsubscribedByUser(self.user)
318 if person == self.user:
319 # Skip the current user viewing the page.
320diff --git a/lib/lp/bugs/browser/tests/test_bug_views.py b/lib/lp/bugs/browser/tests/test_bug_views.py
321index b4373ae..8cf8bb6 100644
322--- a/lib/lp/bugs/browser/tests/test_bug_views.py
323+++ b/lib/lp/bugs/browser/tests/test_bug_views.py
324@@ -380,7 +380,7 @@ class TestBugPortletSubscribers(TestCaseWithFactory):
325 # number of duplicate bugs.
326 user = self.factory.makePerson()
327 bug = self.factory.makeBug()
328- for n in range(20):
329+ for _ in range(20):
330 dupe = self.factory.makeBug()
331 removeSecurityProxy(dupe)._markAsDuplicate(bug, set())
332 removeSecurityProxy(dupe).subscribe(user, dupe.owner)
333@@ -963,7 +963,7 @@ class TestBugActivityView(TestCaseWithFactory):
334 ten_minutes_ago = datetime.now(timezone.utc) - timedelta(minutes=10)
335 with person_logged_in(bug.owner):
336 attachment = self.factory.makeBugAttachment(bug=bug)
337- for i in range(10):
338+ for _ in range(10):
339 bug.addChange(
340 BugAttachmentChange(
341 ten_minutes_ago,
342diff --git a/lib/lp/bugs/browser/tests/test_bugnomination.py b/lib/lp/bugs/browser/tests/test_bugnomination.py
343index b3b2eb6..0575f4f 100644
344--- a/lib/lp/bugs/browser/tests/test_bugnomination.py
345+++ b/lib/lp/bugs/browser/tests/test_bugnomination.py
346@@ -105,7 +105,7 @@ class TestBugNominationView(TestCaseWithFactory):
347 )
348 # Ensure we have some older series so test data better reflects
349 # actual usage.
350- for index in range(3):
351+ for _ in range(3):
352 self.factory.makeDistroSeries(distribution=distro)
353 bug = self.factory.makeBug(target=distro, series=current_series)
354 series_bugtask = bug.bugtasks[1]
355@@ -125,7 +125,7 @@ class TestBugNominationView(TestCaseWithFactory):
356 )
357 # Ensure we have some older series so test data better reflects
358 # actual usage.
359- for index in range(3):
360+ for _ in range(3):
361 self.factory.makeDistroSeries(distribution=distro)
362 package = self.factory.makeDistributionSourcePackage(
363 distribution=distro
364@@ -146,7 +146,7 @@ class TestBugNominationView(TestCaseWithFactory):
365 current_series = self.factory.makeProductSeries(product=product)
366 # Ensure we have some older series so test data better reflects
367 # actual usage.
368- for index in range(3):
369+ for _ in range(3):
370 self.factory.makeProductSeries(product=product)
371 bug = self.factory.makeBug(target=product, series=current_series)
372 series_bugtask = bug.bugtasks[1]
373@@ -190,7 +190,7 @@ class TestBugEditLinks(TestCaseWithFactory):
374 def _createBug(self, bug_task_number=1):
375 series = self.factory.makeProductSeries()
376 bug = self.factory.makeBug(series=series)
377- for i in range(bug_task_number):
378+ for _ in range(bug_task_number):
379 self.factory.makeBugTask(bug=bug)
380 launchbag = getUtility(ILaunchBag)
381 launchbag.add(series.product)
382diff --git a/lib/lp/bugs/browser/tests/test_bugtarget_tags.py b/lib/lp/bugs/browser/tests/test_bugtarget_tags.py
383index 44a15ab..7bcd307 100644
384--- a/lib/lp/bugs/browser/tests/test_bugtarget_tags.py
385+++ b/lib/lp/bugs/browser/tests/test_bugtarget_tags.py
386@@ -67,9 +67,9 @@ class TestBugTargetTags(WithScenarios, TestCaseWithFactory):
387 def test_tags_order(self):
388 """Test that the tags are ordered by most used first"""
389 self.factory.makeBug(target=self.bug_target, tags=["tag-last"])
390- for counter in range(0, 2):
391+ for _ in range(0, 2):
392 self.factory.makeBug(target=self.bug_target, tags=["tag-middle"])
393- for counter in range(0, 3):
394+ for _ in range(0, 3):
395 self.factory.makeBug(target=self.bug_target, tags=["tag-first"])
396 view = create_view(
397 self.view_context, name="+bugtarget-portlet-tags-content"
398diff --git a/lib/lp/bugs/browser/tests/test_bugtask.py b/lib/lp/bugs/browser/tests/test_bugtask.py
399index af11290..cfa6b9b 100644
400--- a/lib/lp/bugs/browser/tests/test_bugtask.py
401+++ b/lib/lp/bugs/browser/tests/test_bugtask.py
402@@ -638,7 +638,7 @@ class TestBugTasksTableView(TestCaseWithFactory):
403 self.view = BugTasksNominationsView(self.bug, LaunchpadTestRequest())
404
405 def test_not_many_bugtasks(self):
406- for count in range(10 - len(self.bug.bugtasks) - 1):
407+ for _ in range(10 - len(self.bug.bugtasks) - 1):
408 self.factory.makeBugTask(bug=self.bug)
409 self.view.initialize()
410 self.assertFalse(self.view.many_bugtasks)
411@@ -648,7 +648,7 @@ class TestBugTasksTableView(TestCaseWithFactory):
412 self.assertFalse(row_view.many_bugtasks)
413
414 def test_many_bugtasks(self):
415- for count in range(10 - len(self.bug.bugtasks)):
416+ for _ in range(10 - len(self.bug.bugtasks)):
417 self.factory.makeBugTask(bug=self.bug)
418 self.view.initialize()
419 self.assertTrue(self.view.many_bugtasks)
420@@ -2349,7 +2349,7 @@ class TestBugTaskBatchedCommentsAndActivityView(TestCaseWithFactory):
421 bug = self.factory.makeBug()
422 with person_logged_in(bug.owner):
423 if not comments_only:
424- for i in range(number_of_changes):
425+ for _ in range(number_of_changes):
426 change = BugTaskStatusChange(
427 bug.default_bugtask,
428 UTC_NOW,
429diff --git a/lib/lp/bugs/browser/tests/test_expose.py b/lib/lp/bugs/browser/tests/test_expose.py
430index c846754..36c13f1 100644
431--- a/lib/lp/bugs/browser/tests/test_expose.py
432+++ b/lib/lp/bugs/browser/tests/test_expose.py
433@@ -178,7 +178,7 @@ class TestExposeAdministeredTeams(TestCaseWithFactory):
434
435 # Create some new public teams owned by the user, and a private
436 # team administered by the user.
437- for i in range(3):
438+ for _ in range(3):
439 self.factory.makeTeam(owner=self.user)
440 pt = self.factory.makeTeam(
441 visibility=PersonVisibility.PRIVATE, members=[self.user]
442diff --git a/lib/lp/bugs/model/bugnotification.py b/lib/lp/bugs/model/bugnotification.py
443index 1eb6fcc..5168c1c 100644
444--- a/lib/lp/bugs/model/bugnotification.py
445+++ b/lib/lp/bugs/model/bugnotification.py
446@@ -146,7 +146,7 @@ class BugNotificationSet:
447 pending_notifications = []
448 people_ids = set()
449 bug_ids = set()
450- for notification, ignore, ignore in results:
451+ for notification, _, _ in results:
452 if notification.message.datecreated > time_limit:
453 last_omitted_notification = notification
454 elif (
455diff --git a/lib/lp/bugs/model/tests/test_bug.py b/lib/lp/bugs/model/tests/test_bug.py
456index 86c291c..103cf98 100644
457--- a/lib/lp/bugs/model/tests/test_bug.py
458+++ b/lib/lp/bugs/model/tests/test_bug.py
459@@ -191,7 +191,7 @@ class TestBug(TestCaseWithFactory):
460 def test_get_direct_subscribers_query_count(self):
461 bug = self.factory.makeBug()
462 # Make lots of subscribers.
463- for i in range(10):
464+ for _ in range(10):
465 subscriber = self.factory.makePerson()
466 with person_logged_in(subscriber):
467 bug.subscribe(subscriber, subscriber)
468@@ -205,10 +205,10 @@ class TestBug(TestCaseWithFactory):
469 bug = self.factory.makeBug()
470 # Make lots of duplicate bugs.
471 previous_dup = None
472- for i in range(10):
473+ for _ in range(10):
474 dup = self.factory.makeBug()
475 # Make lots of subscribers.
476- for j in range(10):
477+ for _ in range(10):
478 subscriber = self.factory.makePerson()
479 with person_logged_in(subscriber):
480 dup.subscribe(subscriber, subscriber)
481@@ -236,7 +236,7 @@ class TestBug(TestCaseWithFactory):
482 return self._get_notifications(BugNotificationStatus.DEFERRED)
483
484 def _add_subscribers(self, bug, number):
485- for i in range(number):
486+ for _ in range(number):
487 subscriber = self.factory.makePerson()
488 with person_logged_in(subscriber):
489 bug.subscribe(subscriber, subscriber)
490diff --git a/lib/lp/bugs/model/tests/test_bugsummary.py b/lib/lp/bugs/model/tests/test_bugsummary.py
491index cfa52d1..de50b73 100644
492--- a/lib/lp/bugs/model/tests/test_bugsummary.py
493+++ b/lib/lp/bugs/model/tests/test_bugsummary.py
494@@ -66,7 +66,7 @@ class TestBugSummary(TestCaseWithFactory):
495
496 product = self.factory.makeProduct()
497
498- for count in range(3):
499+ for _ in range(3):
500 bug = self.factory.makeBug(target=product)
501 bug_tag = BugTag(bug=bug, tag=tag)
502 self.store.add(bug_tag)
503@@ -87,7 +87,7 @@ class TestBugSummary(TestCaseWithFactory):
504
505 product = self.factory.makeProduct()
506
507- for count in range(3):
508+ for _ in range(3):
509 bug = self.factory.makeBug(target=product)
510 bug_tag = BugTag(bug=bug, tag=old_tag)
511 self.store.add(bug_tag)
512@@ -114,7 +114,7 @@ class TestBugSummary(TestCaseWithFactory):
513
514 product = self.factory.makeProduct()
515
516- for count in range(3):
517+ for _ in range(3):
518 bug = self.factory.makeBug(target=product)
519 bug_tag = BugTag(bug=bug, tag=tag)
520 self.store.add(bug_tag)
521diff --git a/lib/lp/bugs/model/tests/test_bugtask.py b/lib/lp/bugs/model/tests/test_bugtask.py
522index cca4282..0df9c0b 100644
523--- a/lib/lp/bugs/model/tests/test_bugtask.py
524+++ b/lib/lp/bugs/model/tests/test_bugtask.py
525@@ -1884,7 +1884,7 @@ class TestStatusCountsForProductSeries(TestCaseWithFactory):
526 for status in statuses:
527 self.factory.makeBug(milestone=self.milestone, status=status)
528 self.factory.makeBug(series=self.series, status=status)
529- for i in range(3):
530+ for _ in range(3):
531 self.factory.makeBug(series=self.series)
532 expected = {
533 BugTaskStatus.INVALID: 2,
534diff --git a/lib/lp/bugs/scripts/bugnotification.py b/lib/lp/bugs/scripts/bugnotification.py
535index b7557b3..cac4f2d 100644
536--- a/lib/lp/bugs/scripts/bugnotification.py
537+++ b/lib/lp/bugs/scripts/bugnotification.py
538@@ -300,7 +300,7 @@ def get_bug_and_owner(notification):
539 def notification_batches(notifications):
540 """Batch notifications for `get_email_notifications`."""
541 notifications_grouped = groupby(notifications, get_bug_and_owner)
542- for (bug, person), notification_group in notifications_grouped:
543+ for _, notification_group in notifications_grouped:
544 batches = notification_comment_batches(notification_group)
545 for comment_group, batch in groupby(batches, itemgetter(0)):
546 yield [notification for (comment_group, notification) in batch]
547diff --git a/lib/lp/bugs/scripts/checkwatches/tests/test_scheduler.py b/lib/lp/bugs/scripts/checkwatches/tests/test_scheduler.py
548index e2b256d..8f79761 100644
549--- a/lib/lp/bugs/scripts/checkwatches/tests/test_scheduler.py
550+++ b/lib/lp/bugs/scripts/checkwatches/tests/test_scheduler.py
551@@ -81,7 +81,7 @@ class TestBugWatchScheduler(TestCaseWithFactory):
552 # The scheduler only looks at the last 5 activity items, so even
553 # if there have been more failures the maximum delay will be 7
554 # days.
555- for count in range(10):
556+ for _ in range(10):
557 self.bug_watch.addActivity(
558 result=BugWatchActivityStatus.BUG_NOT_FOUND
559 )
560diff --git a/lib/lp/bugs/scripts/tests/test_bugnotification.py b/lib/lp/bugs/scripts/tests/test_bugnotification.py
561index 99d9197..e6a8cd9 100644
562--- a/lib/lp/bugs/scripts/tests/test_bugnotification.py
563+++ b/lib/lp/bugs/scripts/tests/test_bugnotification.py
564@@ -316,7 +316,7 @@ class TestGetEmailNotifications(TestCase):
565 email_notifications = get_email_notifications(notifications_to_send)
566 to_addresses = set()
567 sent_notifications = []
568- for notifications, omitted, messages in email_notifications:
569+ for notifications, _, messages in email_notifications:
570 for message in messages:
571 to_addresses.add(message["to"])
572 recipients = {}
573@@ -715,11 +715,7 @@ class EmailNotificationTestBase(TestCaseWithFactory):
574 def get_messages(self):
575 notifications = self.notification_set.getNotificationsToSend()
576 email_notifications = get_email_notifications(notifications)
577- for (
578- bug_notifications,
579- omitted_notifications,
580- messages,
581- ) in email_notifications:
582+ for _, _, messages in email_notifications:
583 for message in messages:
584 yield message, message.get_payload(decode=True)
585
586@@ -1408,7 +1404,7 @@ class TestDeferredNotifications(TestCaseWithFactory):
587 # Create some deferred notifications and show that processing them
588 # puts then in the state where they are ready to send.
589 num = 5
590- for i in range(num):
591+ for _ in range(num):
592 self._make_deferred_notification()
593 deferred = self.notification_set.getDeferredNotifications()
594 self.assertEqual(num, deferred.count())
595@@ -1451,7 +1447,7 @@ class TestSendBugNotifications(TestCaseWithFactory):
596 # in the way of sending other notifications.
597 set_immediate_mail_delivery(False)
598 subscribers = []
599- for i in range(3):
600+ for _ in range(3):
601 bug = self.factory.makeBug()
602 subscriber = self.factory.makePerson()
603 subscribers.append(subscriber.preferredemail.email)
604@@ -1487,7 +1483,7 @@ class TestSendBugNotifications(TestCaseWithFactory):
605 "SMTPException: test requested delivery failure",
606 self.oopses[0]["tb_text"],
607 )
608- for i, (bug_notifications, _, messages) in enumerate(notifications):
609+ for i, (bug_notifications, _, _) in enumerate(notifications):
610 for bug_notification in bug_notifications:
611 if i == 1:
612 self.assertEqual(
613diff --git a/lib/lp/bugs/tests/bug.py b/lib/lp/bugs/tests/bug.py
614index e8e07cf..9798b9b 100644
615--- a/lib/lp/bugs/tests/bug.py
616+++ b/lib/lp/bugs/tests/bug.py
617@@ -93,7 +93,7 @@ def print_remote_bugtasks(content):
618 """
619 affects_table = find_tags_by_class(content, "listing")[0]
620 for span in affects_table.find_all("span"):
621- for key, value in span.attrs.items():
622+ for value in span.attrs.values():
623 if "bug-remote" in value:
624 target = extract_text(span.find_all_previous("td")[-2])
625 print(target, extract_text(span.find_next("a")))
626diff --git a/lib/lp/bugs/tests/externalbugtracker.py b/lib/lp/bugs/tests/externalbugtracker.py
627index e0e84db..7e24caa 100644
628--- a/lib/lp/bugs/tests/externalbugtracker.py
629+++ b/lib/lp/bugs/tests/externalbugtracker.py
630@@ -1069,8 +1069,8 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
631 if arguments.get("comment_ids") is not None:
632 # We need to return all the comments listed.
633 comments_to_return = {}
634- for bug_id, comments in self.bug_comments.items():
635- for comment_number, comment in comments.items():
636+ for comments in self.bug_comments.values():
637+ for comment in comments.values():
638 if comment["id"] in arguments["comment_ids"]:
639 comments_to_return[comment["id"]] = self._copy_comment(
640 comment, fields_to_return
641diff --git a/lib/lp/bugs/tests/test_bug_messages_webservice.py b/lib/lp/bugs/tests/test_bug_messages_webservice.py
642index 0e220ed..6282c46 100644
643--- a/lib/lp/bugs/tests/test_bug_messages_webservice.py
644+++ b/lib/lp/bugs/tests/test_bug_messages_webservice.py
645@@ -37,7 +37,7 @@ class TestMessageTraversal(TestCaseWithFactory):
646 # Traversal over bug messages attachments has no errors.
647 expected_messages = []
648 with person_logged_in(bug.owner):
649- for i in range(3):
650+ for _ in range(3):
651 att = self.factory.makeBugAttachment(bug)
652 expected_messages.append(att.message.subject)
653 bug_url = api_url(bug)
654diff --git a/lib/lp/bugs/tests/test_bugnotification.py b/lib/lp/bugs/tests/test_bugnotification.py
655index eecc427..8413027 100644
656--- a/lib/lp/bugs/tests/test_bugnotification.py
657+++ b/lib/lp/bugs/tests/test_bugnotification.py
658@@ -589,7 +589,7 @@ class TestGetDeferredNotifications(TestCaseWithFactory):
659
660 def test_many_deferred_notification(self):
661 num = 5
662- for i in range(num):
663+ for _ in range(num):
664 self._make_deferred_notification()
665 results = self.bns.getDeferredNotifications()
666 self.assertEqual(num, results.count())
667diff --git a/lib/lp/bugs/tests/test_bugs_webservice.py b/lib/lp/bugs/tests/test_bugs_webservice.py
668index 6851520..9206787 100644
669--- a/lib/lp/bugs/tests/test_bugs_webservice.py
670+++ b/lib/lp/bugs/tests/test_bugs_webservice.py
671@@ -215,7 +215,7 @@ class TestBugScaling(TestCaseWithFactory):
672 with_2_count = collector.count
673 self.assertEqual(response.status, 200)
674 login(USER_EMAIL)
675- for i in range(5):
676+ for _ in range(5):
677 self.factory.makeBugAttachment(self.bug)
678 logout()
679 # Second request.
680@@ -252,7 +252,7 @@ class TestBugScaling(TestCaseWithFactory):
681 with_2_count = collector.count
682 self.assertEqual(response.status, 200)
683 login(USER_EMAIL)
684- for i in range(50):
685+ for _ in range(50):
686 self.factory.makeBugComment(bug)
687 self.factory.makeBugAttachment(bug)
688 logout()
689@@ -341,7 +341,7 @@ class TestPostBugWithLargeCollections(TestCaseWithFactory):
690 )
691 try:
692 login(ADMIN_EMAIL)
693- for count in range(snapshot.HARD_LIMIT_FOR_SNAPSHOT + 1):
694+ for _ in range(snapshot.HARD_LIMIT_FOR_SNAPSHOT + 1):
695 person = self.factory.makePerson()
696 bug.subscribe(person, person)
697 logout()
698diff --git a/lib/lp/bugs/tests/test_bugsearch_conjoined.py b/lib/lp/bugs/tests/test_bugsearch_conjoined.py
699index f1c5be1..cdb2f82 100644
700--- a/lib/lp/bugs/tests/test_bugsearch_conjoined.py
701+++ b/lib/lp/bugs/tests/test_bugsearch_conjoined.py
702@@ -152,7 +152,7 @@ class TestProjectGroupExcludeConjoinedPrimarySearch(TestSearchBase):
703 self.projectgroup = self.factory.makeProject()
704 self.bug_count = 2
705 self.bug_products = {}
706- for i in range(self.bug_count):
707+ for _ in range(self.bug_count):
708 product = self.factory.makeProduct(projectgroup=self.projectgroup)
709 product_milestone = self.factory.makeMilestone(
710 product=product, name="foo"
711@@ -219,7 +219,7 @@ class TestProjectGroupExcludeConjoinedPrimarySearch(TestSearchBase):
712 # group doesn't cause a bugtask on another project in the group
713 # to be excluded from the project group milestone's bugs.
714 extra_bugtasks = 0
715- for bug, product in self.bug_products.items():
716+ for bug in self.bug_products:
717 extra_bugtasks += 1
718 other_product = self.factory.makeProduct(
719 projectgroup=self.projectgroup
720diff --git a/lib/lp/bugs/tests/test_bugsubscription.py b/lib/lp/bugs/tests/test_bugsubscription.py
721index 9f66aef..f456c3e 100644
722--- a/lib/lp/bugs/tests/test_bugsubscription.py
723+++ b/lib/lp/bugs/tests/test_bugsubscription.py
724@@ -127,7 +127,7 @@ class TestBugSubscription(TestCaseWithFactory):
725 )
726 self.bug.subscribe(team, team.teamowner)
727 with person_logged_in(team_2.teamowner):
728- for i in range(25):
729+ for _ in range(25):
730 person = self.factory.makePerson()
731 team_2.addMember(
732 person, team_2.teamowner, status=TeamMembershipStatus.ADMIN
733diff --git a/lib/lp/bugs/tests/test_bugtracker.py b/lib/lp/bugs/tests/test_bugtracker.py
734index bcc3d1a..bdcc299 100644
735--- a/lib/lp/bugs/tests/test_bugtracker.py
736+++ b/lib/lp/bugs/tests/test_bugtracker.py
737@@ -90,7 +90,7 @@ class BugTrackerTestCase(TestCaseWithFactory):
738 def setUp(self):
739 super().setUp()
740 self.bug_tracker = self.factory.makeBugTracker()
741- for i in range(5):
742+ for _ in range(5):
743 self.factory.makeBugWatch(bugtracker=self.bug_tracker)
744
745 store = Store.of(self.bug_tracker)
746diff --git a/lib/lp/bugs/tests/test_bugwatch.py b/lib/lp/bugs/tests/test_bugwatch.py
747index a684b0f..d9779d1 100644
748--- a/lib/lp/bugs/tests/test_bugwatch.py
749+++ b/lib/lp/bugs/tests/test_bugwatch.py
750@@ -689,7 +689,7 @@ class TestBugWatchActivityPruner(TestCaseWithFactory):
751 def setUp(self):
752 super().setUp("foo.bar@canonical.com")
753 self.bug_watch = self.factory.makeBugWatch()
754- for i in range(MAX_SAMPLE_SIZE + 1):
755+ for _ in range(MAX_SAMPLE_SIZE + 1):
756 self.bug_watch.addActivity()
757 transaction.commit()
758
759diff --git a/lib/lp/bugs/tests/test_cve.py b/lib/lp/bugs/tests/test_cve.py
760index e444ead..62c0de2 100644
761--- a/lib/lp/bugs/tests/test_cve.py
762+++ b/lib/lp/bugs/tests/test_cve.py
763@@ -34,7 +34,7 @@ class TestCveSet(TestCaseWithFactory):
764 self.cves = []
765 self.cve_index = 0
766 with person_logged_in(self.distroseries.owner):
767- for count in range(4):
768+ for _ in range(4):
769 task = self.factory.makeBugTask(target=self.distroseries)
770 bug = task.bug
771 self.bugs.append(bug)
772diff --git a/lib/lp/bugs/tests/test_doc.py b/lib/lp/bugs/tests/test_doc.py
773index 9b68b88..037f922 100644
774--- a/lib/lp/bugs/tests/test_doc.py
775+++ b/lib/lp/bugs/tests/test_doc.py
776@@ -485,7 +485,7 @@ def test_suite():
777 )
778
779 # Add special needs tests
780- for key, special_suite in sorted(special.items()):
781+ for _, special_suite in sorted(special.items()):
782 suite.addTest(special_suite)
783
784 # Add tests using default setup/teardown
785diff --git a/lib/lp/buildmaster/browser/tests/test_builder_views.py b/lib/lp/buildmaster/browser/tests/test_builder_views.py
786index 98446e2..331275e 100644
787--- a/lib/lp/buildmaster/browser/tests/test_builder_views.py
788+++ b/lib/lp/buildmaster/browser/tests/test_builder_views.py
789@@ -51,7 +51,7 @@ class TestgetSpecificJobs(TestCaseWithFactory):
790
791 def createBuilds(self):
792 builds = []
793- for i in range(2):
794+ for _ in range(2):
795 builds.append(self.createBinaryPackageBuild())
796 builds.append(self.createTranslationTemplateBuild())
797 builds.append(self.createSourcePackageRecipeBuild())
798diff --git a/lib/lp/buildmaster/tests/test_webservice.py b/lib/lp/buildmaster/tests/test_webservice.py
799index a7ec442..9766b65 100644
800--- a/lib/lp/buildmaster/tests/test_webservice.py
801+++ b/lib/lp/buildmaster/tests/test_webservice.py
802@@ -33,7 +33,7 @@ class TestBuildersCollection(TestCaseWithFactory):
803
804 def test_list(self):
805 names = ["bob", "frog"]
806- for i in range(3):
807+ for _ in range(3):
808 builder = self.factory.makeBuilder()
809 self.factory.makeBinaryPackageBuild().queueBuild().markAsBuilding(
810 builder
811diff --git a/lib/lp/charms/tests/test_charmbase.py b/lib/lp/charms/tests/test_charmbase.py
812index d392e33..897d5c4 100644
813--- a/lib/lp/charms/tests/test_charmbase.py
814+++ b/lib/lp/charms/tests/test_charmbase.py
815@@ -357,7 +357,7 @@ class TestCharmBaseWebservice(TestCaseWithFactory):
816 webservice.default_api_version = "devel"
817 distroseries_urls = []
818 with celebrity_logged_in("registry_experts"):
819- for i in range(3):
820+ for _ in range(3):
821 distroseries = self.factory.makeDistroSeries()
822 distroseries_urls.append(
823 webservice.getAbsoluteUrl(api_url(distroseries))
824diff --git a/lib/lp/charms/tests/test_charmrecipe.py b/lib/lp/charms/tests/test_charmrecipe.py
825index f646124..b4922dc 100644
826--- a/lib/lp/charms/tests/test_charmrecipe.py
827+++ b/lib/lp/charms/tests/test_charmrecipe.py
828@@ -1417,7 +1417,7 @@ class TestCharmRecipeSet(TestCaseWithFactory):
829 owners = [self.factory.makePerson() for i in range(2)]
830 recipes = []
831 for owner in owners:
832- for i in range(2):
833+ for _ in range(2):
834 recipes.append(
835 self.factory.makeCharmRecipe(registrant=owner, owner=owner)
836 )
837@@ -1470,7 +1470,7 @@ class TestCharmRecipeSet(TestCaseWithFactory):
838 repositories = [self.factory.makeGitRepository() for i in range(2)]
839 recipes = []
840 for repository in repositories:
841- for i in range(2):
842+ for _ in range(2):
843 [ref] = self.factory.makeGitRefs(repository=repository)
844 recipes.append(self.factory.makeCharmRecipe(git_ref=ref))
845 recipe_set = getUtility(ICharmRecipeSet)
846@@ -1487,7 +1487,7 @@ class TestCharmRecipeSet(TestCaseWithFactory):
847 repositories = [self.factory.makeGitRepository() for i in range(2)]
848 recipes = []
849 for repository in repositories:
850- for i in range(3):
851+ for _ in range(3):
852 [ref] = self.factory.makeGitRefs(repository=repository)
853 recipes.append(self.factory.makeCharmRecipe(git_ref=ref))
854 recipe_set = getUtility(ICharmRecipeSet)
855@@ -1514,7 +1514,7 @@ class TestCharmRecipeSet(TestCaseWithFactory):
856 repositories = [self.factory.makeGitRepository() for i in range(2)]
857 refs = []
858 recipes = []
859- for repository in repositories:
860+ for _ in repositories:
861 refs.extend(
862 self.factory.makeGitRefs(
863 paths=["refs/heads/master", "refs/heads/other"]
864@@ -1796,7 +1796,7 @@ class TestCharmRecipeSet(TestCaseWithFactory):
865 paths = []
866 refs = []
867 for repository in repositories:
868- for i in range(2):
869+ for _ in range(2):
870 [ref] = self.factory.makeGitRefs(repository=repository)
871 paths.append(ref.path)
872 refs.append(ref)
873diff --git a/lib/lp/charms/tests/test_charmrecipebuild.py b/lib/lp/charms/tests/test_charmrecipebuild.py
874index c5903fa..8d13837 100644
875--- a/lib/lp/charms/tests/test_charmrecipebuild.py
876+++ b/lib/lp/charms/tests/test_charmrecipebuild.py
877@@ -240,7 +240,7 @@ class TestCharmRecipeBuild(TestCaseWithFactory):
878 status=BuildStatus.FULLYBUILT,
879 duration=timedelta(seconds=335),
880 )
881- for i in range(3):
882+ for _ in range(3):
883 self.factory.makeCharmRecipeBuild(
884 requester=self.build.requester,
885 recipe=self.build.recipe,
886diff --git a/lib/lp/code/browser/branchlisting.py b/lib/lp/code/browser/branchlisting.py
887index f4b5533..721417c 100644
888--- a/lib/lp/code/browser/branchlisting.py
889+++ b/lib/lp/code/browser/branchlisting.py
890@@ -1469,7 +1469,7 @@ class GroupedDistributionSourcePackageBranchesView(
891 and merge proposal links for badges.
892 """
893 visible_branches = []
894- for branches, count in self.series_branches_map.values():
895+ for branches, _count in self.series_branches_map.values():
896 visible_branches.extend(branches)
897 return visible_branches
898
899diff --git a/lib/lp/code/browser/gitrepository.py b/lib/lp/code/browser/gitrepository.py
900index b413c58..359ed2c 100644
901--- a/lib/lp/code/browser/gitrepository.py
902+++ b/lib/lp/code/browser/gitrepository.py
903@@ -205,7 +205,7 @@ class GitRepositoryNavigation(WebhookTargetNavigationMixin, Navigation):
904 ref_segments.append(segments.pop())
905 ref = self.context.getRefByPath("/".join(ref_segments))
906 if ref is not None:
907- for unused in range(len(ref_segments)):
908+ for _unused in range(len(ref_segments)):
909 self.request.stepstogo.consume()
910 return ref
911 raise NotFoundError
912@@ -1445,7 +1445,7 @@ class GitRepositoryPermissionsView(LaunchpadFormView):
913 key=lambda item: (item[1]["action"] != "add", item[2], item[0])
914 )
915
916- for ref_pattern, parsed_rule, position in ordered_rules:
917+ for ref_pattern, parsed_rule, _position in ordered_rules:
918 rule = rule_map.get(parsed_rule["pattern"])
919 action = parsed_rule["action"]
920 if action not in ("add", "change", "delete"):
921diff --git a/lib/lp/code/browser/tests/test_branch.py b/lib/lp/code/browser/tests/test_branch.py
922index e65fc77..3935dc8 100644
923--- a/lib/lp/code/browser/tests/test_branch.py
924+++ b/lib/lp/code/browser/tests/test_branch.py
925@@ -564,7 +564,7 @@ class TestBranchView(BrowserTestCase):
926 # record linked bug info for use below
927 linked_bug_urls = []
928 linked_bug_text = []
929- for x in range(0, 2):
930+ for _ in range(0, 2):
931 bug = self.factory.makeBug()
932 mp.source_branch.linkBug(bug, branch.owner)
933 linked_bug_urls.append(
934@@ -637,7 +637,7 @@ class TestBranchView(BrowserTestCase):
935 def test_query_count_landing_candidates(self):
936 product = self.factory.makeProduct()
937 branch = self.factory.makeBranch(product=product)
938- for i in range(10):
939+ for _ in range(10):
940 self.factory.makeBranchMergeProposal(target_branch=branch)
941 stacked = self.factory.makeBranch(product=product)
942 source = self.factory.makeBranch(stacked_on=stacked, product=product)
943@@ -657,7 +657,7 @@ class TestBranchView(BrowserTestCase):
944 def test_query_count_landing_targets(self):
945 product = self.factory.makeProduct()
946 branch = self.factory.makeBranch(product=product)
947- for i in range(10):
948+ for _ in range(10):
949 self.factory.makeBranchMergeProposal(source_branch=branch)
950 stacked = self.factory.makeBranch(product=product)
951 target = self.factory.makeBranch(stacked_on=stacked, product=product)
952@@ -676,7 +676,7 @@ class TestBranchView(BrowserTestCase):
953
954 def test_query_count_subscriber_content(self):
955 branch = self.factory.makeBranch()
956- for i in range(10):
957+ for _ in range(10):
958 self.factory.makeBranchSubscription(branch=branch)
959 Store.of(branch).flush()
960 Store.of(branch).invalidate()
961@@ -689,7 +689,7 @@ class TestBranchView(BrowserTestCase):
962
963 def test_query_count_index_with_subscribers(self):
964 branch = self.factory.makeBranch()
965- for i in range(10):
966+ for _ in range(10):
967 self.factory.makeBranchSubscription(branch=branch)
968 Store.of(branch).flush()
969 Store.of(branch).invalidate()
970diff --git a/lib/lp/code/browser/tests/test_branchlisting.py b/lib/lp/code/browser/tests/test_branchlisting.py
971index 68bdcc5..5424760 100644
972--- a/lib/lp/code/browser/tests/test_branchlisting.py
973+++ b/lib/lp/code/browser/tests/test_branchlisting.py
974@@ -517,7 +517,7 @@ class TestGroupedDistributionSourcePackageBranchesView(TestCaseWithFactory):
975 official = []
976 # Sort the pocket items so RELEASE is last, and thus first popped.
977 pockets = sorted(PackagePublishingPocket.items, reverse=True)
978- for i in range(official_count):
979+ for _ in range(official_count):
980 branch = branches.pop()
981 pocket = pockets.pop()
982 SeriesSourcePackageBranchSet.new(
983@@ -790,7 +790,7 @@ class TestProjectGroupBranches(TestCaseWithFactory, AjaxBatchNavigationMixin):
984 # The Javascript to wire up the ajax batch navigation behaviour is
985 # correctly hidden behind a feature flag.
986 product = self.factory.makeProduct(projectgroup=self.projectgroup)
987- for i in range(10):
988+ for _ in range(10):
989 self.factory.makeProductBranch(product=product)
990 self._test_ajax_batch_navigation_feature_flag(
991 product, view_name="+branches"
992diff --git a/lib/lp/code/browser/tests/test_branchmergeproposal.py b/lib/lp/code/browser/tests/test_branchmergeproposal.py
993index 3f5e738..fb29e40 100644
994--- a/lib/lp/code/browser/tests/test_branchmergeproposal.py
995+++ b/lib/lp/code/browser/tests/test_branchmergeproposal.py
996@@ -1727,7 +1727,7 @@ class TestBranchMergeProposalView(TestCaseWithFactory):
997 bmp.requestReview(review_date)
998 revision_date = review_date + timedelta(days=1)
999 revisions = []
1000- for date in range(2):
1001+ for _ in range(2):
1002 revisions.append(
1003 add_revision_to_branch(
1004 self.factory, bmp.source_branch, revision_date
1005diff --git a/lib/lp/code/browser/tests/test_branchmergeproposallisting.py b/lib/lp/code/browser/tests/test_branchmergeproposallisting.py
1006index 6fcc7a2..113f3ba 100644
1007--- a/lib/lp/code/browser/tests/test_branchmergeproposallisting.py
1008+++ b/lib/lp/code/browser/tests/test_branchmergeproposallisting.py
1009@@ -433,7 +433,7 @@ class BranchMergeProposalListingTestMixin:
1010 if not self.supports_bzr:
1011 self.skipTest("Context doesn't support Bazaar branches.")
1012 with admin_logged_in():
1013- for i in range(7):
1014+ for _ in range(7):
1015 self.makeBzrMergeProposal()
1016 flush_database_caches()
1017 with StormStatementRecorder() as recorder:
1018@@ -446,7 +446,7 @@ class BranchMergeProposalListingTestMixin:
1019 if not self.supports_git:
1020 self.skipTest("Context doesn't support Git repositories.")
1021 with admin_logged_in():
1022- for i in range(7):
1023+ for _ in range(7):
1024 self.makeGitMergeProposal()
1025 flush_database_caches()
1026 with StormStatementRecorder() as recorder:
1027@@ -1089,7 +1089,7 @@ class ActiveReviewsPerformanceMixin:
1028 # view and a recorder of the queries generated by this page
1029 # rendering.
1030 product = self.factory.makeProduct()
1031- for i in range(number_of_bmps):
1032+ for _ in range(number_of_bmps):
1033 self.createProductBMP(product=product)
1034 login_person(product.owner)
1035 flush_database_caches()
1036diff --git a/lib/lp/code/browser/tests/test_codereviewcomment.py b/lib/lp/code/browser/tests/test_codereviewcomment.py
1037index 212cfe8..2c6dc81 100644
1038--- a/lib/lp/code/browser/tests/test_codereviewcomment.py
1039+++ b/lib/lp/code/browser/tests/test_codereviewcomment.py
1040@@ -122,7 +122,7 @@ class TestCodeReviewCommentInlineComments(TestCaseWithFactory):
1041 person = self.factory.makePerson()
1042 merge_proposal = self.factory.makeBranchMergeProposal()
1043 with person_logged_in(person):
1044- for i in range(5):
1045+ for _ in range(5):
1046 comment = self.factory.makeCodeReviewComment(
1047 merge_proposal=merge_proposal
1048 )
1049diff --git a/lib/lp/code/browser/tests/test_gitlisting.py b/lib/lp/code/browser/tests/test_gitlisting.py
1050index 1fc40a7..b6b0392 100644
1051--- a/lib/lp/code/browser/tests/test_gitlisting.py
1052+++ b/lib/lp/code/browser/tests/test_gitlisting.py
1053@@ -132,10 +132,10 @@ class TestTargetGitListingView:
1054
1055 def test_query_count(self):
1056 main_repo = self.factory.makeGitRepository(target=self.target)
1057- for i in range(10):
1058+ for _ in range(10):
1059 self.factory.makeGitRefs(main_repo)
1060
1061- for i in range(10):
1062+ for _ in range(10):
1063 other_repo = self.factory.makeGitRepository(target=self.target)
1064 self.factory.makeGitRefs(other_repo)
1065
1066diff --git a/lib/lp/code/browser/tests/test_gitref.py b/lib/lp/code/browser/tests/test_gitref.py
1067index 0c02bac..ed788fe 100644
1068--- a/lib/lp/code/browser/tests/test_gitref.py
1069+++ b/lib/lp/code/browser/tests/test_gitref.py
1070@@ -1267,7 +1267,7 @@ class TestGitRefView(BrowserTestCase):
1071 def test_query_count_landing_candidates(self):
1072 project = self.factory.makeProduct()
1073 [ref] = self.factory.makeGitRefs(target=project)
1074- for i in range(10):
1075+ for _ in range(10):
1076 self.factory.makeBranchMergeProposalForGit(target_ref=ref)
1077 [source] = self.factory.makeGitRefs(target=project)
1078 [prereq] = self.factory.makeGitRefs(target=project)
1079@@ -1284,7 +1284,7 @@ class TestGitRefView(BrowserTestCase):
1080 def test_query_count_landing_targets(self):
1081 project = self.factory.makeProduct()
1082 [ref] = self.factory.makeGitRefs(target=project)
1083- for i in range(10):
1084+ for _ in range(10):
1085 self.factory.makeBranchMergeProposalForGit(source_ref=ref)
1086 [target] = self.factory.makeGitRefs(target=project)
1087 [prereq] = self.factory.makeGitRefs(target=project)
1088diff --git a/lib/lp/code/model/branchjob.py b/lib/lp/code/model/branchjob.py
1089index c08a8c1..e3781f5 100644
1090--- a/lib/lp/code/model/branchjob.py
1091+++ b/lib/lp/code/model/branchjob.py
1092@@ -955,7 +955,7 @@ class RosettaUploadJob(BranchJobDerived):
1093
1094 to_tree.lock_read()
1095 try:
1096- for dir, files in to_tree.walkdirs():
1097+ for _, files in to_tree.walkdirs():
1098 for afile in files:
1099 file_path, file_name, file_type = afile[:3]
1100 if file_type != "file":
1101diff --git a/lib/lp/code/model/branchmergeproposal.py b/lib/lp/code/model/branchmergeproposal.py
1102index 73cae9a..7abdeff 100644
1103--- a/lib/lp/code/model/branchmergeproposal.py
1104+++ b/lib/lp/code/model/branchmergeproposal.py
1105@@ -1514,7 +1514,7 @@ class BranchMergeProposal(StormBase, BugLinkTargetMixin):
1106 entries.extend(self._getNewerRevisions())
1107 entries.sort()
1108 current_group = []
1109- for sortkey, entry in entries:
1110+ for _, entry in entries:
1111 if ICodeReviewComment.providedBy(entry):
1112 if current_group != []:
1113 yield current_group
1114@@ -1743,7 +1743,7 @@ class BranchMergeProposalGetter:
1115 (CodeReviewVoteReference, Person, CodeReviewComment),
1116 CodeReviewVoteReference.branch_merge_proposal_id.is_in(ids),
1117 )
1118- for reference, person, comment in results:
1119+ for reference, _, _ in results:
1120 result[reference.branch_merge_proposal].append(reference)
1121 return result
1122
1123diff --git a/lib/lp/code/model/diff.py b/lib/lp/code/model/diff.py
1124index fd8b8e3..27f9192 100644
1125--- a/lib/lp/code/model/diff.py
1126+++ b/lib/lp/code/model/diff.py
1127@@ -290,7 +290,7 @@ class Diff(StormBase):
1128 else:
1129 added_lines_count = 0
1130 removed_lines_count = 0
1131- for path, (added, removed) in diffstat.items():
1132+ for added, removed in diffstat.values():
1133 added_lines_count += added
1134 removed_lines_count += removed
1135 diff = cls(
1136diff --git a/lib/lp/code/model/tests/test_branch.py b/lib/lp/code/model/tests/test_branch.py
1137index 6ea7f28..9e6cf93 100644
1138--- a/lib/lp/code/model/tests/test_branch.py
1139+++ b/lib/lp/code/model/tests/test_branch.py
1140@@ -2384,7 +2384,7 @@ class TestCreateBranchRevisionFromIDs(TestCaseWithFactory):
1141 branch = self.factory.makeAnyBranch()
1142 revision_to_number = {}
1143 revision_id_sequence_pairs = []
1144- for i in range(10):
1145+ for _i in range(10):
1146 rev = self.factory.makeRevision()
1147 revision_number = self.factory.getUniqueInteger()
1148 revision_to_number[rev] = revision_number
1149diff --git a/lib/lp/code/model/tests/test_branchcloud.py b/lib/lp/code/model/tests/test_branchcloud.py
1150index 1427af3..cb9575c 100644
1151--- a/lib/lp/code/model/tests/test_branchcloud.py
1152+++ b/lib/lp/code/model/tests/test_branchcloud.py
1153@@ -116,7 +116,7 @@ class TestBranchCloud(TestCaseWithFactory):
1154 delta=timedelta(days=2),
1155 )
1156 store = Store.of(product)
1157- for i in range(4):
1158+ for _ in range(4):
1159 revision = self.factory.makeRevision(
1160 revision_date=next(date_generator)
1161 )
1162@@ -132,10 +132,10 @@ class TestBranchCloud(TestCaseWithFactory):
1163 # getProductsWithInfo returns a result set sorted so that the products
1164 # with the most commits come first.
1165 product1 = self.factory.makeProduct()
1166- for i in range(3):
1167+ for _ in range(3):
1168 self.makeBranch(product=product1)
1169 product2 = self.factory.makeProduct()
1170- for i in range(5):
1171+ for _ in range(5):
1172 self.makeBranch(product=product2)
1173 self.assertEqual(
1174 [product2.name, product1.name],
1175@@ -147,13 +147,13 @@ class TestBranchCloud(TestCaseWithFactory):
1176 # number of products in the result set. The products with the fewest
1177 # branches are discarded first.
1178 product1 = self.factory.makeProduct()
1179- for i in range(3):
1180+ for _ in range(3):
1181 self.makeBranch(product=product1)
1182 product2 = self.factory.makeProduct()
1183- for i in range(5):
1184+ for _ in range(5):
1185 self.makeBranch(product=product2)
1186 product3 = self.factory.makeProduct()
1187- for i in range(7):
1188+ for _ in range(7):
1189 self.makeBranch(product=product3)
1190 self.assertEqual(
1191 [product3.name, product2.name],
1192diff --git a/lib/lp/code/model/tests/test_branchcollection.py b/lib/lp/code/model/tests/test_branchcollection.py
1193index 8c4e7f7..f48f5c7 100644
1194--- a/lib/lp/code/model/tests/test_branchcollection.py
1195+++ b/lib/lp/code/model/tests/test_branchcollection.py
1196@@ -176,7 +176,7 @@ class TestGenericBranchCollection(TestCaseWithFactory):
1197 # the collection.
1198 collection = GenericBranchCollection(self.store)
1199 self.assertEqual(0, collection.count())
1200- for i in range(3):
1201+ for _ in range(3):
1202 self.factory.makeAnyBranch()
1203 self.assertEqual(3, collection.count())
1204
1205@@ -197,7 +197,7 @@ class TestGenericBranchCollection(TestCaseWithFactory):
1206 depth = 3
1207 # Create private branches person can see.
1208 branches = []
1209- for i in range(branch_number):
1210+ for _ in range(branch_number):
1211 branches.append(
1212 self.factory.makeStackedOnBranchChain(
1213 owner=person,
1214@@ -218,7 +218,7 @@ class TestGenericBranchCollection(TestCaseWithFactory):
1215 depth = 3
1216 # Create public branches.
1217 branches = []
1218- for i in range(branch_number):
1219+ for _ in range(branch_number):
1220 branches.append(self.factory.makeStackedOnBranchChain(depth=depth))
1221 all_branches = GenericBranchCollection.preloadVisibleStackedOnBranches(
1222 branches
1223@@ -231,7 +231,7 @@ class TestGenericBranchCollection(TestCaseWithFactory):
1224 depth = 3
1225 # Create public branches.
1226 branches = []
1227- for i in range(branch_number):
1228+ for _ in range(branch_number):
1229 branches.append(
1230 self.factory.makeStackedOnBranchChain(
1231 owner=person, depth=depth
1232@@ -922,7 +922,7 @@ class TestExtendedBranchRevisionDetails(TestCaseWithFactory):
1233
1234 linked_bugtasks = []
1235 with person_logged_in(branch.owner):
1236- for x in range(0, 2):
1237+ for _ in range(0, 2):
1238 bug = self.factory.makeBug()
1239 merge_proposals[0].source_branch.linkBug(bug, branch.owner)
1240 linked_bugtasks.append(bug.default_bugtask)
1241diff --git a/lib/lp/code/model/tests/test_branchmergeproposal.py b/lib/lp/code/model/tests/test_branchmergeproposal.py
1242index 26780a7..d5229ee 100644
1243--- a/lib/lp/code/model/tests/test_branchmergeproposal.py
1244+++ b/lib/lp/code/model/tests/test_branchmergeproposal.py
1245@@ -2865,7 +2865,7 @@ class TestGetRevisionsSinceReviewStart(TestCaseWithFactory):
1246 bmp.requestReview(review_date)
1247 revision_date = review_date + timedelta(days=1)
1248 revisions = []
1249- for date in range(2):
1250+ for _ in range(2):
1251 revisions.append(
1252 add_revision_to_branch(
1253 self.factory, bmp.source_branch, revision_date
1254diff --git a/lib/lp/code/model/tests/test_branchpuller.py b/lib/lp/code/model/tests/test_branchpuller.py
1255index d2215ba..c70cb6b 100644
1256--- a/lib/lp/code/model/tests/test_branchpuller.py
1257+++ b/lib/lp/code/model/tests/test_branchpuller.py
1258@@ -118,7 +118,7 @@ class TestMirroringForMirroredBranches(TestMirroringForImportedBranches):
1259 """If a branch repeatedly fails to mirror, back off exponentially."""
1260 branch = self.makeAnyBranch()
1261 num_failures = 3
1262- for i in range(num_failures):
1263+ for _ in range(num_failures):
1264 branch.requestMirror()
1265 branch.startMirroring()
1266 branch.mirrorFailed("No particular reason")
1267@@ -132,7 +132,7 @@ class TestMirroringForMirroredBranches(TestMirroringForImportedBranches):
1268 mirroring.
1269 """
1270 branch = self.makeAnyBranch()
1271- for i in range(self.max_failures):
1272+ for _ in range(self.max_failures):
1273 branch.requestMirror()
1274 branch.startMirroring()
1275 branch.mirrorFailed("No particular reason")
1276diff --git a/lib/lp/code/model/tests/test_cibuild.py b/lib/lp/code/model/tests/test_cibuild.py
1277index ed55b49..b80c3e9 100644
1278--- a/lib/lp/code/model/tests/test_cibuild.py
1279+++ b/lib/lp/code/model/tests/test_cibuild.py
1280@@ -304,7 +304,7 @@ class TestCIBuild(TestCaseWithFactory):
1281 status=BuildStatus.FULLYBUILT,
1282 duration=timedelta(seconds=335),
1283 )
1284- for i in range(3):
1285+ for _ in range(3):
1286 self.factory.makeCIBuild(
1287 git_repository=build.git_repository,
1288 distro_arch_series=build.distro_arch_series,
1289diff --git a/lib/lp/code/model/tests/test_codeimportjob.py b/lib/lp/code/model/tests/test_codeimportjob.py
1290index 5fb2596..6dd2957 100644
1291--- a/lib/lp/code/model/tests/test_codeimportjob.py
1292+++ b/lib/lp/code/model/tests/test_codeimportjob.py
1293@@ -1064,12 +1064,12 @@ class TestCodeImportJobWorkflowFinishJob(
1294 intervals = []
1295 interval = running_job.code_import.effective_update_interval
1296 expected_intervals = []
1297- for i in range(config.codeimport.consecutive_failure_limit - 1):
1298+ for _ in range(config.codeimport.consecutive_failure_limit - 1):
1299 expected_intervals.append(interval)
1300 interval *= 2
1301 # Fail an import a bunch of times and record how far in the future the
1302 # next job was scheduled.
1303- for i in range(config.codeimport.consecutive_failure_limit - 1):
1304+ for _ in range(config.codeimport.consecutive_failure_limit - 1):
1305 code_import = running_job.code_import
1306 getUtility(ICodeImportJobWorkflow).finishJob(
1307 running_job, CodeImportResultStatus.FAILURE, None
1308@@ -1274,7 +1274,7 @@ class TestCodeImportJobWorkflowFinishJob(
1309 # times in a row, the import is marked as FAILING.
1310 code_import = self.factory.makeCodeImport()
1311 failure_limit = config.codeimport.consecutive_failure_limit
1312- for i in range(failure_limit - 1):
1313+ for _ in range(failure_limit - 1):
1314 running_job = self.makeRunningJob(code_import)
1315 getUtility(ICodeImportJobWorkflow).finishJob(
1316 running_job, CodeImportResultStatus.FAILURE, None
1317diff --git a/lib/lp/code/model/tests/test_codereviewinlinecomment.py b/lib/lp/code/model/tests/test_codereviewinlinecomment.py
1318index 66cb734..8040b03 100644
1319--- a/lib/lp/code/model/tests/test_codereviewinlinecomment.py
1320+++ b/lib/lp/code/model/tests/test_codereviewinlinecomment.py
1321@@ -210,7 +210,7 @@ class TestCodeReviewInlineComment(TestCaseWithFactory):
1322 expected_relations = {}
1323 comments = []
1324 person = self.factory.makePerson()
1325- for i in range(5):
1326+ for _ in range(5):
1327 comment = self.factory.makeCodeReviewComment()
1328 comments.append(comment)
1329 inline_comment = self.makeCodeReviewInlineComment(
1330diff --git a/lib/lp/code/model/tests/test_gitcollection.py b/lib/lp/code/model/tests/test_gitcollection.py
1331index 2fa46fc..44ed4fc 100644
1332--- a/lib/lp/code/model/tests/test_gitcollection.py
1333+++ b/lib/lp/code/model/tests/test_gitcollection.py
1334@@ -179,7 +179,7 @@ class TestGenericGitCollection(TestCaseWithFactory):
1335 # the collection.
1336 collection = GenericGitCollection(self.store)
1337 self.assertEqual(0, collection.count())
1338- for i in range(3):
1339+ for _ in range(3):
1340 self.factory.makeGitRepository()
1341 self.assertEqual(3, collection.count())
1342
1343diff --git a/lib/lp/code/model/tests/test_gitrepository.py b/lib/lp/code/model/tests/test_gitrepository.py
1344index 9ee06d9..b4dbef8 100644
1345--- a/lib/lp/code/model/tests/test_gitrepository.py
1346+++ b/lib/lp/code/model/tests/test_gitrepository.py
1347@@ -1867,7 +1867,7 @@ class TestGitRepositoryModificationNotifications(TestCaseWithFactory):
1348 getUtility(IGitRepositoryModifiedMailJobSource)
1349 ).runAll()
1350 bodies_by_recipient = {}
1351- for from_addr, to_addrs, message in stub.test_emails:
1352+ for _from_addr, to_addrs, message in stub.test_emails:
1353 body = (
1354 email.message_from_bytes(message)
1355 .get_payload(decode=True)
1356@@ -4517,7 +4517,7 @@ class TestGitRepositoryRules(TestCaseWithFactory):
1357 prefix="refs/heads/"
1358 ),
1359 )
1360- for i in range(2):
1361+ for _i in range(2):
1362 self.factory.makeGitRuleGrant(rule=rule)
1363
1364 def get_rules():
1365@@ -5805,7 +5805,7 @@ class TestGitRepositoryWebservice(TestCaseWithFactory):
1366 self.assertEqual([], response.jsonBody())
1367 with person_logged_in(person):
1368 repo = []
1369- for i in range(5):
1370+ for _i in range(5):
1371 repo.append(self.factory.makeGitRepository())
1372 for i in range(3):
1373 removeSecurityProxy(repo[i]).loose_object_count = 7000 + i
1374@@ -5844,9 +5844,9 @@ class TestGitRepositoryWebservice(TestCaseWithFactory):
1375 self.assertEqual(200, response.status)
1376 self.assertEqual(0, response.jsonBody())
1377 with person_logged_in(person):
1378- for item in range(5):
1379+ for _item in range(5):
1380 self.factory.makeGitRepository()
1381- for item in range(3):
1382+ for _item in range(3):
1383 repo = self.factory.makeGitRepository()
1384 removeSecurityProxy(repo).loose_object_count = 7000
1385 removeSecurityProxy(repo).pack_count = 43
1386diff --git a/lib/lp/code/model/tests/test_revision.py b/lib/lp/code/model/tests/test_revision.py
1387index 02a5aa1..0fac209 100644
1388--- a/lib/lp/code/model/tests/test_revision.py
1389+++ b/lib/lp/code/model/tests/test_revision.py
1390@@ -985,7 +985,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase):
1391 datetime.now(timezone.utc) - timedelta(days=33),
1392 delta=timedelta(days=2),
1393 )
1394- for i in range(4):
1395+ for _ in range(4):
1396 revision = self.factory.makeRevision(
1397 revision_date=next(date_generator)
1398 )
1399@@ -1000,7 +1000,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase):
1400 datetime.now(timezone.utc) - timedelta(days=33),
1401 delta=timedelta(days=2),
1402 )
1403- for i in range(4):
1404+ for _ in range(4):
1405 revision = self.factory.makeRevision(
1406 revision_date=next(date_generator)
1407 )
1408diff --git a/lib/lp/code/model/tests/test_revisioncache.py b/lib/lp/code/model/tests/test_revisioncache.py
1409index df03eb9..b355e76 100644
1410--- a/lib/lp/code/model/tests/test_revisioncache.py
1411+++ b/lib/lp/code/model/tests/test_revisioncache.py
1412@@ -89,7 +89,7 @@ class TestRevisionCache(TestCaseWithFactory):
1413
1414 def test_simple_total_count(self):
1415 # Test that the count does in fact count the revisions we add.
1416- for i in range(4):
1417+ for _ in range(4):
1418 self.makeCachedRevision()
1419 cache = getUtility(IRevisionCache)
1420 self.assertEqual(4, cache.count())
1421@@ -135,7 +135,7 @@ class TestRevisionCache(TestCaseWithFactory):
1422 delta=timedelta(days=-2),
1423 )
1424 # Make four cached revisions spanning 33, 31, 29, and 27 days ago.
1425- for i in range(4):
1426+ for _ in range(4):
1427 self.makeCachedRevision(
1428 revision=self.factory.makeRevision(revision_date=next(tc))
1429 )
1430@@ -363,7 +363,7 @@ class TestRevisionCache(TestCaseWithFactory):
1431 # If there are multiple revisions with the same revision author text,
1432 # but not linked to a Launchpad person, then that revision_text is
1433 # counted as one author.
1434- for counter in range(4):
1435+ for _ in range(4):
1436 self.makeCachedRevision(
1437 revision=self.factory.makeRevision(
1438 author="Foo <foo@example.com>"
1439diff --git a/lib/lp/code/model/tests/test_sourcepackagerecipe.py b/lib/lp/code/model/tests/test_sourcepackagerecipe.py
1440index 63e54ae..715dd9a 100644
1441--- a/lib/lp/code/model/tests/test_sourcepackagerecipe.py
1442+++ b/lib/lp/code/model/tests/test_sourcepackagerecipe.py
1443@@ -292,7 +292,7 @@ class TestSourcePackageRecipeMixin:
1444
1445 def createSourcePackageRecipe(self, number_of_branches=2):
1446 branches = []
1447- for i in range(number_of_branches):
1448+ for _ in range(number_of_branches):
1449 branches.append(self.makeBranch())
1450 sp_recipe = self.makeSourcePackageRecipe(branches=branches)
1451 transaction.commit()
1452diff --git a/lib/lp/code/scripts/tests/test_repack_git_repositories.py b/lib/lp/code/scripts/tests/test_repack_git_repositories.py
1453index 9f2422d..d02c8d3 100644
1454--- a/lib/lp/code/scripts/tests/test_repack_git_repositories.py
1455+++ b/lib/lp/code/scripts/tests/test_repack_git_repositories.py
1456@@ -284,7 +284,7 @@ class TestRequestGitRepack(TestCaseWithFactory):
1457 repo[i].loose_object_count = 7000
1458 repo[i].pack_count = 43
1459
1460- for i in range(3):
1461+ for _ in range(3):
1462 repo.append(self.factory.makeGitRepository())
1463
1464 # we should only have 7 candidates at this point
1465diff --git a/lib/lp/code/tests/helpers.py b/lib/lp/code/tests/helpers.py
1466index ff8165b..cbe6b9a 100644
1467--- a/lib/lp/code/tests/helpers.py
1468+++ b/lib/lp/code/tests/helpers.py
1469@@ -236,7 +236,7 @@ def make_project_cloud_data(factory, details):
1470 start_date = last_commit - delta * (num_commits - 1)
1471 gen = time_counter(start_date, delta)
1472 commits_each = num_commits // num_authors
1473- for committer in range(num_authors - 1):
1474+ for _ in range(num_authors - 1):
1475 make_project_branch_with_revisions(
1476 factory, gen, project, commits_each
1477 )
1478diff --git a/lib/lp/codehosting/scanner/buglinks.py b/lib/lp/codehosting/scanner/buglinks.py
1479index e016403..bec1fcf 100644
1480--- a/lib/lp/codehosting/scanner/buglinks.py
1481+++ b/lib/lp/codehosting/scanner/buglinks.py
1482@@ -76,7 +76,7 @@ class BugBranchLinker:
1483 except InvalidBugStatus:
1484 return
1485 bug_set = getUtility(IBugSet)
1486- for bug_id, status in bug_info.items():
1487+ for bug_id in bug_info:
1488 try:
1489 bug = bug_set.get(bug_id)
1490 except NotFoundError:
1491diff --git a/lib/lp/codehosting/tests/test_rewrite.py b/lib/lp/codehosting/tests/test_rewrite.py
1492index 28f78b3..a7e1b90 100644
1493--- a/lib/lp/codehosting/tests/test_rewrite.py
1494+++ b/lib/lp/codehosting/tests/test_rewrite.py
1495@@ -404,7 +404,7 @@ class TestBranchRewriterScriptHandlesDisconnects(TestCase):
1496 # stderr spam, and this keeps happening. We test more than
1497 # once to ensure that we will keep trying to reconnect even
1498 # after several failures.
1499- for count in range(5):
1500+ for _ in range(5):
1501 out = self.request("foo")
1502 self.assertEqual(out, "NULL")
1503
1504@@ -422,7 +422,7 @@ class TestBranchRewriterScriptHandlesDisconnects(TestCase):
1505
1506 self.spawn()
1507
1508- for count in range(5):
1509+ for _ in range(5):
1510 out = self.request("foo")
1511 self.assertEqual(out, "NULL")
1512
1513diff --git a/lib/lp/codehosting/upgrade.py b/lib/lp/codehosting/upgrade.py
1514index 1bffc40..7220492 100755
1515--- a/lib/lp/codehosting/upgrade.py
1516+++ b/lib/lp/codehosting/upgrade.py
1517@@ -188,7 +188,7 @@ class Upgrader:
1518 repo = self.bzr_branch.repository
1519 revision_ids = repo.all_revision_ids()
1520 for tree in repo.revision_trees(revision_ids):
1521- for path, entry in tree.iter_entries_by_dir():
1522+ for _, entry in tree.iter_entries_by_dir():
1523 if entry.kind == "tree-reference":
1524 return True
1525 return False
1526diff --git a/lib/lp/oci/tests/test_ocirecipe.py b/lib/lp/oci/tests/test_ocirecipe.py
1527index 92d64ac..1850458 100644
1528--- a/lib/lp/oci/tests/test_ocirecipe.py
1529+++ b/lib/lp/oci/tests/test_ocirecipe.py
1530@@ -1080,7 +1080,7 @@ class TestOCIRecipeAccessControl(TestCaseWithFactory, OCIConfigHelperMixin):
1531 registrant=person,
1532 )
1533 recipes = []
1534- for i in range(10):
1535+ for _ in range(10):
1536 recipes.append(
1537 self.factory.makeOCIRecipe(
1538 registrant=person,
1539@@ -1587,7 +1587,7 @@ class TestOCIRecipeSet(TestCaseWithFactory):
1540 repositories = [self.factory.makeGitRepository() for i in range(2)]
1541 oci_recipes = []
1542 for repository in repositories:
1543- for i in range(2):
1544+ for _ in range(2):
1545 [ref] = self.factory.makeGitRefs(
1546 repository=repository, paths=["refs/heads/v1.0-20.04"]
1547 )
1548@@ -1642,7 +1642,7 @@ class TestOCIRecipeSet(TestCaseWithFactory):
1549 paths = []
1550 refs = []
1551 for repository in repositories:
1552- for i in range(2):
1553+ for _ in range(2):
1554 [ref] = self.factory.makeGitRefs(
1555 repository=repository, paths=["refs/heads/v1.0-20.04"]
1556 )
1557diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py
1558index d80ee74..9154be2 100644
1559--- a/lib/lp/oci/tests/test_ocirecipebuild.py
1560+++ b/lib/lp/oci/tests/test_ocirecipebuild.py
1561@@ -249,7 +249,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
1562 oci_build = self.factory.makeOCIRecipeBuild(
1563 status=BuildStatus.FULLYBUILT, duration=timedelta(seconds=335)
1564 )
1565- for i in range(3):
1566+ for _ in range(3):
1567 self.factory.makeOCIRecipeBuild(
1568 requester=oci_build.requester,
1569 recipe=oci_build.recipe,
1570diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
1571index 3bd82ec..6dab8c8 100644
1572--- a/lib/lp/registry/browser/person.py
1573+++ b/lib/lp/registry/browser/person.py
1574@@ -512,7 +512,7 @@ class PersonNavigation(BranchTraversalMixin, Navigation):
1575 for distro, ppa, segments, redirect in attempts:
1576 ppa = traverse_named_ppa(self.context, distro, ppa)
1577 if ppa is not None:
1578- for i in range(segments):
1579+ for _i in range(segments):
1580 self.request.stepstogo.consume()
1581 if redirect:
1582 return self.redirectSubTree(
1583diff --git a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
1584index 2fe3824..c6313c4 100644
1585--- a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
1586+++ b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
1587@@ -55,7 +55,7 @@ class TestDistributionSourcePackageChangelogView(TestCaseWithFactory):
1588 )
1589 self.assertThat(dsp, changelog_browses_under_limit)
1590 with celebrity_logged_in("admin"):
1591- for i in range(5):
1592+ for _ in range(5):
1593 self.factory.makePackageDiff(
1594 to_source=spph.sourcepackagerelease
1595 )
1596diff --git a/lib/lp/registry/browser/tests/test_distroseries.py b/lib/lp/registry/browser/tests/test_distroseries.py
1597index 40d9d15..2298c5c 100644
1598--- a/lib/lp/registry/browser/tests/test_distroseries.py
1599+++ b/lib/lp/registry/browser/tests/test_distroseries.py
1600@@ -264,21 +264,21 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory):
1601 )
1602 )
1603 first_parent_series = dsps[0].parent_series
1604- for i in range(nb_diff_versions):
1605+ for _ in range(nb_diff_versions):
1606 diff_type = DistroSeriesDifferenceType.DIFFERENT_VERSIONS
1607 self.factory.makeDistroSeriesDifference(
1608 derived_series=derived_series,
1609 difference_type=diff_type,
1610 parent_series=first_parent_series,
1611 )
1612- for i in range(nb_diff_child):
1613+ for _ in range(nb_diff_child):
1614 diff_type = DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES
1615 self.factory.makeDistroSeriesDifference(
1616 derived_series=derived_series,
1617 difference_type=diff_type,
1618 parent_series=first_parent_series,
1619 )
1620- for i in range(nb_diff_parent):
1621+ for _ in range(nb_diff_parent):
1622 diff_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
1623 self.factory.makeDistroSeriesDifference(
1624 derived_series=derived_series,
1625@@ -1606,7 +1606,7 @@ class TestDistroSeriesLocalDifferences(
1626 self.assertThat(recorder1, HasQueryCount(LessThan(12)))
1627
1628 # The query count does not increase with the number of upgrades.
1629- for index in range(3):
1630+ for _ in range(3):
1631 self.makePackageUpgrade(derived_series=derived_series)
1632 flush_database_caches()
1633 with StormStatementRecorder() as recorder2:
1634diff --git a/lib/lp/registry/browser/tests/test_mailinglists.py b/lib/lp/registry/browser/tests/test_mailinglists.py
1635index 754e694..ed16526 100644
1636--- a/lib/lp/registry/browser/tests/test_mailinglists.py
1637+++ b/lib/lp/registry/browser/tests/test_mailinglists.py
1638@@ -277,7 +277,7 @@ class TeamMailingListModerationViewTestCase(MailingListTestCase):
1639 def test_batching(self):
1640 team = self.makeTeamWithMailingList()
1641 sender, message, held_message = self.makeHeldMessage(team)
1642- for i in range(5):
1643+ for _ in range(5):
1644 self.makeHeldMessage(team, sender)
1645 view = create_initialized_view(
1646 team, name="+mailinglist-moderate", principal=team.teamowner
1647diff --git a/lib/lp/registry/browser/tests/test_milestone.py b/lib/lp/registry/browser/tests/test_milestone.py
1648index e0c380e..89fa352 100644
1649--- a/lib/lp/registry/browser/tests/test_milestone.py
1650+++ b/lib/lp/registry/browser/tests/test_milestone.py
1651@@ -399,7 +399,7 @@ class TestProjectMilestoneIndexQueryCount(TestQueryCountBase):
1652
1653 def add_bug(self, count):
1654 login_person(self.product_owner)
1655- for i in range(count):
1656+ for _ in range(count):
1657 bug = self.factory.makeBug(target=self.product)
1658 bug.bugtasks[0].transitionToMilestone(
1659 self.milestone, self.product.owner
1660@@ -537,7 +537,7 @@ class TestProjectGroupMilestoneIndexQueryCount(TestQueryCountBase):
1661
1662 def add_bug(self, count):
1663 login_person(self.owner)
1664- for i in range(count):
1665+ for _ in range(count):
1666 bug = self.factory.makeBug(target=self.product_milestone.product)
1667 bug.bugtasks[0].transitionToMilestone(
1668 self.product_milestone, self.owner
1669@@ -591,7 +591,7 @@ class TestDistributionMilestoneIndexQueryCount(TestQueryCountBase):
1670
1671 def add_bug(self, count):
1672 login_person(self.owner)
1673- for i in range(count):
1674+ for _ in range(count):
1675 bug = self.factory.makeBug(target=self.ubuntu)
1676 distrosourcepackage = self.factory.makeDistributionSourcePackage(
1677 distribution=self.ubuntu
1678@@ -652,7 +652,7 @@ class TestMilestoneTagView(TestQueryCountBase):
1679
1680 def add_bug(self, count):
1681 with person_logged_in(self.owner):
1682- for n in range(count):
1683+ for _ in range(count):
1684 self.factory.makeBug(
1685 target=self.product,
1686 owner=self.owner,
1687diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py
1688index 88bca93..19425f4 100644
1689--- a/lib/lp/registry/browser/tests/test_person.py
1690+++ b/lib/lp/registry/browser/tests/test_person.py
1691@@ -1651,7 +1651,7 @@ class TestPersonRelatedProjectsView(TestCaseWithFactory):
1692 )
1693
1694 def test_batching(self):
1695- for i in range(10):
1696+ for _ in range(10):
1697 self.factory.makeProduct(owner=self.user)
1698 view = create_initialized_view(self.user, "+related-projects")
1699 next_match = soupmatchers.HTMLContains(
1700diff --git a/lib/lp/registry/browser/tests/test_person_contact.py b/lib/lp/registry/browser/tests/test_person_contact.py
1701index 24e1ccd..8661ab0 100644
1702--- a/lib/lp/registry/browser/tests/test_person_contact.py
1703+++ b/lib/lp/registry/browser/tests/test_person_contact.py
1704@@ -149,7 +149,7 @@ class ContactViaWebNotificationRecipientSetTestCase(TestCaseWithFactory):
1705 sender = self.factory.makePerson()
1706 user = self.factory.makePerson(name="pting")
1707 recipient_set = ContactViaWebNotificationRecipientSet(sender, user)
1708- for email, recipient in recipient_set.getRecipientPersons():
1709+ for email, _ in recipient_set.getRecipientPersons():
1710 reason, rationale = recipient_set.getReason(email)
1711 self.assertEqual(
1712 'using the "Contact this user" link on your profile page '
1713@@ -162,7 +162,7 @@ class ContactViaWebNotificationRecipientSetTestCase(TestCaseWithFactory):
1714 sender = self.factory.makePerson()
1715 team = self.factory.makeTeam(name="pting")
1716 recipient_set = ContactViaWebNotificationRecipientSet(sender, team)
1717- for email, recipient in recipient_set.getRecipientPersons():
1718+ for email, _ in recipient_set.getRecipientPersons():
1719 reason, rationale = recipient_set.getReason(email)
1720 self.assertEqual(
1721 'using the "Contact this team\'s admins" link '
1722@@ -176,7 +176,7 @@ class ContactViaWebNotificationRecipientSetTestCase(TestCaseWithFactory):
1723 team = self.factory.makeTeam(name="pting")
1724 sender = team.teamowner
1725 recipient_set = ContactViaWebNotificationRecipientSet(sender, team)
1726- for email, recipient in recipient_set.getRecipientPersons():
1727+ for email, _ in recipient_set.getRecipientPersons():
1728 reason, rationale = recipient_set.getReason(email)
1729 self.assertEqual(
1730 "to each member of the Pting team using the "
1731@@ -281,7 +281,7 @@ class EmailToPersonViewTestCase(TestCaseWithFactory):
1732 sender = self.factory.makePerson(email="me@eg.dom")
1733 old_message = self.factory.makeSignedMessage(email_address="me@eg.dom")
1734 authorization = IDirectEmailAuthorization(sender)
1735- for action in range(authorization.message_quota):
1736+ for _ in range(authorization.message_quota):
1737 authorization.record(old_message)
1738 return sender
1739
1740diff --git a/lib/lp/registry/browser/tests/test_person_webservice.py b/lib/lp/registry/browser/tests/test_person_webservice.py
1741index df60d7e..bcea221 100644
1742--- a/lib/lp/registry/browser/tests/test_person_webservice.py
1743+++ b/lib/lp/registry/browser/tests/test_person_webservice.py
1744@@ -324,7 +324,7 @@ class PersonWebServiceTests(TestCaseWithFactory):
1745 snapshot.HARD_LIMIT_FOR_SNAPSHOT = 3
1746 try:
1747 with person_logged_in(owner):
1748- for count in range(snapshot.HARD_LIMIT_FOR_SNAPSHOT + 1):
1749+ for _ in range(snapshot.HARD_LIMIT_FOR_SNAPSHOT + 1):
1750 self.factory.makeArchive(owner=team)
1751 team_url = api_url(team)
1752 new_member_url = api_url(new_member)
1753diff --git a/lib/lp/registry/browser/tests/test_pillar_sharing.py b/lib/lp/registry/browser/tests/test_pillar_sharing.py
1754index 43ac94e..1d9cb06 100644
1755--- a/lib/lp/registry/browser/tests/test_pillar_sharing.py
1756+++ b/lib/lp/registry/browser/tests/test_pillar_sharing.py
1757@@ -432,7 +432,7 @@ class PillarSharingViewTestMixin:
1758 )
1759 # Add 4 members to the team, so we should have the team owner + 4
1760 # other members with access to the artifacts.
1761- for i in range(4):
1762+ for _ in range(4):
1763 self.factory.makePerson(member_of=[team])
1764
1765 items = [
1766diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
1767index 33cd2b9..a99809e 100644
1768--- a/lib/lp/registry/model/person.py
1769+++ b/lib/lp/registry/model/person.py
1770@@ -1099,7 +1099,7 @@ class Person(
1771 """See `IPerson`."""
1772 contributions = []
1773 results = self._getProjectsWithTheMostKarma(user, limit=limit)
1774- for product, distro, karma in results:
1775+ for product, distro, _karma in results:
1776 pillar = product or distro
1777 contributions.append(
1778 {
1779@@ -2808,7 +2808,14 @@ class Person(
1780
1781 warnings = set()
1782 ref_query = []
1783- for src_tab, src_col, ref_tab, ref_col, updact, delact in references:
1784+ for (
1785+ src_tab,
1786+ src_col,
1787+ _ref_tab,
1788+ _ref_col,
1789+ _updact,
1790+ _delact,
1791+ ) in references:
1792 if (src_tab, src_col) in skip:
1793 continue
1794 query = (
1795diff --git a/lib/lp/registry/model/pillar.py b/lib/lp/registry/model/pillar.py
1796index 14d4fc8..330c396 100644
1797--- a/lib/lp/registry/model/pillar.py
1798+++ b/lib/lp/registry/model/pillar.py
1799@@ -245,9 +245,7 @@ class PillarNameSet:
1800 )
1801 pillars = []
1802 products = []
1803- for pillar_name, other, product, projectgroup, distro in result[
1804- :limit
1805- ]:
1806+ for pillar_name, _, _, _, _ in result[:limit]:
1807 pillar = pillar_name.pillar
1808 if IProduct.providedBy(pillar):
1809 products.append(pillar)
1810diff --git a/lib/lp/registry/model/product.py b/lib/lp/registry/model/product.py
1811index 1ebe91c..10bd4c6 100644
1812--- a/lib/lp/registry/model/product.py
1813+++ b/lib/lp/registry/model/product.py
1814@@ -1742,7 +1742,7 @@ def get_precached_products(
1815 release_caches = {}
1816 all_releases = []
1817 milestones_and_releases = get_milestones_and_releases(products)
1818- for milestone, release, product_id in milestones_and_releases:
1819+ for milestone, release, _ in milestones_and_releases:
1820 release_cache = get_property_cache(release)
1821 release_caches[release.id] = release_cache
1822 if not hasattr(release_cache, "files"):
1823diff --git a/lib/lp/registry/personmerge.py b/lib/lp/registry/personmerge.py
1824index 2787bc2..cd412e9 100644
1825--- a/lib/lp/registry/personmerge.py
1826+++ b/lib/lp/registry/personmerge.py
1827@@ -1192,7 +1192,7 @@ def merge_people(from_person, to_person, reviewer, delete=False):
1828 # Sanity check. If we have a reference that participates in a
1829 # UNIQUE index, it must have already been handled by this point.
1830 # We can tell this by looking at the skip list.
1831- for src_tab, src_col, ref_tab, ref_col, updact, delact in references:
1832+ for src_tab, src_col, ref_tab, ref_col, _, _ in references:
1833 uniques = postgresql.listUniques(cur, src_tab, src_col)
1834 if len(uniques) > 0 and (src_tab, src_col) not in skip:
1835 raise NotImplementedError(
1836@@ -1202,7 +1202,7 @@ def merge_people(from_person, to_person, reviewer, delete=False):
1837 )
1838
1839 # Handle all simple cases
1840- for src_tab, src_col, ref_tab, ref_col, updact, delact in references:
1841+ for src_tab, src_col, _, _, _, _ in references:
1842 if (src_tab, src_col) in skip:
1843 continue
1844 cur.execute(
1845diff --git a/lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py b/lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py
1846index 4038633..23219c5 100644
1847--- a/lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py
1848+++ b/lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py
1849@@ -645,7 +645,7 @@ class TestPopulateDistroSeriesDiffScript(TestCaseWithFactory, FactoryHelper):
1850
1851 def test_finds_all_distroseries(self):
1852 spphs = []
1853- for counter in range(2):
1854+ for _ in range(2):
1855 dsp = self.makeDerivedDistroSeries()
1856 spphs.append(self.makeSPPH(dsp.derived_series))
1857 script = self.makeScript(["--all"])
1858diff --git a/lib/lp/registry/services/tests/test_sharingservice.py b/lib/lp/registry/services/tests/test_sharingservice.py
1859index f0a5d13..16ba918 100644
1860--- a/lib/lp/registry/services/tests/test_sharingservice.py
1861+++ b/lib/lp/registry/services/tests/test_sharingservice.py
1862@@ -577,14 +577,14 @@ class TestSharingService(
1863 )
1864
1865 # Make some grants and check the count.
1866- for x in range(5):
1867+ for _ in range(5):
1868 makeGrants()
1869 with StormStatementRecorder() as recorder:
1870 grantees = list(func(pillar))
1871 self.assertEqual(11, len(grantees))
1872 self.assertThat(recorder, HasQueryCount(LessThan(count)))
1873 # Make some more grants and check again.
1874- for x in range(5):
1875+ for _ in range(5):
1876 makeGrants()
1877 with StormStatementRecorder() as recorder:
1878 grantees = list(func(pillar))
1879@@ -1674,7 +1674,7 @@ class TestSharingService(
1880 # specifications, ocirecipes, and vulnerabilities.
1881 bugs = []
1882 bug_tasks = []
1883- for x in range(0, 10):
1884+ for _ in range(0, 10):
1885 bug = self.factory.makeBug(
1886 target=pillar,
1887 owner=pillar.owner,
1888@@ -1683,7 +1683,7 @@ class TestSharingService(
1889 bugs.append(bug)
1890 bug_tasks.append(bug.default_bugtask)
1891 branches = []
1892- for x in range(0, 10):
1893+ for _ in range(0, 10):
1894 branch = self._makeBranch(
1895 pillar=pillar,
1896 owner=pillar.owner,
1897@@ -1691,7 +1691,7 @@ class TestSharingService(
1898 )
1899 branches.append(branch)
1900 gitrepositories = []
1901- for x in range(0, 10):
1902+ for _ in range(0, 10):
1903 gitrepository = self._makeGitRepository(
1904 pillar=pillar,
1905 owner=pillar.owner,
1906@@ -1700,7 +1700,7 @@ class TestSharingService(
1907 gitrepositories.append(gitrepository)
1908 snaps = []
1909 if IProduct.providedBy(pillar):
1910- for x in range(0, 10):
1911+ for _ in range(0, 10):
1912 snap = self.factory.makeSnap(
1913 project=pillar,
1914 owner=pillar.owner,
1915@@ -1709,7 +1709,7 @@ class TestSharingService(
1916 )
1917 snaps.append(snap)
1918 specs = []
1919- for x in range(0, 10):
1920+ for _ in range(0, 10):
1921 spec = self._makeSpecification(
1922 pillar=pillar,
1923 owner=pillar.owner,
1924@@ -1717,7 +1717,7 @@ class TestSharingService(
1925 )
1926 specs.append(spec)
1927 ocirecipes = []
1928- for x in range(0, 10):
1929+ for _ in range(0, 10):
1930 ociproject = self.factory.makeOCIProject(
1931 pillar=pillar, registrant=pillar.owner
1932 )
1933@@ -2119,7 +2119,7 @@ class TestSharingService(
1934 members=[member_with_access]
1935 )
1936 people.append(team_without_access)
1937- for x in range(0, 10):
1938+ for _ in range(0, 10):
1939 person = self.factory.makePerson()
1940 people.append(person)
1941 people.append(team_with_access)
1942@@ -2156,7 +2156,7 @@ class TestSharingService(
1943 login_person(owner)
1944
1945 bugs = []
1946- for x in range(0, 10):
1947+ for _ in range(0, 10):
1948 bug = self.factory.makeBug(
1949 target=pillar,
1950 owner=owner,
1951@@ -2164,7 +2164,7 @@ class TestSharingService(
1952 )
1953 bugs.append(bug)
1954 branches = []
1955- for x in range(0, 10):
1956+ for _ in range(0, 10):
1957 branch = self._makeBranch(
1958 pillar=pillar,
1959 owner=owner,
1960@@ -2172,7 +2172,7 @@ class TestSharingService(
1961 )
1962 branches.append(branch)
1963 gitrepositories = []
1964- for x in range(0, 10):
1965+ for _ in range(0, 10):
1966 gitrepository = self._makeGitRepository(
1967 pillar=pillar,
1968 owner=owner,
1969@@ -2180,7 +2180,7 @@ class TestSharingService(
1970 )
1971 gitrepositories.append(gitrepository)
1972 specifications = []
1973- for x in range(0, 10):
1974+ for _ in range(0, 10):
1975 spec = self._makeSpecification(
1976 pillar=pillar,
1977 owner=owner,
1978@@ -2307,7 +2307,7 @@ class TestSharingService(
1979 )
1980
1981 bugs = []
1982- for x in range(0, 10):
1983+ for _ in range(0, 10):
1984 bug = self.factory.makeBug(
1985 target=pillar,
1986 owner=owner,
1987diff --git a/lib/lp/registry/tests/test_accesspolicy.py b/lib/lp/registry/tests/test_accesspolicy.py
1988index 6481f78..7e4336a 100644
1989--- a/lib/lp/registry/tests/test_accesspolicy.py
1990+++ b/lib/lp/registry/tests/test_accesspolicy.py
1991@@ -883,7 +883,7 @@ class TestReconcileAccessPolicyArtifacts(TestCaseWithFactory):
1992 def create_bugs():
1993 while len(bugs):
1994 bugs.pop()
1995- for i in range(10):
1996+ for _ in range(10):
1997 bugs.append(self.factory.makeBug())
1998
1999 def reconcile():
2000diff --git a/lib/lp/registry/tests/test_distroseries.py b/lib/lp/registry/tests/test_distroseries.py
2001index c7e2111..c6dd967 100644
2002--- a/lib/lp/registry/tests/test_distroseries.py
2003+++ b/lib/lp/registry/tests/test_distroseries.py
2004@@ -340,7 +340,7 @@ class TestDistroSeries(TestCaseWithFactory):
2005 spec2 = self.factory.makeSpecification(
2006 distribution=distribution, goal=distroseries
2007 )
2008- for i in range(5):
2009+ for _ in range(5):
2010 self.factory.makeSpecificationWorkItem(specification=spec1)
2011 self.factory.makeSpecificationWorkItem(specification=spec2)
2012 IStore(spec1.__class__).flush()
2013diff --git a/lib/lp/registry/tests/test_distroseries_vocabularies.py b/lib/lp/registry/tests/test_distroseries_vocabularies.py
2014index 322adf2..2fc9e27 100644
2015--- a/lib/lp/registry/tests/test_distroseries_vocabularies.py
2016+++ b/lib/lp/registry/tests/test_distroseries_vocabularies.py
2017@@ -216,7 +216,7 @@ class TestDistroSeriesDerivationVocabulary(TestCaseWithFactory):
2018 self.assertEqual(expected_distroseries, observed_distroseries)
2019
2020 def test_queries_for_distribution_with_non_derived_series(self):
2021- for index in range(10):
2022+ for _ in range(10):
2023 self.factory.makeDistroSeries()
2024 distribution = self.factory.makeDistribution()
2025 distroseries = self.factory.makeDistroSeries(distribution=distribution)
2026@@ -231,7 +231,7 @@ class TestDistroSeriesDerivationVocabulary(TestCaseWithFactory):
2027 self.assertThat(recorder, HasQueryCount(Equals(2)))
2028
2029 def test_queries_for_distribution_with_derived_series(self):
2030- for index in range(10):
2031+ for _ in range(10):
2032 self.factory.makeDistroSeries()
2033 distribution = self.factory.makeDistribution()
2034 parent_distroseries = self.factory.makeDistroSeries()
2035diff --git a/lib/lp/registry/tests/test_distroseriesdifference.py b/lib/lp/registry/tests/test_distroseriesdifference.py
2036index 4530131..cefef7b 100644
2037--- a/lib/lp/registry/tests/test_distroseriesdifference.py
2038+++ b/lib/lp/registry/tests/test_distroseriesdifference.py
2039@@ -455,7 +455,7 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
2040 # Helper method to create packages sets.
2041 packagesets = []
2042 with celebrity_logged_in("admin"):
2043- for i in range(nb_packagesets):
2044+ for _ in range(nb_packagesets):
2045 ps = self.factory.makePackageset(
2046 packages=[ds_diff.source_package_name],
2047 distroseries=distroseries,
2048diff --git a/lib/lp/registry/tests/test_milestone.py b/lib/lp/registry/tests/test_milestone.py
2049index f9ef144..7409c5e 100644
2050--- a/lib/lp/registry/tests/test_milestone.py
2051+++ b/lib/lp/registry/tests/test_milestone.py
2052@@ -294,7 +294,7 @@ class MilestoneSecurityAdaperTestCase(TestCaseWithFactory):
2053 )
2054
2055 # They cannot change any attributes.
2056- for permission, names in self.expected_set_permissions.items():
2057+ for names in self.expected_set_permissions.values():
2058 self.assertChangeUnauthorized(names, self.public_milestone)
2059 self.assertChangeUnauthorized(
2060 names, self.proprietary_milestone
2061@@ -361,7 +361,7 @@ class MilestoneSecurityAdaperTestCase(TestCaseWithFactory):
2062 )
2063
2064 # They cannot change attributes.
2065- for permission, names in self.expected_set_permissions.items():
2066+ for names in self.expected_set_permissions.values():
2067 self.assertChangeUnauthorized(names, self.public_milestone)
2068 self.assertChangeUnauthorized(
2069 names, self.proprietary_milestone
2070@@ -468,7 +468,7 @@ class MilestoneSecurityAdaperTestCase(TestCaseWithFactory):
2071 self.assertAccessAuthorized(names, self.proprietary_milestone)
2072
2073 # They can change attributes.
2074- for permission, names in self.expected_set_permissions.items():
2075+ for names in self.expected_set_permissions.values():
2076 self.assertChangeAuthorized(names, self.proprietary_milestone)
2077
2078 def test_access_for_product_driver(self):
2079@@ -477,7 +477,7 @@ class MilestoneSecurityAdaperTestCase(TestCaseWithFactory):
2080 with person_logged_in(self.proprietary_product_owner):
2081 self.proprietary_product.driver = driver
2082 with person_logged_in(driver):
2083- for permission, names in self.expected_set_permissions.items():
2084+ for names in self.expected_set_permissions.values():
2085 self.assertChangeAuthorized(names, self.proprietary_milestone)
2086
2087
2088@@ -531,7 +531,7 @@ class MilestoneBugTaskSpecificationTest(TestCaseWithFactory):
2089 def _create_items(self, num, factory, **kwargs):
2090 items = []
2091 with person_logged_in(self.owner):
2092- for n in range(num):
2093+ for _ in range(num):
2094 items.append(factory(**kwargs))
2095 return items
2096
2097diff --git a/lib/lp/registry/tests/test_milestonetag.py b/lib/lp/registry/tests/test_milestonetag.py
2098index 7dd8260..626aea9 100644
2099--- a/lib/lp/registry/tests/test_milestonetag.py
2100+++ b/lib/lp/registry/tests/test_milestonetag.py
2101@@ -107,7 +107,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory):
2102 def _create_bugtasks(self, num, milestone=None):
2103 bugtasks = []
2104 with person_logged_in(self.owner):
2105- for n in range(num):
2106+ for _ in range(num):
2107 bugtask = self.factory.makeBugTask(
2108 target=self.product, owner=self.owner
2109 )
2110@@ -119,7 +119,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory):
2111 def _create_specifications(self, num, milestone=None):
2112 specifications = []
2113 with person_logged_in(self.owner):
2114- for n in range(num):
2115+ for _ in range(num):
2116 specification = self.factory.makeSpecification(
2117 product=self.product, owner=self.owner, milestone=milestone
2118 )
2119diff --git a/lib/lp/registry/tests/test_notification.py b/lib/lp/registry/tests/test_notification.py
2120index 7e91bec..913a2bc 100644
2121--- a/lib/lp/registry/tests/test_notification.py
2122+++ b/lib/lp/registry/tests/test_notification.py
2123@@ -62,7 +62,7 @@ class SendDirectContactEmailTestCase(TestCaseWithFactory):
2124 recipients_set = NotificationRecipientSet()
2125 old_message = self.factory.makeSignedMessage(email_address="me@eg.dom")
2126 authorization = IDirectEmailAuthorization(user)
2127- for action in range(authorization.message_quota):
2128+ for _ in range(authorization.message_quota):
2129 authorization.record(old_message)
2130 self.assertRaises(
2131 QuotaReachedError,
2132@@ -82,7 +82,7 @@ class SendDirectContactEmailTestCase(TestCaseWithFactory):
2133 recipients_set = NotificationRecipientSet()
2134 old_message = self.factory.makeSignedMessage(email_address="me@eg.dom")
2135 authorization = IDirectEmailAuthorization(user)
2136- for action in range(authorization.message_quota - 1):
2137+ for _ in range(authorization.message_quota - 1):
2138 authorization.record(old_message)
2139 pop_notifications()
2140 send_direct_contact_email(
2141diff --git a/lib/lp/registry/tests/test_person.py b/lib/lp/registry/tests/test_person.py
2142index cb3a5a7..5381103 100644
2143--- a/lib/lp/registry/tests/test_person.py
2144+++ b/lib/lp/registry/tests/test_person.py
2145@@ -2149,7 +2149,7 @@ class TestSpecifications(TestCaseWithFactory):
2146 def test_specifications_quantity(self):
2147 # Ensure the quantity controls the maximum number of entries.
2148 owner = self.factory.makePerson()
2149- for count in range(10):
2150+ for _ in range(10):
2151 self.factory.makeSpecification(owner=owner)
2152 self.assertEqual(10, get_specs(owner).count())
2153 self.assertEqual(10, get_specs(owner, quantity=None).count())
2154diff --git a/lib/lp/registry/tests/test_product.py b/lib/lp/registry/tests/test_product.py
2155index 1ef5135..cde2dcd 100644
2156--- a/lib/lp/registry/tests/test_product.py
2157+++ b/lib/lp/registry/tests/test_product.py
2158@@ -2357,7 +2357,7 @@ class TestSpecifications(TestCaseWithFactory):
2159 def test_specifications_quantity(self):
2160 # Ensure the quantity controls the maximum number of entries.
2161 product = self.factory.makeProduct()
2162- for count in range(10):
2163+ for _ in range(10):
2164 self.factory.makeSpecification(product=product)
2165 self.assertEqual(10, get_specs(product).count())
2166 self.assertEqual(10, get_specs(product, quantity=None).count())
2167diff --git a/lib/lp/registry/tests/test_productseries.py b/lib/lp/registry/tests/test_productseries.py
2168index 1188c19..37d9d2f 100644
2169--- a/lib/lp/registry/tests/test_productseries.py
2170+++ b/lib/lp/registry/tests/test_productseries.py
2171@@ -887,7 +887,7 @@ class ProductSeriesSecurityAdaperTestCase(TestCaseWithFactory):
2172 self.assertAccessUnauthorized(names, self.proprietary_series)
2173
2174 # They cannot change any attributes.
2175- for permission, names in self.expected_set_permissions.items():
2176+ for names in self.expected_set_permissions.values():
2177 self.assertChangeUnauthorized(names, self.public_series)
2178 self.assertChangeUnauthorized(names, self.proprietary_series)
2179
2180@@ -1047,38 +1047,38 @@ class ProductSeriesSecurityAdaperTestCase(TestCaseWithFactory):
2181 self.assertAccessUnauthorized(names, self.proprietary_series)
2182
2183 # They cannot change any attributes.
2184- for permission, names in self.expected_set_permissions.items():
2185+ for names in self.expected_set_permissions.values():
2186 self.assertChangeUnauthorized(names, self.proprietary_series)
2187
2188 def test_access_for_product_owner(self):
2189 # The owner of a project has access to all attributes of
2190 # a product series.
2191 with person_logged_in(self.proprietary_product_owner):
2192- for permission, names in self.expected_get_permissions.items():
2193+ for names in self.expected_get_permissions.values():
2194 self.assertAccessAuthorized(names, self.proprietary_series)
2195
2196 # They can change all attributes.
2197- for permission, names in self.expected_set_permissions.items():
2198+ for names in self.expected_set_permissions.values():
2199 self.assertChangeAuthorized(names, self.proprietary_series)
2200
2201 with person_logged_in(self.public_product.owner):
2202- for permission, names in self.expected_get_permissions.items():
2203+ for names in self.expected_get_permissions.values():
2204 self.assertAccessAuthorized(names, self.public_series)
2205
2206 # They can change all attributes.
2207- for permission, names in self.expected_set_permissions.items():
2208+ for names in self.expected_set_permissions.values():
2209 self.assertChangeAuthorized(names, self.public_series)
2210
2211 def test_access_for_lp_admins(self):
2212 # Launchpad admins can access and change any attribute of a series
2213 # of public and private product.
2214 with celebrity_logged_in("admin"):
2215- for permission, names in self.expected_get_permissions.items():
2216+ for names in self.expected_get_permissions.values():
2217 self.assertAccessAuthorized(names, self.public_series)
2218 self.assertAccessAuthorized(names, self.proprietary_series)
2219
2220 # They can change all attributes.
2221- for permission, names in self.expected_set_permissions.items():
2222+ for names in self.expected_set_permissions.values():
2223 self.assertChangeAuthorized(names, self.public_series)
2224 self.assertChangeAuthorized(names, self.proprietary_series)
2225
2226diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py
2227index 5a5fb5b..14372cc 100644
2228--- a/lib/lp/registry/tests/test_teammembership.py
2229+++ b/lib/lp/registry/tests/test_teammembership.py
2230@@ -1539,7 +1539,7 @@ class TestCheckTeamParticipationScriptPerformance(TestCaseWithFactory):
2231 """
2232 # Create a deeply nested team and member structure.
2233 team = self.factory.makeTeam()
2234- for num in range(10):
2235+ for _ in range(10):
2236 another_team = self.factory.makeTeam()
2237 another_person = self.factory.makePerson()
2238 with person_logged_in(team.teamowner):
2239diff --git a/lib/lp/scripts/garbo.py b/lib/lp/scripts/garbo.py
2240index 06da799..d4fa136 100644
2241--- a/lib/lp/scripts/garbo.py
2242+++ b/lib/lp/scripts/garbo.py
2243@@ -1077,8 +1077,8 @@ class PersonPruner(TunableLoop):
2244 from_column,
2245 to_table,
2246 to_column,
2247- uflag,
2248- dflag,
2249+ _,
2250+ _,
2251 ) in postgresql.listReferences(cursor(), "person", "id"):
2252 # Skip things that don't link to Person.id or that link to it from
2253 # TeamParticipation or EmailAddress, as all Person entries will be
2254diff --git a/lib/lp/scripts/tests/test_garbo.py b/lib/lp/scripts/tests/test_garbo.py
2255index 3599ab1..e2bc91b 100644
2256--- a/lib/lp/scripts/tests/test_garbo.py
2257+++ b/lib/lp/scripts/tests/test_garbo.py
2258@@ -196,7 +196,7 @@ class TestBulkPruner(TestCase):
2259 self.store = IPrimaryStore(CommercialSubscription)
2260 self.store.execute("CREATE TABLE BulkFoo (id serial PRIMARY KEY)")
2261
2262- for i in range(10):
2263+ for _ in range(10):
2264 self.store.add(BulkFoo())
2265
2266 self.log = logging.getLogger("garbo")
2267@@ -1177,7 +1177,7 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
2268
2269 # Creating a bunch of old stale repositories to be deleted,
2270 # to make sure the chunk size is being respected.
2271- for i in range(5):
2272+ for _ in range(5):
2273 repo = removeSecurityProxy(self.factory.makeGitRepository())
2274 [ref1, ref2] = self.factory.makeGitRefs(
2275 repository=repo, paths=["refs/heads/a-20.04", "b"]
2276@@ -1383,7 +1383,7 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
2277 # between calls.
2278 switch_dbuser("testadmin")
2279 potmsgset_pofile = {}
2280- for n in range(4):
2281+ for _ in range(4):
2282 pofile = self.factory.makePOFile()
2283 translation_message = self.factory.makeCurrentTranslationMessage(
2284 pofile=pofile
2285@@ -2295,7 +2295,7 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
2286 report=report1, artifact_type=RevisionStatusArtifactType.BINARY
2287 )
2288 artifact1_3 = self.factory.makeRevisionStatusArtifact(report=report1)
2289- for i in range(0, 5):
2290+ for _ in range(0, 5):
2291 self.factory.makeRevisionStatusArtifact(
2292 report=report2, artifact_type=RevisionStatusArtifactType.BINARY
2293 )
2294diff --git a/lib/lp/scripts/utilities/importpedant.py b/lib/lp/scripts/utilities/importpedant.py
2295index cc9e459..342fb18 100644
2296--- a/lib/lp/scripts/utilities/importpedant.py
2297+++ b/lib/lp/scripts/utilities/importpedant.py
2298@@ -293,7 +293,7 @@ def report_naughty_imports():
2299 sorted_violations, attrgetter("name")
2300 ):
2301 print("You should not import %s into:" % name)
2302- for import_into, unused_duplicates_seq in itertools.groupby(
2303+ for import_into, _ in itertools.groupby(
2304 sequence, attrgetter("import_into")
2305 ):
2306 # Show first occurrence only, to avoid duplicates.
2307diff --git a/lib/lp/scripts/utilities/warninghandler.py b/lib/lp/scripts/utilities/warninghandler.py
2308index d5cadb3..81e805e 100644
2309--- a/lib/lp/scripts/utilities/warninghandler.py
2310+++ b/lib/lp/scripts/utilities/warninghandler.py
2311@@ -93,7 +93,7 @@ def find_important_info():
2312 important_objects = {}
2313 metadata = {} # cls -> (filename, lineno, funcname)
2314
2315- for frame, filename, lineno, func_name, context, lineidx in stack:
2316+ for frame, filename, lineno, func_name, _, _ in stack:
2317 try:
2318 if (
2319 filename.startswith("<doctest ")
2320diff --git a/lib/lp/services/database/postgresql.py b/lib/lp/services/database/postgresql.py
2321index afbfcb0..a4aa227 100644
2322--- a/lib/lp/services/database/postgresql.py
2323+++ b/lib/lp/services/database/postgresql.py
2324@@ -290,7 +290,7 @@ def check_indirect_references(references):
2325 # Sanity check. If we have an indirect reference, it must
2326 # be ON DELETE CASCADE. We only have one case of this at the moment,
2327 # but this code ensures we catch any new ones added incorrectly.
2328- for src_tab, src_col, ref_tab, ref_col, updact, delact in references:
2329+ for src_tab, src_col, ref_tab, ref_col, updact, _ in references:
2330 # If the ref_tab and ref_col is not Person.id, then we have
2331 # an indirect reference. Ensure the update action is 'CASCADE'
2332 if ref_tab != "person" and ref_col != "id":
2333diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py
2334index f604f4c..a1a34a0 100644
2335--- a/lib/lp/services/database/sqlbase.py
2336+++ b/lib/lp/services/database/sqlbase.py
2337@@ -328,7 +328,7 @@ def flush_database_updates():
2338 shorthand if you don't already have a store object handy.)
2339 """
2340 zstorm = getUtility(IZStorm)
2341- for name, store in zstorm.iterstores():
2342+ for _, store in zstorm.iterstores():
2343 store.flush()
2344
2345
2346@@ -344,7 +344,7 @@ def flush_database_caches():
2347 all reflect the values in the database.
2348 """
2349 zstorm = getUtility(IZStorm)
2350- for name, store in zstorm.iterstores():
2351+ for _, store in zstorm.iterstores():
2352 store.flush()
2353 store.invalidate()
2354
2355diff --git a/lib/lp/services/features/flags.py b/lib/lp/services/features/flags.py
2356index 4ed46ff..f15a6df 100644
2357--- a/lib/lp/services/features/flags.py
2358+++ b/lib/lp/services/features/flags.py
2359@@ -409,7 +409,7 @@ class FeatureController:
2360 def _currentValueAndScope(self, flag):
2361 self._needRules()
2362 if flag in self._rules:
2363- for scope, priority, value in self._rules[flag]:
2364+ for scope, _, value in self._rules[flag]:
2365 if self._known_scopes.lookup(scope):
2366 self._debugMessage(
2367 "feature match flag=%r value=%r scope=%r"
2368@@ -481,7 +481,7 @@ class FeatureController:
2369 """Return the flag's value in the default scope."""
2370 self._needRules()
2371 if flag in self._rules:
2372- for scope, priority, value in self._rules[flag]:
2373+ for scope, _, value in self._rules[flag]:
2374 if scope == "default":
2375 return value
2376 return None
2377diff --git a/lib/lp/services/gpg/handler.py b/lib/lp/services/gpg/handler.py
2378index 912474f..bb354e0 100644
2379--- a/lib/lp/services/gpg/handler.py
2380+++ b/lib/lp/services/gpg/handler.py
2381@@ -116,7 +116,7 @@ class GPGHandler:
2382 """See IGPGHandler."""
2383 stored_errors = []
2384
2385- for i in range(3):
2386+ for _ in range(3):
2387 try:
2388 signature = self.getVerifiedSignature(content, signature)
2389 except GPGKeyNotFoundError as info:
2390@@ -255,7 +255,7 @@ class GPGHandler:
2391 # a secret key. We can't rely on result.secret_imported here
2392 # because if there's a secret key which is already imported,
2393 # result.secret_imported will be 0.
2394- for fingerprint, res, status in result.imports:
2395+ for fingerprint, _, status in result.imports:
2396 if status & gpgme.IMPORT_SECRET != 0:
2397 raise SecretGPGKeyImportDetected(
2398 "GPG key '%s' is a secret key." % fingerprint
2399diff --git a/lib/lp/services/helpers.py b/lib/lp/services/helpers.py
2400index 0cbaf30..67128a3 100644
2401--- a/lib/lp/services/helpers.py
2402+++ b/lib/lp/services/helpers.py
2403@@ -56,7 +56,7 @@ def text_replaced(text, replacements, _cache={}):
2404 cachekey = tuple(replacements.items())
2405 if cachekey not in _cache:
2406 L = []
2407- for find, replace in sorted(
2408+ for find, _ in sorted(
2409 replacements.items(), key=lambda item: len(item[0]), reverse=True
2410 ):
2411 L.append("(%s)" % re.escape(find))
2412diff --git a/lib/lp/services/job/tests/test_celeryjob.py b/lib/lp/services/job/tests/test_celeryjob.py
2413index 5e7d199..ca2e575 100644
2414--- a/lib/lp/services/job/tests/test_celeryjob.py
2415+++ b/lib/lp/services/job/tests/test_celeryjob.py
2416@@ -47,7 +47,7 @@ class TestRunMissingJobs(TestCaseWithFactory):
2417 """
2418 from lp.services.job.celeryjob import FindMissingReady
2419
2420- for x in range(600):
2421+ for _ in range(600):
2422 find_missing = FindMissingReady(job_source)
2423 if len(find_missing.queue_contents) == expected_len:
2424 return find_missing
2425@@ -65,7 +65,7 @@ class TestRunMissingJobs(TestCaseWithFactory):
2426 """
2427 from lazr.jobrunner.celerytask import list_queued
2428
2429- for x in range(600):
2430+ for _ in range(600):
2431 actual_len = len(list_queued(app, queues))
2432 if actual_len == expected_len:
2433 return
2434diff --git a/lib/lp/services/job/tests/test_runner.py b/lib/lp/services/job/tests/test_runner.py
2435index 889f941..7f1e8f2 100644
2436--- a/lib/lp/services/job/tests/test_runner.py
2437+++ b/lib/lp/services/job/tests/test_runner.py
2438@@ -590,7 +590,7 @@ class StaticJobSource(BaseRunnableJob):
2439 @classmethod
2440 def iterReady(cls):
2441 if not cls.done:
2442- for index, args in enumerate(cls.jobs):
2443+ for index, _ in enumerate(cls.jobs):
2444 yield cls.get(index)
2445 cls.done = True
2446
2447diff --git a/lib/lp/services/librarianserver/librariangc.py b/lib/lp/services/librarianserver/librariangc.py
2448index aafd7cb..1f362e6 100644
2449--- a/lib/lp/services/librarianserver/librariangc.py
2450+++ b/lib/lp/services/librarianserver/librariangc.py
2451@@ -254,7 +254,7 @@ def merge_duplicates(con):
2452 WHERE sha1=%(sha1)s AND filesize=%(filesize)s
2453 ORDER BY datecreated DESC
2454 """,
2455- vars(),
2456+ {"sha1": sha1, "filesize": filesize},
2457 )
2458 dupes = cur.fetchall()
2459
2460@@ -268,7 +268,7 @@ def merge_duplicates(con):
2461 SELECT id, filename, mimetype FROM LibraryFileAlias
2462 WHERE content = %(dupe_id)s
2463 """,
2464- vars(),
2465+ {"dupe_id": dupe_id},
2466 )
2467 for id, filename, mimetype in cur.fetchall():
2468 log.debug3("> %d %s %s" % (id, filename, mimetype))
2469@@ -316,7 +316,7 @@ def merge_duplicates(con):
2470 UPDATE LibraryFileAlias SET content=%(prime_id)s
2471 WHERE content = %(other_id)s
2472 """,
2473- vars(),
2474+ {"other_id": other_id},
2475 )
2476 prime_count += 1
2477 dupe_count += len(dupes)
2478diff --git a/lib/lp/services/librarianserver/tests/test_db_outage.py b/lib/lp/services/librarianserver/tests/test_db_outage.py
2479index 023db40..7329243 100644
2480--- a/lib/lp/services/librarianserver/tests/test_db_outage.py
2481+++ b/lib/lp/services/librarianserver/tests/test_db_outage.py
2482@@ -84,7 +84,7 @@ class TestLibrarianDBOutage(TestCase):
2483 # connections are in use.
2484 num_librarian_threads = 20
2485 codes = set()
2486- for count in range(num_librarian_threads):
2487+ for _ in range(num_librarian_threads):
2488 try:
2489 urlopen(self.url).read()
2490 codes.add(200)
2491diff --git a/lib/lp/services/librarianserver/tests/test_swift.py b/lib/lp/services/librarianserver/tests/test_swift.py
2492index 9e095dd..673bd52 100644
2493--- a/lib/lp/services/librarianserver/tests/test_swift.py
2494+++ b/lib/lp/services/librarianserver/tests/test_swift.py
2495@@ -196,7 +196,7 @@ class TestFeedSwift(TestCase):
2496
2497 old_swift_client = old_swift_fixture.connect()
2498 try:
2499- for lfc, contents in zip(self.lfcs, self.contents):
2500+ for lfc, _ in zip(self.lfcs, self.contents):
2501 container, name = swift.swift_location(lfc.id)
2502 self.assertRaises(
2503 swiftclient.ClientException,
2504diff --git a/lib/lp/services/mail/tests/test_mailbox.py b/lib/lp/services/mail/tests/test_mailbox.py
2505index 08bdfbe..7532680 100644
2506--- a/lib/lp/services/mail/tests/test_mailbox.py
2507+++ b/lib/lp/services/mail/tests/test_mailbox.py
2508@@ -58,6 +58,6 @@ class TestDirectoryMailBox(TestCase):
2509 self._add_mailfile("bar", "More content")
2510 self._add_mailfile("baz", "More content")
2511 box = DirectoryMailBox(self.email_dir)
2512- for id, content in box.items():
2513+ for id, _ in box.items():
2514 box.delete(id)
2515 self.assertEqual(0, len(list(box.items())))
2516diff --git a/lib/lp/services/oauth/tests/test_tokens.py b/lib/lp/services/oauth/tests/test_tokens.py
2517index ab69dcb..ad1d4ea 100644
2518--- a/lib/lp/services/oauth/tests/test_tokens.py
2519+++ b/lib/lp/services/oauth/tests/test_tokens.py
2520@@ -258,7 +258,7 @@ class TestRequestTokens(TestOAuth):
2521 """It's possible to get a person's request tokens."""
2522 person = self.factory.makePerson()
2523 self.assertEqual(person.oauth_request_tokens.count(), 0)
2524- for i in range(0, 3):
2525+ for _ in range(0, 3):
2526 self.factory.makeOAuthRequestToken(reviewed_by=person)
2527 self.assertEqual(person.oauth_request_tokens.count(), 3)
2528
2529@@ -389,7 +389,7 @@ class TestAccessTokens(TestOAuth):
2530 """It's possible to get a person's access tokens."""
2531 person = self.factory.makePerson()
2532 self.assertEqual(person.oauth_access_tokens.count(), 0)
2533- for i in range(0, 3):
2534+ for _ in range(0, 3):
2535 self.factory.makeOAuthAccessToken(self.consumer, person)
2536 self.assertEqual(person.oauth_access_tokens.count(), 3)
2537
2538diff --git a/lib/lp/services/osutils.py b/lib/lp/services/osutils.py
2539index 1a2e78a..5472b79 100644
2540--- a/lib/lp/services/osutils.py
2541+++ b/lib/lp/services/osutils.py
2542@@ -112,7 +112,7 @@ def two_stage_kill(pid, poll_interval=0.1, num_polls=50, get_status=True):
2543 _kill_may_race(pid, SIGTERM)
2544
2545 # Poll until the process has ended.
2546- for i in range(num_polls):
2547+ for _ in range(num_polls):
2548 try:
2549 if get_status:
2550 # Reap the child process and get its return value. If it's
2551diff --git a/lib/lp/services/profile/profile.py b/lib/lp/services/profile/profile.py
2552index 8d22f5b..7c7cd4b 100644
2553--- a/lib/lp/services/profile/profile.py
2554+++ b/lib/lp/services/profile/profile.py
2555@@ -498,7 +498,7 @@ def end_request(event):
2556 triggers.items(), key=lambda x: len(x[1]), reverse=True
2557 )
2558 top_triggers = []
2559- for key, ixs in triggers:
2560+ for _, ixs in triggers:
2561 if len(ixs) == 1:
2562 break
2563 info = trace[ixs[0] - 1]["app_stack"][-1].copy()
2564@@ -649,7 +649,7 @@ def _make_condition_function(condition_string):
2565 conditions = []
2566 included = []
2567 ignored = []
2568- for constraint, partition, value in (
2569+ for constraint, _, value in (
2570 c.strip().partition(" ") for c in condition_string.upper().split("|")
2571 ):
2572 # Process each condition.
2573diff --git a/lib/lp/services/profile/tests.py b/lib/lp/services/profile/tests.py
2574index 0b9019f..b34aa7e 100644
2575--- a/lib/lp/services/profile/tests.py
2576+++ b/lib/lp/services/profile/tests.py
2577@@ -741,7 +741,7 @@ class TestBeforeTraverseHandler(TestCleanupProfiler):
2578 class TestInlineProfiling(BaseRequestEndHandlerTest):
2579 def make_work(self, count=1):
2580 def work():
2581- for i in range(count):
2582+ for _ in range(count):
2583 profile.start()
2584 random.random()
2585 profile.stop()
2586diff --git a/lib/lp/services/scripts/tests/__init__.py b/lib/lp/services/scripts/tests/__init__.py
2587index 7bcea71..1f50deb 100644
2588--- a/lib/lp/services/scripts/tests/__init__.py
2589+++ b/lib/lp/services/scripts/tests/__init__.py
2590@@ -28,7 +28,7 @@ def find_lp_scripts():
2591 scripts = []
2592 for script_location in SCRIPT_LOCATIONS:
2593 location = os.path.join(LP_TREE, script_location)
2594- for path, dirs, filenames in os.walk(location):
2595+ for path, _, filenames in os.walk(location):
2596 for filename in filenames:
2597 script_path = os.path.join(path, filename)
2598 if filename.startswith("_") or not filename.endswith(".py"):
2599diff --git a/lib/lp/services/spriteutils.py b/lib/lp/services/spriteutils.py
2600index e1f9e06..9dd1db4 100644
2601--- a/lib/lp/services/spriteutils.py
2602+++ b/lib/lp/services/spriteutils.py
2603@@ -193,7 +193,7 @@ class SpriteUtil:
2604 # Paste each sprite into the combined image.
2605 y = 0
2606 positions = {}
2607- for index, sprite in enumerate(self.sprite_info):
2608+ for sprite in self.sprite_info:
2609 sprite_image = sprite_images[sprite["filename"]]
2610 try:
2611 position = [0, y]
2612diff --git a/lib/lp/services/stacktrace.py b/lib/lp/services/stacktrace.py
2613index 369c65e..dce2786 100644
2614--- a/lib/lp/services/stacktrace.py
2615+++ b/lib/lp/services/stacktrace.py
2616@@ -68,7 +68,7 @@ def format_list(extracted_list):
2617 whose source text line or supplement or info are not None.
2618 """
2619 list = []
2620- for filename, lineno, name, line, modname, supp, info in extracted_list:
2621+ for filename, lineno, name, line, _, supp, info in extracted_list:
2622 item = []
2623 item.append(' File "%s", line %d, in %s' % (filename, lineno, name))
2624 if line:
2625diff --git a/lib/lp/services/testing/__init__.py b/lib/lp/services/testing/__init__.py
2626index 6389963..b296875 100644
2627--- a/lib/lp/services/testing/__init__.py
2628+++ b/lib/lp/services/testing/__init__.py
2629@@ -122,7 +122,7 @@ def build_test_suite(
2630 )
2631
2632 # Add the special doctests.
2633- for key, special_suite in sorted(special_tests.items()):
2634+ for _, special_suite in sorted(special_tests.items()):
2635 suite.addTest(special_suite)
2636
2637 tests_path = os.path.join(os.path.pardir, "doc")
2638diff --git a/lib/lp/services/testing/parallel.py b/lib/lp/services/testing/parallel.py
2639index 4b7e078..063104f 100644
2640--- a/lib/lp/services/testing/parallel.py
2641+++ b/lib/lp/services/testing/parallel.py
2642@@ -21,7 +21,7 @@ def prepare_argv(argv):
2643 """Remove options from argv that would be added by ListTestCase."""
2644 result = []
2645 skipn = 0
2646- for pos, arg in enumerate(argv):
2647+ for arg in argv:
2648 if skipn:
2649 skipn -= 1
2650 continue
2651diff --git a/lib/lp/services/testing/tests/test_customresult.py b/lib/lp/services/testing/tests/test_customresult.py
2652index 378da0a..3c1023a 100644
2653--- a/lib/lp/services/testing/tests/test_customresult.py
2654+++ b/lib/lp/services/testing/tests/test_customresult.py
2655@@ -60,7 +60,7 @@ class TestFilterTests(TestCase):
2656 suite = unittest.TestSuite()
2657 for t in testnames:
2658 # Each test will be repeated equal to the number represented.
2659- for i in range(int(t)):
2660+ for _ in range(int(t)):
2661 suite.addTest(FakeTestCase(t))
2662 return suite
2663
2664diff --git a/lib/lp/services/tests/test_command_spawner.py b/lib/lp/services/tests/test_command_spawner.py
2665index 4c5df5e..1a869c9 100644
2666--- a/lib/lp/services/tests/test_command_spawner.py
2667+++ b/lib/lp/services/tests/test_command_spawner.py
2668@@ -271,7 +271,7 @@ class TestCommandSpawnerAcceptance(TestCase):
2669
2670 processes = 10
2671 seconds = 0.2
2672- for counter in range(processes):
2673+ for _ in range(processes):
2674 spawner.start(["/bin/sleep", str(seconds)])
2675
2676 before = datetime.now(timezone.utc)
2677diff --git a/lib/lp/services/tests/test_timeout.py b/lib/lp/services/tests/test_timeout.py
2678index ade63eb..017aa1c 100644
2679--- a/lib/lp/services/tests/test_timeout.py
2680+++ b/lib/lp/services/tests/test_timeout.py
2681@@ -62,7 +62,7 @@ class MySimpleXMLRPCServer(xmlrpc.server.SimpleXMLRPCServer):
2682 allow_reuse_address = True
2683
2684 def serve_2_requests(self):
2685- for i in range(2):
2686+ for _ in range(2):
2687 self.handle_request()
2688 self.server_close()
2689
2690diff --git a/lib/lp/services/twistedsupport/tests/test_task.py b/lib/lp/services/twistedsupport/tests/test_task.py
2691index e4a44d4..3756f81 100644
2692--- a/lib/lp/services/twistedsupport/tests/test_task.py
2693+++ b/lib/lp/services/twistedsupport/tests/test_task.py
2694@@ -591,7 +591,7 @@ class TestParallelLimitedTaskConsumer(TestCase):
2695 del log[:]
2696 consumer.taskStarted(self._neverEndingTask)
2697 self.assertEqual(0, log.count("stop"))
2698- for i in range(worker_limit - 1):
2699+ for _ in range(worker_limit - 1):
2700 consumer.taskStarted(self._neverEndingTask)
2701 self.assertEqual(1, log.count("stop"))
2702
2703diff --git a/lib/lp/services/webapp/metazcml.py b/lib/lp/services/webapp/metazcml.py
2704index f47d3e2..9eb6130 100644
2705--- a/lib/lp/services/webapp/metazcml.py
2706+++ b/lib/lp/services/webapp/metazcml.py
2707@@ -73,7 +73,7 @@ def authorizations(_context, module):
2708 "module attribute must be a module: %s, %s" % module, type(module)
2709 )
2710 provides = IAuthorization
2711- for nameinmodule, authorization in inspect.getmembers(
2712+ for _, authorization in inspect.getmembers(
2713 module, lambda member: _isAuthorization(module, member)
2714 ):
2715 if (
2716diff --git a/lib/lp/services/webapp/publisher.py b/lib/lp/services/webapp/publisher.py
2717index bf64b0d..c45cfed 100644
2718--- a/lib/lp/services/webapp/publisher.py
2719+++ b/lib/lp/services/webapp/publisher.py
2720@@ -535,14 +535,7 @@ class LaunchpadView(UserAttributeCache):
2721 from lp.services.features.flags import flag_info
2722
2723 beta_info = {}
2724- for (
2725- flag_name,
2726- value_domain,
2727- documentation,
2728- default_behaviour,
2729- title,
2730- url,
2731- ) in flag_info:
2732+ for flag_name, _, _, _, title, url in flag_info:
2733 if flag_name not in self.related_features:
2734 continue
2735 # A feature is always in beta if it's not enabled for
2736diff --git a/lib/lp/services/webapp/tests/test_batching.py b/lib/lp/services/webapp/tests/test_batching.py
2737index 74978f1..bd3430d 100644
2738--- a/lib/lp/services/webapp/tests/test_batching.py
2739+++ b/lib/lp/services/webapp/tests/test_batching.py
2740@@ -37,7 +37,7 @@ class TestStormRangeFactory(TestCaseWithFactory):
2741
2742 def makeStormResultSet(self):
2743 bug = self.factory.makeBug()
2744- for count in range(5):
2745+ for _ in range(5):
2746 person = self.factory.makePerson()
2747 with person_logged_in(person):
2748 bug.markUserAffected(person, True)
2749@@ -46,7 +46,7 @@ class TestStormRangeFactory(TestCaseWithFactory):
2750 def makeDecoratedStormResultSet(self):
2751 bug = self.factory.makeBug()
2752 with person_logged_in(bug.owner):
2753- for count in range(5):
2754+ for _ in range(5):
2755 self.factory.makeBugAttachment(bug=bug, owner=bug.owner)
2756 result = bug.attachments
2757 self.assertTrue(zope_isinstance(result, DecoratedResultSet))
2758@@ -619,7 +619,7 @@ class TestStormRangeFactory(TestCaseWithFactory):
2759 with person_logged_in(bug.owner):
2760 for filename in ("file-a", "file-b"):
2761 for content_type in ("text/a", "text/b"):
2762- for count in range(2):
2763+ for _ in range(2):
2764 self.factory.makeBugAttachment(
2765 bug=bug,
2766 owner=bug.owner,
2767diff --git a/lib/lp/services/webapp/tests/test_error.py b/lib/lp/services/webapp/tests/test_error.py
2768index ee15ed4..dfa0290 100644
2769--- a/lib/lp/services/webapp/tests/test_error.py
2770+++ b/lib/lp/services/webapp/tests/test_error.py
2771@@ -98,7 +98,7 @@ class TestDatabaseErrorViews(TestCase):
2772 Raise a TimeoutException if the connection cannot be established.
2773 """
2774 browser = Browser()
2775- for i in range(retries):
2776+ for _ in range(retries):
2777 try:
2778 browser.open(url)
2779 return
2780diff --git a/lib/lp/services/webhooks/model.py b/lib/lp/services/webhooks/model.py
2781index 5db81e2..a3d6503 100644
2782--- a/lib/lp/services/webhooks/model.py
2783+++ b/lib/lp/services/webhooks/model.py
2784@@ -584,7 +584,7 @@ class WebhookDeliveryJob(WebhookJobDerived):
2785 @memoize
2786 def _get_broadcast_addresses(cls):
2787 addrs = []
2788- for net, addresses in psutil.net_if_addrs().items():
2789+ for addresses in psutil.net_if_addrs().values():
2790 for i in addresses:
2791 try:
2792 addrs.append(ipaddress.ip_address(str(i.broadcast)))
2793diff --git a/lib/lp/services/webservice/tests/test_wadllib.py b/lib/lp/services/webservice/tests/test_wadllib.py
2794index 1320d9b..e2d73b3 100644
2795--- a/lib/lp/services/webservice/tests/test_wadllib.py
2796+++ b/lib/lp/services/webservice/tests/test_wadllib.py
2797@@ -20,7 +20,7 @@ def test_suite():
2798
2799 # Find all the doctests in wadllib.
2800 packages = []
2801- for dirpath, dirnames, filenames in os.walk(topdir):
2802+ for dirpath, dirnames, _ in os.walk(topdir):
2803 if "docs" in dirnames:
2804 docsdir = os.path.join(dirpath, "docs")[len(topdir) + 1 :]
2805 packages.append(docsdir)
2806diff --git a/lib/lp/services/worlddata/tests/test_language.py b/lib/lp/services/worlddata/tests/test_language.py
2807index e98b522..407487a 100644
2808--- a/lib/lp/services/worlddata/tests/test_language.py
2809+++ b/lib/lp/services/worlddata/tests/test_language.py
2810@@ -46,7 +46,7 @@ class TestTranslatorsCounts(TestCaseWithFactory):
2811 super().setUp()
2812 self.translated_lang = self.factory.makeLanguage(pluralforms=None)
2813 self.untranslated_lang = self.factory.makeLanguage(pluralforms=None)
2814- for i in range(3):
2815+ for _ in range(3):
2816 translator = self.factory.makePerson()
2817 translator.addLanguage(self.translated_lang)
2818 with dbuser("karma"):
2819diff --git a/lib/lp/snappy/tests/test_snap.py b/lib/lp/snappy/tests/test_snap.py
2820index 253a91d..5acd69f 100644
2821--- a/lib/lp/snappy/tests/test_snap.py
2822+++ b/lib/lp/snappy/tests/test_snap.py
2823@@ -2463,7 +2463,7 @@ class TestSnapSet(TestCaseWithFactory):
2824 owners = [self.factory.makePerson() for i in range(2)]
2825 snaps = []
2826 for owner in owners:
2827- for i in range(2):
2828+ for _ in range(2):
2829 snaps.append(
2830 self.factory.makeSnap(registrant=owner, owner=owner)
2831 )
2832@@ -2560,7 +2560,7 @@ class TestSnapSet(TestCaseWithFactory):
2833 branches = [self.factory.makeAnyBranch() for i in range(2)]
2834 snaps = []
2835 for branch in branches:
2836- for i in range(2):
2837+ for _ in range(2):
2838 snaps.append(self.factory.makeSnap(branch=branch))
2839 snap_set = getUtility(ISnapSet)
2840 self.assertContentEqual(snaps[:2], snap_set.findByBranch(branches[0]))
2841@@ -2572,7 +2572,7 @@ class TestSnapSet(TestCaseWithFactory):
2842 repositories = [self.factory.makeGitRepository() for i in range(2)]
2843 snaps = []
2844 for repository in repositories:
2845- for i in range(2):
2846+ for _ in range(2):
2847 [ref] = self.factory.makeGitRefs(repository=repository)
2848 snaps.append(self.factory.makeSnap(git_ref=ref))
2849 snap_set = getUtility(ISnapSet)
2850@@ -2588,7 +2588,7 @@ class TestSnapSet(TestCaseWithFactory):
2851 repositories = [self.factory.makeGitRepository() for i in range(2)]
2852 snaps = []
2853 for repository in repositories:
2854- for i in range(3):
2855+ for _ in range(3):
2856 [ref] = self.factory.makeGitRefs(repository=repository)
2857 snaps.append(self.factory.makeSnap(git_ref=ref))
2858 snap_set = getUtility(ISnapSet)
2859@@ -2615,7 +2615,7 @@ class TestSnapSet(TestCaseWithFactory):
2860 repositories = [self.factory.makeGitRepository() for i in range(2)]
2861 refs = []
2862 snaps = []
2863- for repository in repositories:
2864+ for _ in repositories:
2865 refs.extend(
2866 self.factory.makeGitRefs(
2867 paths=["refs/heads/master", "refs/heads/other"]
2868@@ -3403,7 +3403,7 @@ class TestSnapSet(TestCaseWithFactory):
2869 branches = [self.factory.makeAnyBranch() for i in range(2)]
2870 snaps = []
2871 for branch in branches:
2872- for i in range(2):
2873+ for _ in range(2):
2874 snaps.append(
2875 self.factory.makeSnap(
2876 branch=branch, date_created=ONE_DAY_AGO
2877@@ -3427,7 +3427,7 @@ class TestSnapSet(TestCaseWithFactory):
2878 paths = []
2879 refs = []
2880 for repository in repositories:
2881- for i in range(2):
2882+ for _ in range(2):
2883 [ref] = self.factory.makeGitRefs(repository=repository)
2884 paths.append(ref.path)
2885 refs.append(ref)
2886diff --git a/lib/lp/snappy/tests/test_snapbuild.py b/lib/lp/snappy/tests/test_snapbuild.py
2887index 678d6e9..d8b7758 100644
2888--- a/lib/lp/snappy/tests/test_snapbuild.py
2889+++ b/lib/lp/snappy/tests/test_snapbuild.py
2890@@ -279,7 +279,7 @@ class TestSnapBuild(TestCaseWithFactory):
2891 status=BuildStatus.FULLYBUILT,
2892 duration=timedelta(seconds=335),
2893 )
2894- for i in range(3):
2895+ for _ in range(3):
2896 self.factory.makeSnapBuild(
2897 requester=self.build.requester,
2898 snap=self.build.snap,
2899diff --git a/lib/lp/soyuz/adapters/tests/test_overrides.py b/lib/lp/soyuz/adapters/tests/test_overrides.py
2900index 5b1c24c..4599b51 100644
2901--- a/lib/lp/soyuz/adapters/tests/test_overrides.py
2902+++ b/lib/lp/soyuz/adapters/tests/test_overrides.py
2903@@ -175,7 +175,7 @@ class TestFromExistingOverridePolicy(TestCaseWithFactory):
2904 spns = []
2905 distroseries = self.factory.makeDistroSeries()
2906 pocket = self.factory.getAnyPocket()
2907- for i in range(10):
2908+ for _ in range(10):
2909 spph = self.factory.makeSourcePackagePublishingHistory(
2910 distroseries=distroseries,
2911 archive=distroseries.main_archive,
2912@@ -473,7 +473,7 @@ class TestFromExistingOverridePolicy(TestCaseWithFactory):
2913 distroseries = distroarchseries.distroseries
2914 distroseries.nominatedarchindep = distroarchseries
2915 pocket = self.factory.getAnyPocket()
2916- for i in range(10):
2917+ for _ in range(10):
2918 bpph = self.factory.makeBinaryPackagePublishingHistory(
2919 distroarchseries=distroarchseries,
2920 archive=distroseries.main_archive,
2921@@ -690,7 +690,7 @@ class TestFallbackOverridePolicy(TestCaseWithFactory):
2922 expected = {spns[0]: SourceOverride(component=universe, new=True)}
2923 distroseries = self.factory.makeDistroSeries()
2924 pocket = self.factory.getAnyPocket()
2925- for i in range(8):
2926+ for _ in range(8):
2927 spph = self.factory.makeSourcePackagePublishingHistory(
2928 distroseries=distroseries,
2929 archive=distroseries.main_archive,
2930@@ -732,7 +732,7 @@ class TestFallbackOverridePolicy(TestCaseWithFactory):
2931 bpn = self.factory.makeBinaryPackageName()
2932 bpns = []
2933 expected = {}
2934- for i in range(3):
2935+ for _ in range(3):
2936 distroarchseries = self.factory.makeDistroArchSeries(
2937 distroseries=distroseries
2938 )
2939@@ -756,7 +756,7 @@ class TestFallbackOverridePolicy(TestCaseWithFactory):
2940 new=False,
2941 version=bpph.binarypackagerelease.version,
2942 )
2943- for i in range(2):
2944+ for _ in range(2):
2945 distroarchseries = self.factory.makeDistroArchSeries(
2946 distroseries=distroseries
2947 )
2948diff --git a/lib/lp/soyuz/browser/tests/test_archive_packages.py b/lib/lp/soyuz/browser/tests/test_archive_packages.py
2949index 81b9586..3f53639 100644
2950--- a/lib/lp/soyuz/browser/tests/test_archive_packages.py
2951+++ b/lib/lp/soyuz/browser/tests/test_archive_packages.py
2952@@ -313,7 +313,7 @@ class TestPPAPackages(TestCaseWithFactory):
2953 viewer = self.factory.makePerson()
2954 browser = self.getUserBrowser(user=viewer)
2955 with person_logged_in(viewer):
2956- for i in range(2):
2957+ for _ in range(2):
2958 pkg = self.factory.makeSourcePackagePublishingHistory(
2959 archive=ppa
2960 )
2961@@ -350,7 +350,7 @@ class TestPPAPackages(TestCaseWithFactory):
2962 viewer = self.factory.makePerson()
2963 browser = self.getUserBrowser(user=viewer)
2964 with person_logged_in(viewer):
2965- for i in range(3):
2966+ for _ in range(3):
2967 pkg = self.factory.makeBinaryPackagePublishingHistory(
2968 archive=ppa, distroarchseries=pkg.distroarchseries
2969 )
2970diff --git a/lib/lp/soyuz/browser/tests/test_archivesubscription.py b/lib/lp/soyuz/browser/tests/test_archivesubscription.py
2971index 81b059b..97fe238 100644
2972--- a/lib/lp/soyuz/browser/tests/test_archivesubscription.py
2973+++ b/lib/lp/soyuz/browser/tests/test_archivesubscription.py
2974@@ -34,7 +34,7 @@ class TestArchiveSubscribersView(TestCaseWithFactory):
2975 owner=self.p3a_owner, private=True, name="p3a"
2976 )
2977 with person_logged_in(self.p3a_owner):
2978- for count in range(3):
2979+ for _ in range(3):
2980 subscriber = self.factory.makePerson()
2981 self.private_ppa.newSubscription(subscriber, self.p3a_owner)
2982
2983diff --git a/lib/lp/soyuz/browser/tests/test_build_views.py b/lib/lp/soyuz/browser/tests/test_build_views.py
2984index 7b9390c..efab0ea 100644
2985--- a/lib/lp/soyuz/browser/tests/test_build_views.py
2986+++ b/lib/lp/soyuz/browser/tests/test_build_views.py
2987@@ -349,7 +349,7 @@ class TestBuildViews(TestCaseWithFactory):
2988 # The BuildRecordsView can also be used to filter by architecture tag.
2989 distroseries = self.factory.makeDistroSeries()
2990 arch_list = []
2991- for i in range(5):
2992+ for _ in range(5):
2993 das = self.factory.makeDistroArchSeries(distroseries=distroseries)
2994 arch_list.append(das.architecturetag)
2995 build = self.factory.makeBinaryPackageBuild(
2996diff --git a/lib/lp/soyuz/browser/tests/test_queue.py b/lib/lp/soyuz/browser/tests/test_queue.py
2997index 865df31..b95be3a 100644
2998--- a/lib/lp/soyuz/browser/tests/test_queue.py
2999+++ b/lib/lp/soyuz/browser/tests/test_queue.py
3000@@ -477,7 +477,7 @@ class TestQueueItemsView(TestCaseWithFactory):
3001 dsc = self.factory.makeLibraryFileAlias(filename="foo_0.1.dsc")
3002 deb = self.factory.makeLibraryFileAlias(filename="foo.deb")
3003 transaction.commit()
3004- for i in range(5):
3005+ for _ in range(5):
3006 uploads.append(self.factory.makeSourcePackageUpload(distroseries))
3007 sprs.append(uploads[-1].sources[0].sourcepackagerelease)
3008 sprs[-1].addFile(dsc)
3009@@ -504,7 +504,7 @@ class TestQueueItemsView(TestCaseWithFactory):
3010 )
3011 for i in (0, 2, 3):
3012 self.factory.makePackageDiff(to_source=sprs[i])
3013- for i in range(15):
3014+ for _ in range(15):
3015 uploads.append(self.factory.makeBuildPackageUpload(distroseries))
3016 uploads[-1].builds[0].build.binarypackages[0].addFile(deb)
3017 queue_admin = self.factory.makeArchiveAdmin(distroseries.main_archive)
3018@@ -520,7 +520,7 @@ class TestQueueItemsView(TestCaseWithFactory):
3019 uploads = []
3020 distroseries = self.factory.makeDistroSeries()
3021
3022- for i in range(11):
3023+ for _ in range(11):
3024 uploads.append(self.factory.makeSourcePackageUpload(distroseries))
3025 queue_admin = self.factory.makeArchiveAdmin(distroseries.main_archive)
3026
3027diff --git a/lib/lp/soyuz/model/distroseriespackagecache.py b/lib/lp/soyuz/model/distroseriespackagecache.py
3028index 45a4692..7ed84b6 100644
3029--- a/lib/lp/soyuz/model/distroseriespackagecache.py
3030+++ b/lib/lp/soyuz/model/distroseriespackagecache.py
3031@@ -186,7 +186,7 @@ class DistroSeriesPackageCache(StormBase):
3032 return
3033
3034 details_map = defaultdict(list)
3035- for bpn_id, summary, description, datecreated in all_details:
3036+ for bpn_id, summary, description, _ in all_details:
3037 bpn = IStore(BinaryPackageName).get(BinaryPackageName, bpn_id)
3038 details_map[bpn].append((summary, description))
3039
3040diff --git a/lib/lp/soyuz/scripts/tests/test_copypackage.py b/lib/lp/soyuz/scripts/tests/test_copypackage.py
3041index e4ad931..5110e4d 100644
3042--- a/lib/lp/soyuz/scripts/tests/test_copypackage.py
3043+++ b/lib/lp/soyuz/scripts/tests/test_copypackage.py
3044@@ -510,7 +510,7 @@ class CopyCheckerQueries(TestCaseWithFactory, CopyCheckerHarness):
3045
3046 def _setupSources(self, nb_of_sources):
3047 sources = []
3048- for i in range(nb_of_sources):
3049+ for _ in range(nb_of_sources):
3050 source = self.test_publisher.getPubSource(
3051 version="%d" % self.factory.getUniqueInteger(),
3052 sourcename="name-%d" % self.factory.getUniqueInteger(),
3053diff --git a/lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py b/lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py
3054index 7d98ed4..8aed2a4 100644
3055--- a/lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py
3056+++ b/lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py
3057@@ -237,7 +237,7 @@ class TestCustomUploadsCopier(TestCaseWithFactory, CommonTestHelpers):
3058 # XXX JeroenVermeulen 2011-08-17, bug=827967: Should compare by
3059 # Debian version string, not id.
3060 source_series = self.factory.makeDistroSeries()
3061- for counter in range(5):
3062+ for _ in range(5):
3063 self.makeUpload(source_series)
3064 copier = CustomUploadsCopier(FakeDistroSeries())
3065 candidate_ids = [
3066diff --git a/lib/lp/soyuz/tests/test_archive.py b/lib/lp/soyuz/tests/test_archive.py
3067index 5c17662..68134c5 100644
3068--- a/lib/lp/soyuz/tests/test_archive.py
3069+++ b/lib/lp/soyuz/tests/test_archive.py
3070@@ -153,7 +153,7 @@ class TestGetPublicationsInArchive(TestCaseWithFactory):
3071 def makeArchivesForOneDistribution(self, count=3):
3072 distribution = self.factory.makeDistribution()
3073 archives = []
3074- for i in range(count):
3075+ for _ in range(count):
3076 archives.append(
3077 self.factory.makeArchive(distribution=distribution)
3078 )
3079@@ -3854,7 +3854,7 @@ class TestGetPublishedSourcesWebService(TestCaseWithFactory):
3080 # 'addSource' to a `PackageUpload` ('launchpad.Edit'). It seems
3081 # too restrive to me.
3082 with person_logged_in(ppa.owner):
3083- for i in range(5):
3084+ for _ in range(5):
3085 upload = self.factory.makePackageUpload(
3086 distroseries=distroseries, archive=ppa
3087 )
3088diff --git a/lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py b/lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py
3089index 1140263..e4bacd3 100644
3090--- a/lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py
3091+++ b/lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py
3092@@ -148,7 +148,7 @@ class TestDistributionSourcePackageRelease(TestCaseWithFactory):
3093 self.assertThat(recorder, HasQueryCount(LessThan(5)))
3094 self.assertEqual(1, self.dsp_release.sample_binary_packages.count())
3095
3096- for iteration in range(5):
3097+ for _ in range(5):
3098 self.makeBinaryPackageRelease()
3099 self.updatePackageCache()
3100 with StormStatementRecorder() as recorder:
3101@@ -161,7 +161,7 @@ class TestDistributionSourcePackageRelease(TestCaseWithFactory):
3102 # DistributionSourcePackageRelease objects do not try to
3103 # retrieve DistroSeriesPackageCache records if they know
3104 # that such records do not exist.
3105- for iteration in range(5):
3106+ for _ in range(5):
3107 self.makeBinaryPackageRelease()
3108 with StormStatementRecorder() as recorder:
3109 for ds_package in self.dsp_release.sample_binary_packages:
3110diff --git a/lib/lp/soyuz/tests/test_distroseriesdifferencejob.py b/lib/lp/soyuz/tests/test_distroseriesdifferencejob.py
3111index c6ce705..27ac653 100644
3112--- a/lib/lp/soyuz/tests/test_distroseriesdifferencejob.py
3113+++ b/lib/lp/soyuz/tests/test_distroseriesdifferencejob.py
3114@@ -163,7 +163,7 @@ class TestDistroSeriesDifferenceJobSource(TestCaseWithFactory):
3115
3116 def createSPPHs(self, derived_series, nb_spph=10):
3117 res_spph = []
3118- for i in range(nb_spph):
3119+ for _ in range(nb_spph):
3120 packagename = self.factory.makeSourcePackageName()
3121 spph = self.factory.makeSourcePackagePublishingHistory(
3122 sourcepackagename=packagename,
3123@@ -455,7 +455,7 @@ class TestDistroSeriesDifferenceJobSource(TestCaseWithFactory):
3124 spn = spph.sourcepackagerelease.sourcepackagename
3125
3126 create_jobs = list(range(1, 3))
3127- for counter in create_jobs:
3128+ for _ in create_jobs:
3129 self.getJobSource().createForSPPHs([spph])
3130
3131 job_count = len(
3132diff --git a/lib/lp/soyuz/tests/test_livefs.py b/lib/lp/soyuz/tests/test_livefs.py
3133index 7f98b2f..55578b0 100644
3134--- a/lib/lp/soyuz/tests/test_livefs.py
3135+++ b/lib/lp/soyuz/tests/test_livefs.py
3136@@ -624,7 +624,7 @@ class TestLiveFSSet(TestCaseWithFactory):
3137 owners = [self.factory.makePerson() for i in range(2)]
3138 livefses = []
3139 for owner in owners:
3140- for i in range(2):
3141+ for _ in range(2):
3142 livefses.append(
3143 self.factory.makeLiveFS(registrant=owner, owner=owner)
3144 )
3145diff --git a/lib/lp/soyuz/tests/test_livefsbuild.py b/lib/lp/soyuz/tests/test_livefsbuild.py
3146index f3b5cac..9b62712 100644
3147--- a/lib/lp/soyuz/tests/test_livefsbuild.py
3148+++ b/lib/lp/soyuz/tests/test_livefsbuild.py
3149@@ -284,7 +284,7 @@ class TestLiveFSBuild(TestCaseWithFactory):
3150 status=BuildStatus.FULLYBUILT,
3151 duration=timedelta(seconds=335),
3152 )
3153- for i in range(3):
3154+ for _ in range(3):
3155 self.factory.makeLiveFSBuild(
3156 requester=self.build.requester,
3157 livefs=self.build.livefs,
3158diff --git a/lib/lp/soyuz/tests/test_packagecopyjob.py b/lib/lp/soyuz/tests/test_packagecopyjob.py
3159index 586c1b8..3716d63 100644
3160--- a/lib/lp/soyuz/tests/test_packagecopyjob.py
3161+++ b/lib/lp/soyuz/tests/test_packagecopyjob.py
3162@@ -640,7 +640,7 @@ class PlainPackageCopyJobTests(TestCaseWithFactory, LocalTestHelper):
3163 def test_iterReady_preempt(self):
3164 # Ordinary ("insecure") copy jobs that arrive in the middle of a
3165 # long mass-sync run take precedence immediately.
3166- for i in range(2):
3167+ for _ in range(2):
3168 self.makeJob(copy_policy=PackageCopyPolicy.MASS_SYNC)
3169 iterator = getUtility(IPlainPackageCopyJobSource).iterReady()
3170 self.assertEqual(
3171diff --git a/lib/lp/soyuz/tests/test_processacceptedbugsjob.py b/lib/lp/soyuz/tests/test_processacceptedbugsjob.py
3172index 3716886..4a0e339 100644
3173--- a/lib/lp/soyuz/tests/test_processacceptedbugsjob.py
3174+++ b/lib/lp/soyuz/tests/test_processacceptedbugsjob.py
3175@@ -138,7 +138,7 @@ class TestClosingBugs(TestCaseWithFactory):
3176 # Make 4 bugs and corresponding bugtasks and put them in an array
3177 # as tuples.
3178 bugs = []
3179- for i in range(6):
3180+ for _ in range(6):
3181 if target_series is None:
3182 target_series = spr.upload_distroseries
3183 target = target_series.getSourcePackage(spr.sourcepackagename)
3184@@ -228,7 +228,7 @@ class TestClosingBugs(TestCaseWithFactory):
3185
3186 close_bugs_for_sourcepublication(target_spph, since_version="1.0")
3187
3188- for bug, bugtask in bugs:
3189+ for _, bugtask in bugs:
3190 self.assertEqual(BugTaskStatus.FIXRELEASED, bugtask.status)
3191
3192
3193diff --git a/lib/lp/soyuz/tests/test_publishing.py b/lib/lp/soyuz/tests/test_publishing.py
3194index 20638b1..00ccd25 100644
3195--- a/lib/lp/soyuz/tests/test_publishing.py
3196+++ b/lib/lp/soyuz/tests/test_publishing.py
3197@@ -668,7 +668,7 @@ class SoyuzTestPublisher:
3198
3199 def _findChangesFile(self, top, name_fragment):
3200 """File with given name fragment in directory tree starting at top."""
3201- for root, dirs, files in os.walk(top, topdown=False):
3202+ for root, _, files in os.walk(top, topdown=False):
3203 for name in files:
3204 if name.endswith(".changes") and name.find(name_fragment) > -1:
3205 return os.path.join(root, name)
3206diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py
3207index d8cbff9..a095111 100644
3208--- a/lib/lp/testing/__init__.py
3209+++ b/lib/lp/testing/__init__.py
3210@@ -436,7 +436,7 @@ def record_two_runs(
3211 recorder_factory = StormStatementRecorder
3212 if login_method is not None:
3213 login_method()
3214- for i in range(first_round_number):
3215+ for _ in range(first_round_number):
3216 item_creator()
3217 # Record how many queries are issued when {tested_method} is
3218 # called after {item_creator} has been run {first_round_number}
3219@@ -452,7 +452,7 @@ def record_two_runs(
3220 second_round_number = first_round_number
3221 if login_method is not None:
3222 login_method()
3223- for i in range(second_round_number):
3224+ for _ in range(second_round_number):
3225 item_creator()
3226 # Record again the number of queries issued.
3227 flush_database_caches()
3228@@ -1206,7 +1206,7 @@ def build_yui_unittest_suite(app_testing_path, yui_test_class):
3229
3230
3231 def _harvest_yui_test_files(file_path):
3232- for dirpath, dirnames, filenames in os.walk(file_path):
3233+ for dirpath, _, filenames in os.walk(file_path):
3234 for filename in filenames:
3235 if fnmatchcase(filename, "test_*.html"):
3236 yield os.path.join(dirpath, filename)
3237diff --git a/lib/lp/testing/dbuser.py b/lib/lp/testing/dbuser.py
3238index eeb2bdc..a6b6cef 100644
3239--- a/lib/lp/testing/dbuser.py
3240+++ b/lib/lp/testing/dbuser.py
3241@@ -29,7 +29,7 @@ def update_store_connections():
3242 underlying connection of *existing* stores, leaving existing objects
3243 functional.
3244 """
3245- for name, store in getUtility(IZStorm).iterstores():
3246+ for _, store in getUtility(IZStorm).iterstores():
3247 connection = store._connection
3248 if connection._state == STATE_CONNECTED:
3249 if connection._raw_connection is not None:
3250diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
3251index 71fac63..bfc8744 100644
3252--- a/lib/lp/testing/factory.py
3253+++ b/lib/lp/testing/factory.py
3254@@ -1248,7 +1248,7 @@ class LaunchpadObjectFactory(ObjectFactory):
3255
3256 def makeStackedOnBranchChain(self, depth=5, **kwargs):
3257 branch = None
3258- for i in range(depth):
3259+ for _ in range(depth):
3260 branch = self.makeAnyBranch(stacked_on=branch, **kwargs)
3261 return branch
3262
3263@@ -2011,7 +2011,7 @@ class LaunchpadObjectFactory(ObjectFactory):
3264 revision_set = getUtility(IRevisionSet)
3265 if author is None:
3266 author = self.getUniqueString("author")
3267- for index in range(count):
3268+ for _ in range(count):
3269 revision = revision_set.new(
3270 revision_id=self.getUniqueString("revision-id"),
3271 log_body=self.getUniqueString("log-body"),
3272diff --git a/lib/lp/testing/fixture.py b/lib/lp/testing/fixture.py
3273index d5a7b74..0dd6145 100644
3274--- a/lib/lp/testing/fixture.py
3275+++ b/lib/lp/testing/fixture.py
3276@@ -123,7 +123,7 @@ class PGBouncerFixture(pgbouncer.fixture.PGBouncerFixture):
3277 def start(self, retries=20, sleep=0.5):
3278 """Start PGBouncer, waiting for it to accept connections."""
3279 super().start()
3280- for i in range(retries):
3281+ for _ in range(retries):
3282 try:
3283 socket.create_connection((self.host, self.port))
3284 except OSError:
3285diff --git a/lib/lp/testing/layers.py b/lib/lp/testing/layers.py
3286index cf94f50..637c47c 100644
3287--- a/lib/lp/testing/layers.py
3288+++ b/lib/lp/testing/layers.py
3289@@ -354,7 +354,7 @@ class BaseLayer:
3290 if BaseLayer.disable_thread_check:
3291 new_threads = None
3292 else:
3293- for loop in range(0, 100):
3294+ for _ in range(0, 100):
3295 # Check for tests that leave live threads around early.
3296 # A live thread may be the cause of other failures, such as
3297 # uncollectable garbage.
3298diff --git a/lib/lp/testing/swift/fakeswift.py b/lib/lp/testing/swift/fakeswift.py
3299index ef1378d..325c390 100644
3300--- a/lib/lp/testing/swift/fakeswift.py
3301+++ b/lib/lp/testing/swift/fakeswift.py
3302@@ -63,7 +63,7 @@ class FakeKeystone(resource.Resource):
3303 if token is not None and self._isValidToken(token, tenant_name):
3304 return token
3305 else:
3306- for id, token in self.tokens.items():
3307+ for token in self.tokens.values():
3308 if self._isValidToken(token, tenant_name):
3309 return token
3310
3311diff --git a/lib/lp/testing/yuixhr.py b/lib/lp/testing/yuixhr.py
3312index bbc18cc..08bd097 100644
3313--- a/lib/lp/testing/yuixhr.py
3314+++ b/lib/lp/testing/yuixhr.py
3315@@ -451,7 +451,7 @@ class YUITestFixtureControllerView(LaunchpadView):
3316
3317
3318 def find_tests(root):
3319- for dirpath, dirnames, filenames in os.walk(root):
3320+ for dirpath, _, filenames in os.walk(root):
3321 dirpath = os.path.relpath(dirpath, root)
3322 for filename in filenames:
3323 if fnmatchcase(filename, "test_*.js"):
3324diff --git a/lib/lp/tests/test_opensource.py b/lib/lp/tests/test_opensource.py
3325index d505809..ee84ed8 100644
3326--- a/lib/lp/tests/test_opensource.py
3327+++ b/lib/lp/tests/test_opensource.py
3328@@ -31,7 +31,7 @@ def add_testable_opensource_package(suite, package):
3329 topdir = os.path.dirname(package.__file__)
3330
3331 packages = []
3332- for dirpath, dirnames, filenames in os.walk(topdir):
3333+ for dirpath, dirnames, _ in os.walk(topdir):
3334 if "docs" in dirnames:
3335 docsdir = os.path.join(dirpath, "docs")[len(topdir) + 1 :]
3336 packages.append(docsdir)
3337diff --git a/lib/lp/translations/browser/tests/test_distroseries_views.py b/lib/lp/translations/browser/tests/test_distroseries_views.py
3338index 48c7bf0..0f818d5 100644
3339--- a/lib/lp/translations/browser/tests/test_distroseries_views.py
3340+++ b/lib/lp/translations/browser/tests/test_distroseries_views.py
3341@@ -75,7 +75,7 @@ class TestLanguagePacksView(TestCaseWithFactory):
3342 distroseries = self.factory.makeUbuntuDistroSeries()
3343 # This is one more than the default for shortlist.
3344 number_of_language_packs = 16
3345- for i in range(number_of_language_packs):
3346+ for _ in range(number_of_language_packs):
3347 self.factory.makeLanguagePack(distroseries)
3348
3349 view = create_initialized_view(
3350diff --git a/lib/lp/translations/browser/tests/test_translationimportqueueentry.py b/lib/lp/translations/browser/tests/test_translationimportqueueentry.py
3351index cc2a84b..9c44060 100644
3352--- a/lib/lp/translations/browser/tests/test_translationimportqueueentry.py
3353+++ b/lib/lp/translations/browser/tests/test_translationimportqueueentry.py
3354@@ -139,7 +139,7 @@ class TestTranslationImportQueueEntryView(WithScenarios, TestCaseWithFactory):
3355 # Many translatable series. The list is cut short; there's an
3356 # ellipsis to indicate this.
3357 series_count = len(product.translatable_series)
3358- for counter in range(series_count, view.max_series_to_display + 1):
3359+ for _ in range(series_count, view.max_series_to_display + 1):
3360 extra_series = self.factory.makeProductSeries(product=product)
3361 self.factory.makePOTemplate(productseries=extra_series)
3362 series_text = view.product_translatable_series
3363diff --git a/lib/lp/translations/model/currenttranslations.py b/lib/lp/translations/model/currenttranslations.py
3364index 84688a0..38d4cad 100644
3365--- a/lib/lp/translations/model/currenttranslations.py
3366+++ b/lib/lp/translations/model/currenttranslations.py
3367@@ -137,6 +137,6 @@ class CurrentTranslations:
3368 )
3369 for msgset in msgsets:
3370 cache = getattr(msgset, "_current_translations_cache", {})
3371- for key, message in current_translations.items():
3372+ for key in current_translations:
3373 cache[key] = current_translations[key]
3374 msgset._current_translations_cache = cache
3375diff --git a/lib/lp/translations/model/translationpolicy.py b/lib/lp/translations/model/translationpolicy.py
3376index f5b7248..be7e0aa 100644
3377--- a/lib/lp/translations/model/translationpolicy.py
3378+++ b/lib/lp/translations/model/translationpolicy.py
3379@@ -21,7 +21,7 @@ from lp.translations.model.translator import Translator
3380
3381 def has_translators(translators_list):
3382 """Did `getTranslators` find any translators?"""
3383- for group, translator, team in translators_list:
3384+ for _, _, team in translators_list:
3385 if team is not None:
3386 return True
3387 return False
3388@@ -29,7 +29,7 @@ def has_translators(translators_list):
3389
3390 def is_in_one_of_translators(translators_list, person):
3391 """Is `person` a member of one of the entries in `getTranslators`?"""
3392- for group, translator, team in translators_list:
3393+ for _, _, team in translators_list:
3394 if team is not None and person.inTeam(team):
3395 return True
3396 return False
3397diff --git a/lib/lp/translations/model/translationsoverview.py b/lib/lp/translations/model/translationsoverview.py
3398index a51ca0c..2852a76 100644
3399--- a/lib/lp/translations/model/translationsoverview.py
3400+++ b/lib/lp/translations/model/translationsoverview.py
3401@@ -89,7 +89,7 @@ class TranslationsOverview:
3402 # them to appropriate font size values.
3403 minimum = None
3404 maximum = None
3405- for name, product_id, distro_id, relative_karma in cur.fetchall():
3406+ for _, product_id, distro_id, relative_karma in cur.fetchall():
3407 if minimum is None or relative_karma < minimum:
3408 minimum = relative_karma
3409 if maximum is None or relative_karma > maximum:
3410diff --git a/lib/lp/translations/pottery/detect_intltool.py b/lib/lp/translations/pottery/detect_intltool.py
3411index 76a8a76..69ff368 100644
3412--- a/lib/lp/translations/pottery/detect_intltool.py
3413+++ b/lib/lp/translations/pottery/detect_intltool.py
3414@@ -28,7 +28,7 @@ def is_intltool_structure(tree):
3415 :returns: True if signs of an intltool structure were found.
3416 """
3417 with read_lock_tree(tree):
3418- for thedir, files in tree.walkdirs():
3419+ for _, files in tree.walkdirs():
3420 for afile in files:
3421 file_path, file_name, file_type = afile[:3]
3422 if file_type != "file":
3423diff --git a/lib/lp/translations/tests/test_translationimportqueue.py b/lib/lp/translations/tests/test_translationimportqueue.py
3424index 8a51550..164046c 100644
3425--- a/lib/lp/translations/tests/test_translationimportqueue.py
3426+++ b/lib/lp/translations/tests/test_translationimportqueue.py
3427@@ -716,7 +716,7 @@ class TestHelpers(TestCaseWithFactory):
3428 for counter in range(2)
3429 ]
3430 for series in productseries:
3431- for counter in range(2):
3432+ for _ in range(2):
3433 self.factory.makeTranslationImportQueueEntry(
3434 productseries=series
3435 )
3436@@ -807,7 +807,7 @@ class TestHelpers(TestCaseWithFactory):
3437 self.useFixture(FakeLibrarian())
3438 series = self.factory.makeDistroSeries()
3439 series.defer_translation_imports = False
3440- for counter in range(2):
3441+ for _ in range(2):
3442 self.factory.makeTranslationImportQueueEntry(distroseries=series)
3443 self.assertEqual([series], list_distroseries_request_targets(True))
3444
3445diff --git a/lib/lp/translations/tests/test_translationsplitter.py b/lib/lp/translations/tests/test_translationsplitter.py
3446index 367a0f4..83e7d43 100644
3447--- a/lib/lp/translations/tests/test_translationsplitter.py
3448+++ b/lib/lp/translations/tests/test_translationsplitter.py
3449@@ -68,9 +68,10 @@ class TestTranslationSplitter(TestCaseWithFactory):
3450 splitter = make_translation_splitter(self.factory)
3451 make_shared_potmsgset(self.factory, splitter)
3452 make_shared_potmsgset(self.factory, splitter)
3453- for num, (upstream, ubuntu) in enumerate(splitter.findShared()):
3454+ shared = list(splitter.findShared())
3455+ for upstream, ubuntu in shared:
3456 self.assertEqual(upstream.potmsgset, ubuntu.potmsgset)
3457- self.assertEqual(1, num)
3458+ self.assertEqual(1, len(shared))
3459
3460 def test_splitPOTMsgSet(self):
3461 """Splitting a POTMsgSet clones it and updates TemplateItem."""
3462diff --git a/lib/lp/translations/tests/test_translationtemplatesbuild.py b/lib/lp/translations/tests/test_translationtemplatesbuild.py
3463index e7196f2..aa09224 100644
3464--- a/lib/lp/translations/tests/test_translationtemplatesbuild.py
3465+++ b/lib/lp/translations/tests/test_translationtemplatesbuild.py
3466@@ -236,7 +236,7 @@ class TestTranslationTemplatesBuild(TestCaseWithFactory):
3467 source = getUtility(ITranslationTemplatesBuildSource)
3468 build_farm_jobs = []
3469 builds = []
3470- for i in range(10):
3471+ for _ in range(10):
3472 branch = self.factory.makeBranch()
3473 build = source.create(branch)
3474 builds.append(build)
3475diff --git a/lib/lp/translations/utilities/gettext_po_parser.py b/lib/lp/translations/utilities/gettext_po_parser.py
3476index a383360..a67f416 100644
3477--- a/lib/lp/translations/utilities/gettext_po_parser.py
3478+++ b/lib/lp/translations/utilities/gettext_po_parser.py
3479@@ -701,7 +701,7 @@ class POParser:
3480 # Octal escape.
3481 position += 2
3482 # Up to two more octal digits.
3483- for i in range(2):
3484+ for _ in range(2):
3485 if string[position].isdigit():
3486 position += 1
3487 else:
3488diff --git a/lib/lp/translations/utilities/tests/test_translation_importer.py b/lib/lp/translations/utilities/tests/test_translation_importer.py
3489index 98925ae..9c72920 100644
3490--- a/lib/lp/translations/utilities/tests/test_translation_importer.py
3491+++ b/lib/lp/translations/utilities/tests/test_translation_importer.py
3492@@ -98,7 +98,7 @@ class TranslationImporterTestCase(TestCaseWithFactory):
3493 exactly the same priority."""
3494 for file_extension in TranslationImporter().supported_file_extensions:
3495 priorities = []
3496- for format, importer in importers.items():
3497+ for importer in importers.values():
3498 if file_extension in importer.file_extensions:
3499 self.assertNotIn(importer.priority, priorities)
3500 priorities.append(importer.priority)
3501diff --git a/lib/lp/translations/utilities/xpi_header.py b/lib/lp/translations/utilities/xpi_header.py
3502index cfabddc..0e4ee58 100644
3503--- a/lib/lp/translations/utilities/xpi_header.py
3504+++ b/lib/lp/translations/utilities/xpi_header.py
3505@@ -70,7 +70,7 @@ class XpiHeader:
3506 parse = cElementTree.iterparse(
3507 io.BytesIO(raw_content), forbid_dtd=True
3508 )
3509- for event, elem in parse:
3510+ for _, elem in parse:
3511 if elem.tag == contributor_tag:
3512 # An XPI header can list multiple contributors, but
3513 # here we care only about the latest one listed as a
3514diff --git a/scripts/librarian-report.py b/scripts/librarian-report.py
3515index 0281181..c1919a5 100755
3516--- a/scripts/librarian-report.py
3517+++ b/scripts/librarian-report.py
3518@@ -107,9 +107,7 @@ def main():
3519 total_bytes, formatted_size, num_files = cur.fetchone()
3520 totals.add((total_bytes, referring_table, formatted_size, num_files))
3521
3522- for total_bytes, tab_name, formatted_size, num_files in sorted(
3523- totals, reverse=True
3524- ):
3525+ for _, tab_name, formatted_size, num_files in sorted(totals, reverse=True):
3526 print("%-10s %s in %d files" % (formatted_size, tab_name, num_files))
3527
3528 return 0
3529diff --git a/scripts/memcached-stats.py b/scripts/memcached-stats.py
3530index 73e0a2f..5f65226 100755
3531--- a/scripts/memcached-stats.py
3532+++ b/scripts/memcached-stats.py
3533@@ -33,7 +33,7 @@ INTERESTING_KEYS = [
3534 def get_summary(all_raw_stats):
3535 """Aggregate individual server statistics into a summary."""
3536 totals = {key: 0 for key in INTERESTING_KEYS}
3537- for server, raw_stats in all_raw_stats:
3538+ for _, raw_stats in all_raw_stats:
3539 for key in INTERESTING_KEYS:
3540 totals[key] += int(raw_stats.get(key, 0))
3541 return totals
3542diff --git a/test_on_merge.py b/test_on_merge.py
3543index 8df3dc7..540a28c 100755
3544--- a/test_on_merge.py
3545+++ b/test_on_merge.py
3546@@ -67,7 +67,7 @@ def setup_test_database():
3547
3548 # If there are existing database connections, terminate. We have
3549 # rogue processes still connected to the database.
3550- for loop in range(2):
3551+ for _ in range(2):
3552 cur.execute(
3553 """
3554 SELECT usename, query
3555diff --git a/utilities/community-contributions.py b/utilities/community-contributions.py
3556index fe82b78..af4e378 100755
3557--- a/utilities/community-contributions.py
3558+++ b/utilities/community-contributions.py
3559@@ -536,7 +536,7 @@ class LogExCons(log.LogFormatter):
3560 # Go through the shallowest authored revisions and add their
3561 # top level revisions.
3562 for excon in self.all_ex_cons.values():
3563- for rev, top_level_rev in excon.seen_revs.values():
3564+ for _, top_level_rev in excon.seen_revs.values():
3565 excon.add_top_level_revision(top_level_rev)
3566
3567 # Divide contributors into non-Canonical and Canonical.
3568diff --git a/utilities/generate-external-bug-status-docs b/utilities/generate-external-bug-status-docs
3569index cbe193e..e852747 100755
3570--- a/utilities/generate-external-bug-status-docs
3571+++ b/utilities/generate-external-bug-status-docs
3572@@ -31,7 +31,7 @@ from lp.bugs.externalbugtracker import BUG_TRACKER_CLASSES
3573
3574 def generate_blank_lines(num):
3575 """Generate `num` blank lines."""
3576- for i in range(num):
3577+ for _ in range(num):
3578 yield ""
3579
3580
3581diff --git a/utilities/pgmassacre.py b/utilities/pgmassacre.py
3582index 0939268..d809786 100755
3583--- a/utilities/pgmassacre.py
3584+++ b/utilities/pgmassacre.py
3585@@ -55,7 +55,7 @@ def rollback_prepared_transactions(database):
3586 )
3587 xids = [row[0] for row in cur.fetchall()]
3588 for xid in xids:
3589- cur.execute("ROLLBACK PREPARED %(xid)s", vars())
3590+ cur.execute("ROLLBACK PREPARED %(xid)s", {"xid": xid})
3591 con.close()
3592
3593
3594diff --git a/utilities/pgstats.py b/utilities/pgstats.py
3595index d470605..eba3072 100755
3596--- a/utilities/pgstats.py
3597+++ b/utilities/pgstats.py
3598@@ -159,7 +159,7 @@ def main(dbname):
3599 print_row("Unused indexes", "N/A")
3600 else:
3601 print_row("Unused indexes", rows[0][1])
3602- for table, index in rows[1:]:
3603+ for _, index in rows[1:]:
3604 print_row("", index)
3605
3606

Subscribers

People subscribed via source and target branches

to status/vote changes: