launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26057
[Merge] ~cjwatson/launchpad:py3-filter into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-filter into launchpad:master.
Commit message:
Don't assume that filter() returns a list
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396659
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-filter into launchpad:master.
diff --git a/lib/lp/archivepublisher/scripts/publishdistro.py b/lib/lp/archivepublisher/scripts/publishdistro.py
index dabcb8c..c079484 100644
--- a/lib/lp/archivepublisher/scripts/publishdistro.py
+++ b/lib/lp/archivepublisher/scripts/publishdistro.py
@@ -179,7 +179,7 @@ class PublishDistro(PublisherScript):
self.options.private_ppa,
self.options.copy_archive,
]
- return len(filter(None, exclusive_options))
+ return len(list(filter(None, exclusive_options)))
def logOptions(self):
"""Dump the selected options to the debug log."""
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index 0db17cb..4850aba 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -706,7 +706,7 @@ class Distribution(SQLBase, BugTargetBase, MakesAnnouncements,
result.append(list(key))
# Pull out all the official series names and append them as a list
# to the end of the current record.
- result[-1].append(filter(None, map(itemgetter(2), group)))
+ result[-1].append(list(filter(None, map(itemgetter(2), group))))
return result
diff --git a/lib/lp/soyuz/scripts/custom_uploads_copier.py b/lib/lp/soyuz/scripts/custom_uploads_copier.py
index 21cc1f2..b7d47e7 100644
--- a/lib/lp/soyuz/scripts/custom_uploads_copier.py
+++ b/lib/lp/soyuz/scripts/custom_uploads_copier.py
@@ -81,9 +81,9 @@ class CustomUploadsCopier:
pocket=source_pocket, custom_type=self.copyable_types.keys())
load_referencing(PackageUploadCustom, uploads, ['packageuploadID'])
customs = sum([list(upload.customfiles) for upload in uploads], [])
- customs = filter(self.isCopyable, customs)
- customs.sort(key=attrgetter('id'), reverse=True)
- return customs
+ return sorted(
+ filter(self.isCopyable, customs),
+ key=attrgetter('id'), reverse=True)
def extractSeriesKey(self, custom_type, filename):
"""Get the relevant fields out of `filename` for `custom_type`."""
diff --git a/lib/lp/soyuz/scripts/tests/test_populatearchive.py b/lib/lp/soyuz/scripts/tests/test_populatearchive.py
index 7c7bcaf..f30eb4b 100644
--- a/lib/lp/soyuz/scripts/tests/test_populatearchive.py
+++ b/lib/lp/soyuz/scripts/tests/test_populatearchive.py
@@ -588,7 +588,7 @@ class TestPopulateArchiveScript(TestCaseWithFactory):
# are in the state expected:
# - binary build: pending
# - job: suspended
- builds_in_wrong_state = filter(build_in_wrong_state, builds)
+ builds_in_wrong_state = list(filter(build_in_wrong_state, builds))
self.assertEqual(
[], builds_in_wrong_state,
"The binary builds generated for the target copy archive "
diff --git a/lib/lp/translations/model/approver.py b/lib/lp/translations/model/approver.py
index bc4641d..b77dc30 100644
--- a/lib/lp/translations/model/approver.py
+++ b/lib/lp/translations/model/approver.py
@@ -178,7 +178,7 @@ class TranslationBuildApprover(object):
importer = TranslationImporter()
# We only care for templates.
- self.filenames = filter(importer.isTemplateName, filenames)
+ self.filenames = list(filter(importer.isTemplateName, filenames))
self._potemplateset = getUtility(IPOTemplateSet).getSubset(
productseries=productseries,
distroseries=distroseries,