launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27796
[Merge] ~cjwatson/launchpad:pyupgrade-py3-archiveuploader into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pyupgrade-py3-archiveuploader into launchpad:master.
Commit message:
lp.archiveuploader: Apply "pyupgrade --py3-plus"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/412514
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pyupgrade-py3-archiveuploader into launchpad:master.
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 7121771..78c032b 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -6,3 +6,5 @@
7fbeaae55d7d282ccda47c76a27c879e04ee14e9
# apply pyupgrade --py3-plus to lp.archivepublisher
c348b945c29c723201380d9aca0e0c0298037c8c
+# apply pyupgrade --py3-plus to lp.archiveuploader
+65c3806b29ddd3d989a1b5a900c40e6599a38c3f
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ea4c505..17e1dff 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -38,7 +38,7 @@ repos:
alias: pyupgrade-py3
name: pyupgrade (--py3-plus)
args: [--keep-percent-format, --py3-plus]
- files: ^lib/lp/(answers|app|archivepublisher)/
+ files: ^lib/lp/(answers|app|archivepublisher|archiveuploader)/
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
hooks:
diff --git a/lib/lp/archiveuploader/buildinfofile.py b/lib/lp/archiveuploader/buildinfofile.py
index eb00698..b7fd2ee 100644
--- a/lib/lp/archiveuploader/buildinfofile.py
+++ b/lib/lp/archiveuploader/buildinfofile.py
@@ -22,7 +22,7 @@ class BuildInfoFile(PackageUploadFile, SignableTagFile):
def __init__(self, filepath, checksums, size, component_and_section,
priority_name, package, version, changes, policy, logger):
- super(BuildInfoFile, self).__init__(
+ super().__init__(
filepath, checksums, size, component_and_section, priority_name,
package, version, changes, policy, logger)
self.parse(verify_signature=not policy.unsigned_buildinfo_ok)
diff --git a/lib/lp/archiveuploader/changesfile.py b/lib/lp/archiveuploader/changesfile.py
index 1a97999..43ff662 100644
--- a/lib/lp/archiveuploader/changesfile.py
+++ b/lib/lp/archiveuploader/changesfile.py
@@ -371,7 +371,7 @@ class ChangesFile(SignableTagFile):
"""
changes_author = rfc822_encode_address(
self.changed_by['name'], self.changed_by['email'])
- return (u'%s\n\n -- %s %s' % (
+ return ('%s\n\n -- %s %s' % (
self.changes_comment, changes_author, self.date)).encode('UTF-8')
diff --git a/lib/lp/archiveuploader/dscfile.py b/lib/lp/archiveuploader/dscfile.py
index 50e6d70..8554832 100644
--- a/lib/lp/archiveuploader/dscfile.py
+++ b/lib/lp/archiveuploader/dscfile.py
@@ -137,7 +137,7 @@ class SignableTagFile:
try:
with open(self.filepath, 'rb') as f:
self.raw_content = f.read()
- except IOError as error:
+ except OSError as error:
raise UploadError(
"Unable to read %s: %s" % (self.filename, error))
@@ -212,7 +212,7 @@ class SignableTagFile:
try:
(name, email) = parse_maintainer_bytes(addr, fieldname)
except ParseMaintError as error:
- raise UploadError(six.text_type(error))
+ raise UploadError(str(error))
person = getUtility(IPersonSet).getByEmail(email)
if person and person.private:
diff --git a/lib/lp/archiveuploader/nascentuploadfile.py b/lib/lp/archiveuploader/nascentuploadfile.py
index e996fc4..548e43c 100644
--- a/lib/lp/archiveuploader/nascentuploadfile.py
+++ b/lib/lp/archiveuploader/nascentuploadfile.py
@@ -219,7 +219,7 @@ class NascentUploadFile:
with open(self.filepath, "rb") as ckfile:
size = 0
for chunk in filechunks(ckfile):
- for digester in six.itervalues(digesters):
+ for digester in digesters.values():
digester.update(chunk)
size += len(chunk)
@@ -329,7 +329,7 @@ class PackageUploadFile(NascentUploadFile):
SourcePackageRelease creation, so component and section need to exist.
Even if they might be overridden in the future.
"""
- super(PackageUploadFile, self).__init__(
+ super().__init__(
filepath, md5, size, component_and_section, priority_name,
policy, logger)
self.package = package
@@ -551,8 +551,7 @@ class BaseBinaryUploadFile(PackageUploadFile):
]
checks = mandatory_checks + self.local_checks
for check in checks:
- for error in check():
- yield error
+ yield from check()
def extractAndParseControl(self):
"""Extract and parse control information."""
diff --git a/lib/lp/archiveuploader/ocirecipeupload.py b/lib/lp/archiveuploader/ocirecipeupload.py
index 460b923..ac655a5 100644
--- a/lib/lp/archiveuploader/ocirecipeupload.py
+++ b/lib/lp/archiveuploader/ocirecipeupload.py
@@ -46,7 +46,7 @@ class OCIRecipeUpload:
# Open the digest file
digest_path = os.path.join(dirpath, 'digests.json')
self.logger.debug("Digest path: {}".format(digest_path))
- with open(digest_path, 'r') as digest_fp:
+ with open(digest_path) as digest_fp:
digests = json.load(digest_fp)
# Foreach id in digest file, find matching layer
diff --git a/lib/lp/archiveuploader/tests/test_buildduploads.py b/lib/lp/archiveuploader/tests/test_buildduploads.py
index ab8a571..473c7ee 100644
--- a/lib/lp/archiveuploader/tests/test_buildduploads.py
+++ b/lib/lp/archiveuploader/tests/test_buildduploads.py
@@ -72,7 +72,7 @@ class TestStagedBinaryUploadBase(TestUploadProcessorBase):
6. Clean log messages.
7. Commit transaction, so the upload source can be seen.
"""
- super(TestStagedBinaryUploadBase, self).setUp()
+ super().setUp()
self.options.context = self.policy
self.options.nomails = self.no_mails
# Set up the uploadprocessor with appropriate options and logger
@@ -198,7 +198,7 @@ class TestBuilddUploads(TestStagedBinaryUploadBase):
real_policy = self.policy
self.policy = 'insecure'
- super(TestBuilddUploads, self).setUp()
+ super().setUp()
# Publish the source package release so it can be found by
# NascentUploadFile.findSourcePackageRelease().
spr = self.source_queue.sources[0].sourcepackagerelease
@@ -241,7 +241,7 @@ class TestBuilddUploads(TestStagedBinaryUploadBase):
self.assertEqual(build_used.id, build_candidate.id)
self.assertBuildsCreated(1)
self.assertEqual(
- u'i386 build of foo 1.0-1 in ubuntu breezy RELEASE',
+ 'i386 build of foo 1.0-1 in ubuntu breezy RELEASE',
build_used.title)
self.assertEqual('FULLYBUILT', build_used.status.name)
@@ -258,6 +258,6 @@ class TestBuilddUploads(TestStagedBinaryUploadBase):
self.assertEqual(build_used.id, build_candidate.id)
self.assertBuildsCreated(2)
self.assertEqual(
- u'powerpc build of foo 1.0-1 in ubuntu breezy RELEASE',
+ 'powerpc build of foo 1.0-1 in ubuntu breezy RELEASE',
build_used.title)
self.assertEqual('FULLYBUILT', build_used.status.name)
diff --git a/lib/lp/archiveuploader/tests/test_changesfile.py b/lib/lp/archiveuploader/tests/test_changesfile.py
index 427b43b..aeb87d1 100644
--- a/lib/lp/archiveuploader/tests/test_changesfile.py
+++ b/lib/lp/archiveuploader/tests/test_changesfile.py
@@ -169,7 +169,7 @@ class ChangesFileTests(TestCase):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(ChangesFileTests, self).setUp()
+ super().setUp()
self.logger = BufferLogger()
self.policy = AbsolutelyAnythingGoesUploadPolicy()
@@ -265,9 +265,9 @@ class ChangesFileTests(TestCase):
self.assertThat(
changes.changed_by,
MatchesDict({
- "name": Equals(u"Somebody"),
- "email": Equals(u"somebody@xxxxxxxxxx"),
- "person": MatchesStructure.byEquality(displayname=u"Somebody"),
+ "name": Equals("Somebody"),
+ "email": Equals("somebody@xxxxxxxxxx"),
+ "person": MatchesStructure.byEquality(displayname="Somebody"),
}))
def test_simulated_changelog(self):
@@ -358,7 +358,7 @@ class TestSignatureVerification(TestCase):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestSignatureVerification, self).setUp()
+ super().setUp()
self.useFixture(KeyServerTac())
import_public_test_keys()
diff --git a/lib/lp/archiveuploader/tests/test_charmrecipeupload.py b/lib/lp/archiveuploader/tests/test_charmrecipeupload.py
index edd2da7..7fdf8d4 100644
--- a/lib/lp/archiveuploader/tests/test_charmrecipeupload.py
+++ b/lib/lp/archiveuploader/tests/test_charmrecipeupload.py
@@ -25,7 +25,7 @@ class TestCharmRecipeUploads(TestUploadProcessorBase):
"""End-to-end tests of charm recipe uploads."""
def setUp(self):
- super(TestCharmRecipeUploads, self).setUp()
+ super().setUp()
self.useFixture(FeatureFixture({CHARM_RECIPE_ALLOW_CREATE: "on"}))
self.setupBreezy()
diff --git a/lib/lp/archiveuploader/tests/test_dscfile.py b/lib/lp/archiveuploader/tests/test_dscfile.py
index e1b4404..c38577e 100644
--- a/lib/lp/archiveuploader/tests/test_dscfile.py
+++ b/lib/lp/archiveuploader/tests/test_dscfile.py
@@ -48,7 +48,7 @@ DIFF = SourcePackageFileType.DIFF
class TestDscFile(TestCase):
def setUp(self):
- super(TestDscFile, self).setUp()
+ super().setUp()
self.tmpdir = self.makeTemporaryDirectory()
self.dir_path = os.path.join(self.tmpdir, "foo", "debian")
os.makedirs(self.dir_path)
@@ -105,7 +105,7 @@ class TestDscFile(TestCase):
changelog and copyright files. 10MiB was set as a sane lower limit
which is incredibly unlikely to be hit by normal files in the
archive"""
- dev_zero = open("/dev/zero", "r")
+ dev_zero = open("/dev/zero")
ten_MiB = 10 * (2 ** 20)
empty_file = dev_zero.read(ten_MiB + 1)
dev_zero.close()
@@ -185,10 +185,10 @@ class TestSignableTagFile(TestCaseWithFactory):
self.makeSignableTagFile().parseAddress, "invalid@bad@address")
def test_parseAddress_decodes_utf8(self):
- name = u'B\u0105r'
- email = u'bar@xxxxxxxxxxx'
+ name = 'B\u0105r'
+ email = 'bar@xxxxxxxxxxx'
results = self.makeSignableTagFile().parseAddress(
- (u'%s <%s>' % (name, email)).encode('utf-8'))
+ ('%s <%s>' % (name, email)).encode('utf-8'))
self.assertEqual(email, results['email'])
self.assertEqual(name, results['name'])
self.assertEqual(name, results['person'].displayname)
diff --git a/lib/lp/archiveuploader/tests/test_livefsupload.py b/lib/lp/archiveuploader/tests/test_livefsupload.py
index 273773b..869e077 100644
--- a/lib/lp/archiveuploader/tests/test_livefsupload.py
+++ b/lib/lp/archiveuploader/tests/test_livefsupload.py
@@ -27,9 +27,9 @@ class TestLiveFSBuildUploads(TestUploadProcessorBase):
"""End-to-end tests of LiveFS build uploads."""
def setUp(self):
- super(TestLiveFSBuildUploads, self).setUp()
+ super().setUp()
- self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+ self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
self.setupBreezy()
self.switchToAdmin()
diff --git a/lib/lp/archiveuploader/tests/test_nascentupload.py b/lib/lp/archiveuploader/tests/test_nascentupload.py
index d7a0a87..b53fff4 100644
--- a/lib/lp/archiveuploader/tests/test_nascentupload.py
+++ b/lib/lp/archiveuploader/tests/test_nascentupload.py
@@ -35,7 +35,7 @@ class TestMatchDDEBs(TestCase):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(TestMatchDDEBs, self).setUp()
+ super().setUp()
self.changes = FakeChangesFile()
self.upload = NascentUpload(self.changes, None, DevNullLogger())
diff --git a/lib/lp/archiveuploader/tests/test_nascentuploadfile.py b/lib/lp/archiveuploader/tests/test_nascentuploadfile.py
index 9dfa59f..25e97de 100644
--- a/lib/lp/archiveuploader/tests/test_nascentuploadfile.py
+++ b/lib/lp/archiveuploader/tests/test_nascentuploadfile.py
@@ -58,7 +58,7 @@ class NascentUploadFileTestCase(TestCaseWithFactory):
"""Base class for all tests of classes deriving from NascentUploadFile."""
def setUp(self):
- super(NascentUploadFileTestCase, self).setUp()
+ super().setUp()
self.logger = BufferLogger()
self.policy = AbsolutelyAnythingGoesUploadPolicy()
self.distro = self.factory.makeDistribution()
@@ -188,7 +188,7 @@ class PackageUploadFileTestCase(NascentUploadFileTestCase):
"""Base class for all tests of classes deriving from PackageUploadFile."""
def setUp(self):
- super(PackageUploadFileTestCase, self).setUp()
+ super().setUp()
self.policy.distroseries = self.factory.makeDistroSeries(
distribution=self.distro)
@@ -301,7 +301,7 @@ class DSCFileTests(PackageUploadFileTestCase):
release = uploadfile.storeInDatabase(None)
# DSCFile lowercases the field names
self.assertEqual(
- [["Python-Version", u"2.5"]], release.user_defined_fields)
+ [["Python-Version", "2.5"]], release.user_defined_fields)
def test_homepage(self):
# storeInDatabase updates homepage.
@@ -314,7 +314,7 @@ class DSCFileTests(PackageUploadFileTestCase):
uploadfile.changelog = b"DUMMY"
uploadfile.files = []
release = uploadfile.storeInDatabase(None)
- self.assertEqual(u"http://samba.org/~jelmer/bzr", release.homepage)
+ self.assertEqual("http://samba.org/~jelmer/bzr", release.homepage)
def test_checkBuild(self):
# checkBuild() verifies consistency with a build.
@@ -554,14 +554,14 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase):
uploadfile.parseControl(control)
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
- self.assertEqual(u'python (<< 2.7), python (>= 2.5)', bpr.depends)
+ self.assertEqual('python (<< 2.7), python (>= 2.5)', bpr.depends)
self.assertEqual(
- u" Dulwich is a Python implementation of the file formats and"
- u" protocols", bpr.description)
+ " Dulwich is a Python implementation of the file formats and"
+ " protocols", bpr.description)
self.assertEqual(False, bpr.essential)
self.assertEqual(524, bpr.installedsize)
self.assertEqual(True, bpr.architecturespecific)
- self.assertEqual(u"", bpr.recommends)
+ self.assertEqual("", bpr.recommends)
self.assertEqual("0.42", bpr.version)
def test_user_defined_fields(self):
@@ -575,7 +575,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase):
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
self.assertEqual(
- [[u"Python-Version", u"2.5"]], bpr.user_defined_fields)
+ [["Python-Version", "2.5"]], bpr.user_defined_fields)
def test_user_defined_fields_newlines(self):
# storeInDatabase stores user defined fields and keeps newlines.
@@ -589,7 +589,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase):
bpr = uploadfile.storeInDatabase(build)
self.assertEqual(
[
- [u"RandomData", u"Foo\nbar\nbla\n"],
+ ["RandomData", "Foo\nbar\nbla\n"],
], bpr.user_defined_fields)
def test_built_using(self):
@@ -615,7 +615,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase):
reference_type=BinarySourceReferenceType.BUILT_USING,
)))
self.assertEqual(
- [[u"Built-Using", u"bar (= 0.1)"]], bpr.user_defined_fields)
+ [["Built-Using", "bar (= 0.1)"]], bpr.user_defined_fields)
def test_homepage(self):
# storeInDatabase stores homepage field.
@@ -628,7 +628,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase):
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
self.assertEqual(
- u"http://samba.org/~jelmer/dulwich", bpr.homepage)
+ "http://samba.org/~jelmer/dulwich", bpr.homepage)
def test_checkBuild(self):
# checkBuild() verifies consistency with a build.
diff --git a/lib/lp/archiveuploader/tests/test_ocirecipeupload.py b/lib/lp/archiveuploader/tests/test_ocirecipeupload.py
index 39cc56b..f46785f 100644
--- a/lib/lp/archiveuploader/tests/test_ocirecipeupload.py
+++ b/lib/lp/archiveuploader/tests/test_ocirecipeupload.py
@@ -26,7 +26,7 @@ from lp.services.propertycache import get_property_cache
class TestOCIRecipeUploads(OCIConfigHelperMixin, TestUploadProcessorBase):
def setUp(self):
- super(TestOCIRecipeUploads, self).setUp()
+ super().setUp()
self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'}))
self.setupBreezy()
diff --git a/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py b/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py
index 2ae52d7..767324d 100644
--- a/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py
+++ b/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py
@@ -49,7 +49,7 @@ class TestPPAUploadProcessorBase(TestUploadProcessorBase):
Additionally to the TestUploadProcessorBase.setUp, set 'breezy'
distroseries and an new uploadprocessor instance.
"""
- super(TestPPAUploadProcessorBase, self).setUp()
+ super().setUp()
self.build_uploadprocessor = self.getUploadProcessor(
self.layer.txn, builds=True)
self.ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
@@ -158,8 +158,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
PackageUploadStatus.DONE)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.DONE, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.DONE, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
self.assertEqual(queue_item.archive, self.name16.archive)
self.assertEqual(queue_item.pocket, PackagePublishingPocket.RELEASE)
@@ -172,13 +172,13 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.assertEqual(pending_ppas.count(), 1)
self.assertEqual(pending_ppas[0], self.name16.archive)
- pub_bar = self.name16.archive.getPublishedSources(name=u'bar').one()
+ pub_bar = self.name16.archive.getPublishedSources(name='bar').one()
- self.assertEqual(pub_bar.sourcepackagerelease.version, u'1.0-1')
+ self.assertEqual(pub_bar.sourcepackagerelease.version, '1.0-1')
self.assertEqual(pub_bar.status, PackagePublishingStatus.PENDING)
self.assertEqual(pub_bar.component.name, 'main')
- [build] = self.name16.archive.getBuildRecords(name=u'bar')
+ [build] = self.name16.archive.getBuildRecords(name='bar')
self.assertEqual(
build.title, 'i386 build of bar 1.0-1 in ubuntu breezy RELEASE')
self.assertEqual(build.status.name, 'NEEDSBUILD')
@@ -197,14 +197,14 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.uploadprocessor.last_processed_upload.queue_root.status,
PackageUploadStatus.DONE)
- pub_sources = self.name16.archive.getPublishedSources(name=u'bar')
+ pub_sources = self.name16.archive.getPublishedSources(name='bar')
[pub_bar_10, pub_bar] = pub_sources
- self.assertEqual(pub_bar_10.sourcepackagerelease.version, u'1.0-10')
+ self.assertEqual(pub_bar_10.sourcepackagerelease.version, '1.0-10')
self.assertEqual(pub_bar_10.status, PackagePublishingStatus.PENDING)
self.assertEqual(pub_bar_10.component.name, 'main')
- [build, build_old] = self.name16.archive.getBuildRecords(name=u'bar')
+ [build, build_old] = self.name16.archive.getBuildRecords(name='bar')
self.assertEqual(
build.title, 'i386 build of bar 1.0-10 in ubuntu breezy RELEASE')
self.assertEqual(build.status.name, 'NEEDSBUILD')
@@ -219,8 +219,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.assertEqual(
self.uploadprocessor.last_processed_upload.rejection_message,
- u'bar_1.0-2.dsc: Version older than that in the archive. '
- u'1.0-2 <= 1.0-10')
+ 'bar_1.0-2.dsc: Version older than that in the archive. '
+ '1.0-2 <= 1.0-10')
def testNamedPPAUploadDefault(self):
"""Test PPA uploads to the default PPA."""
@@ -294,7 +294,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
pop_notifications()
# The SourcePackageRelease still has a component of universe:
- pub_foo = self.name16.archive.getPublishedSources(name=u"bar").one()
+ pub_foo = self.name16.archive.getPublishedSources(name="bar").one()
self.assertEqual(
pub_foo.sourcepackagerelease.component.name, "universe")
@@ -302,7 +302,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.assertEqual(pub_foo.component.name, 'main')
# Continue with a binary upload:
- [build] = self.name16.archive.getBuildRecords(name=u"bar")
+ [build] = self.name16.archive.getBuildRecords(name="bar")
self.options.context = 'buildd'
upload_dir = self.queueUpload(
"bar_1.0-1_binary_universe", "~name16/ubuntu")
@@ -314,8 +314,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# Publish the binary.
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.ACCEPTED, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
self.switchToAdmin()
queue_item.realiseUpload()
self.switchToUploader()
@@ -341,12 +341,12 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# Source publication and build record for breezy-i386
# distroarchseries were created as expected. The source is ready
# to receive the binary upload.
- pub_bar = self.name16.archive.getPublishedSources(name=u'bar').one()
- self.assertEqual(pub_bar.sourcepackagerelease.version, u'1.0-1')
+ pub_bar = self.name16.archive.getPublishedSources(name='bar').one()
+ self.assertEqual(pub_bar.sourcepackagerelease.version, '1.0-1')
self.assertEqual(pub_bar.status, PackagePublishingStatus.PENDING)
self.assertEqual(pub_bar.component.name, 'main')
- [build] = self.name16.archive.getBuildRecords(name=u'bar')
+ [build] = self.name16.archive.getBuildRecords(name='bar')
self.assertEqual(
build.title, 'i386 build of bar 1.0-1 in ubuntu breezy RELEASE')
self.assertEqual(build.status.name, 'NEEDSBUILD')
@@ -360,8 +360,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# The binary upload was accepted and it's waiting in the queue.
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.ACCEPTED, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
self.assertEqual(queue_items.count(), 1)
# All the files associated with this binary upload must be in the
@@ -392,7 +392,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# Copy source uploaded to name16 PPA to cprov's PPA.
name16_pub_bar = self.name16.archive.getPublishedSources(
- name=u'bar').one()
+ name='bar').one()
cprov = getUtility(IPersonSet).getByName("cprov")
cprov_pub_bar = name16_pub_bar.copyTo(
self.breezy, PackagePublishingPocket.RELEASE, cprov.archive)
@@ -414,8 +414,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# The binary upload was accepted and it's waiting in the queue.
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=cprov.archive)
+ status=PackageUploadStatus.ACCEPTED, name="bar",
+ version="1.0-1", exact_match=True, archive=cprov.archive)
self.assertEqual(queue_items.count(), 1)
def testUploadDoesNotEmailMaintainerOrChangedBy(self):
@@ -493,8 +493,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
PackageUploadStatus.DONE)
[queue_item] = hoary.getPackageUploads(
- status=PackageUploadStatus.DONE, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.DONE, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
self.assertEqual(queue_item.archive, self.name16.archive)
self.assertEqual(
@@ -521,15 +521,15 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
PackageUploadStatus.DONE)
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.DONE, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=ubuntu_team.archive)
+ status=PackageUploadStatus.DONE, name="bar",
+ version="1.0-1", exact_match=True, archive=ubuntu_team.archive)
self.assertEqual(queue_items.count(), 1)
pending_ppas = self.ubuntu.getPendingPublicationPPAs()
self.assertEqual(pending_ppas.count(), 1)
self.assertEqual(pending_ppas[0], ubuntu_team.archive)
- [build] = ubuntu_team.archive.getBuildRecords(name=u'bar')
+ [build] = ubuntu_team.archive.getBuildRecords(name='bar')
self.assertEqual(
build.title, 'i386 build of bar 1.0-1 in ubuntu breezy RELEASE')
self.assertEqual(build.status.name, 'NEEDSBUILD')
@@ -583,7 +583,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# source's component if the standard auto-overrides don't match
# an existing publication.
pub_foocomm = self.name16.archive.getPublishedSources(
- name=u'foocomm').one()
+ name='foocomm').one()
self.assertEqual(
pub_foocomm.sourcepackagerelease.component.name, 'partner')
self.assertEqual(pub_foocomm.component.name, 'main')
@@ -615,7 +615,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
"""
upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
self.processUpload(self.uploadprocessor, upload_dir)
- [build] = self.name16.archive.getBuildRecords(name=u"bar")
+ [build] = self.name16.archive.getBuildRecords(name="bar")
test_files_dir = os.path.join(
config.root, "lib/lp/archiveuploader/tests/data/")
@@ -626,7 +626,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.processUpload(self.build_uploadprocessor, upload_dir, build=build)
[queue_item] = self.breezy.getPackageUploads(
- name=u"debian-installer", status=PackageUploadStatus.ACCEPTED,
+ name="debian-installer", status=PackageUploadStatus.ACCEPTED,
archive=self.name16.archive)
return queue_item
@@ -659,13 +659,13 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.processUpload(self.uploadprocessor, upload_dir)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.DONE, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.DONE, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
self.checkFilesRestrictedInLibrarian(queue_item, True)
# Now that we have source uploaded, we can upload a build.
- [build] = self.name16.archive.getBuildRecords(name=u'bar')
+ [build] = self.name16.archive.getBuildRecords(name='bar')
self.options.context = 'buildd'
upload_dir = self.queueUpload("bar_1.0-1_binary", "~name16/ubuntu")
self.processUpload(
@@ -673,8 +673,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
# The binary upload was accepted and it's waiting in the queue.
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.ACCEPTED, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
# All the files associated with this binary upload must be in the
# restricted librarian as the PPA is private.
@@ -695,8 +695,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
"bar_1.0-1_contrib_component", "~name16/ubuntu")
self.processUpload(self.uploadprocessor, upload_dir)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.DONE, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.DONE, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
# The upload was accepted despite the fact that it does
# not have a valid component:
@@ -705,15 +705,15 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase):
self.breezy.upload_components)
# Binary uploads should exhibit the same behaviour:
- [build] = self.name16.archive.getBuildRecords(name=u"bar")
+ [build] = self.name16.archive.getBuildRecords(name="bar")
self.options.context = 'buildd'
upload_dir = self.queueUpload(
"bar_1.0-1_contrib_binary", "~name16/ubuntu")
self.processUpload(
self.build_uploadprocessor, upload_dir, build=build)
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.ACCEPTED, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
# The binary is accepted despite the fact that it does not have
# a valid component:
@@ -818,8 +818,8 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
PackageUploadStatus.NEW)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
queue_item.setAccepted()
queue_item.realiseUpload()
transaction.commit()
@@ -890,7 +890,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
PackageUploadStatus.DONE)
# The published section should be "devel" and not "web".
- pub_sources = self.name16.archive.getPublishedSources(name=u'bar')
+ pub_sources = self.name16.archive.getPublishedSources(name='bar')
[pub_bar2, pub_bar1] = pub_sources
section = pub_bar2.section.name
@@ -948,7 +948,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
than the one already in the PPA.
"""
# Ensure the displayname of the PPA has got unicode in it.
- self.name16.archive.displayname = u"unicode PPA name: áří"
+ self.name16.archive.displayname = "unicode PPA name: áří"
# Upload the first version.
upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
@@ -966,16 +966,16 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
# errors.
self.assertEqual(
self.uploadprocessor.last_processed_upload.rejection_message,
- u'File bar_1.0.orig.tar.gz already exists in unicode PPA name: '
- u'áří, but uploaded version has different '
- u'contents. See more information about this error in '
- u'https://help.launchpad.net/Packaging/UploadErrors.\n'
- u'File bar_1.0-1.diff.gz already exists in unicode PPA name: '
- u'áří, but uploaded version has different contents. See more '
- u'information about this error in '
- u'https://help.launchpad.net/Packaging/UploadErrors.\n'
- u'Files specified in DSC are broken or missing, skipping package '
- u'unpack verification.')
+ 'File bar_1.0.orig.tar.gz already exists in unicode PPA name: '
+ 'áří, but uploaded version has different '
+ 'contents. See more information about this error in '
+ 'https://help.launchpad.net/Packaging/UploadErrors.\n'
+ 'File bar_1.0-1.diff.gz already exists in unicode PPA name: '
+ 'áří, but uploaded version has different contents. See more '
+ 'information about this error in '
+ 'https://help.launchpad.net/Packaging/UploadErrors.\n'
+ 'Files specified in DSC are broken or missing, skipping package '
+ 'unpack verification.')
# Also, the email generated should be sane. Any of the multiple
# notifications will do.
@@ -994,7 +994,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
when a disabled PPA with a unicode display name gets an upload.
"""
# Ensure the displayname of the PPA has got unicode in it.
- self.name16.archive.displayname = u"unicode PPA name: áří"
+ self.name16.archive.displayname = "unicode PPA name: áří"
self.name16.archive.disable()
# Upload to disabled archive.
upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
@@ -1088,7 +1088,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
# Delete the published file.
self.switchToAdmin()
- bar_src = self.name16.archive.getPublishedSources(name=u"bar").one()
+ bar_src = self.name16.archive.getPublishedSources(name="bar").one()
bar_src.requestDeletion(self.name16)
bar_src.dateremoved = UTC_NOW
self.switchToUploader()
@@ -1128,8 +1128,8 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase):
PackageUploadStatus.NEW)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
queue_item.setAccepted()
queue_item.realiseUpload()
transaction.commit()
@@ -1266,7 +1266,7 @@ class TestPPAUploadProcessorQuotaChecks(TestPPAUploadProcessorBase):
# Retrieve the build record for source bar in breezy-i386
# distroarchseries, and setup a appropriate upload policy
# in preparation to the corresponding binary upload.
- [build] = self.name16.archive.getBuildRecords(name=u'bar')
+ [build] = self.name16.archive.getBuildRecords(name='bar')
self.options.context = 'buildd'
# Stuff 2048 MiB in name16 PPA, so anything will be above the
@@ -1279,8 +1279,8 @@ class TestPPAUploadProcessorQuotaChecks(TestPPAUploadProcessorBase):
# The binary upload was accepted, and it's waiting in the queue.
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, name=u"bar",
- version=u"1.0-1", exact_match=True, archive=self.name16.archive)
+ status=PackageUploadStatus.ACCEPTED, name="bar",
+ version="1.0-1", exact_match=True, archive=self.name16.archive)
self.assertEqual(queue_items.count(), 1)
def testArchiveBinarySize(self):
diff --git a/lib/lp/archiveuploader/tests/test_recipeuploads.py b/lib/lp/archiveuploader/tests/test_recipeuploads.py
index 49f204a..013f5ef 100644
--- a/lib/lp/archiveuploader/tests/test_recipeuploads.py
+++ b/lib/lp/archiveuploader/tests/test_recipeuploads.py
@@ -24,7 +24,7 @@ from lp.code.interfaces.sourcepackagerecipebuild import (
class TestSourcePackageRecipeBuildUploads(TestUploadProcessorBase):
def setUp(self):
- super(TestSourcePackageRecipeBuildUploads, self).setUp()
+ super().setUp()
self.setupBreezy()
diff --git a/lib/lp/archiveuploader/tests/test_snapupload.py b/lib/lp/archiveuploader/tests/test_snapupload.py
index a5b8702..f7a9e14 100644
--- a/lib/lp/archiveuploader/tests/test_snapupload.py
+++ b/lib/lp/archiveuploader/tests/test_snapupload.py
@@ -26,7 +26,7 @@ class TestSnapBuildUploads(TestUploadProcessorBase):
"""End-to-end tests of Snap build uploads."""
def setUp(self):
- super(TestSnapBuildUploads, self).setUp()
+ super().setUp()
self.setupBreezy()
diff --git a/lib/lp/archiveuploader/tests/test_uploadprocessor.py b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
index 72e1976..2b5be80 100644
--- a/lib/lp/archiveuploader/tests/test_uploadprocessor.py
+++ b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
@@ -142,7 +142,7 @@ class TestUploadProcessorBase(TestCaseWithFactory):
switch_dbuser("launchpad_main")
def setUp(self):
- super(TestUploadProcessorBase, self).setUp()
+ super().setUp()
self.queue_folder = tempfile.mkdtemp()
self.incoming_folder = os.path.join(self.queue_folder, "incoming")
@@ -174,7 +174,7 @@ class TestUploadProcessorBase(TestCaseWithFactory):
def tearDown(self):
shutil.rmtree(self.queue_folder)
self.switchToAdmin()
- super(TestUploadProcessorBase, self).tearDown()
+ super().tearDown()
def getUploadProcessor(self, txn, builds=None):
self.switchToAdmin()
@@ -550,7 +550,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
See bug 35965.
"""
- self.options.context = u'broken'
+ self.options.context = 'broken'
# Register our broken upload policy.
getGlobalSiteManager().registerUtility(
component=BrokenUploadPolicy, provided=IArchiveUploadPolicy,
@@ -613,8 +613,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# the same package will work correctly.
self.switchToAdmin()
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
self.assertEqual(queue_items.count(), 1)
queue_item = queue_items[0]
@@ -643,8 +643,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# And verify that the queue item is in the unapproved state.
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.UNAPPROVED, name=u"bar",
- version=u"1.0-2", exact_match=True)
+ status=PackageUploadStatus.UNAPPROVED, name="bar",
+ version="1.0-2", exact_match=True)
self.assertEqual(queue_items.count(), 1)
queue_item = queue_items[0]
self.assertEqual(
@@ -674,8 +674,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# Move the source from the accepted queue.
[queue_item] = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1",
- name=u"bar")
+ version="1.0-1",
+ name="bar")
queue_item.setDone()
# Upload and accept a binary for the primary archive source.
@@ -729,8 +729,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# ancestry. This means items should go to ACCEPTED and not NEW.
queue_items = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1",
- name=u"bar",
+ version="1.0-1",
+ name="bar",
archive=copy_archive)
self.assertEqual(
queue_items.count(), 1,
@@ -825,8 +825,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
self.processUpload(build_uploadprocessor, upload_dir,
build=bar_copied_build)
[duplicated_binary_upload] = breezy_autotest.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u'bar',
- version=u'1.0-1', exact_match=True)
+ status=PackageUploadStatus.NEW, name='bar',
+ version='1.0-1', exact_match=True)
# The just uploaded binary cannot be accepted because its
# filename 'bar_1.0-1_i386.deb' is already published in the
@@ -956,8 +956,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
PackageUploadStatus.NEW)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"foocomm",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="foocomm",
+ version="1.0-1", exact_match=True)
queue_item.setAccepted()
queue_item.realiseUpload()
self.layer.commit()
@@ -1119,15 +1119,15 @@ class TestUploadProcessor(TestUploadProcessorBase):
# with ancestry (previously uploaded) will skip the ACCEPTED state.
queue_items = self.breezy.getPackageUploads(
status=PackageUploadStatus.DONE,
- version=u"1.0-2",
- name=u"foocomm")
+ version="1.0-2",
+ name="foocomm")
self.assertEqual(queue_items.count(), 1)
# Single source uploads also get their corrsponding builds created
# at upload-time. 'foocomm' only builds in 'i386', thus only one
# build gets created.
foocomm_source = partner_archive.getPublishedSources(
- name=u'foocomm', version='1.0-2').one()
+ name='foocomm', version='1.0-2').one()
[build] = foocomm_source.sourcepackagerelease.builds
self.assertEqual(
build.title,
@@ -1142,8 +1142,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# Check that the binary upload was accepted:
queue_items = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-2",
- name=u"foocomm")
+ version="1.0-2",
+ name="foocomm")
self.assertEqual(queue_items.count(), 1)
def testPartnerUploadToProposedPocket(self):
@@ -1314,8 +1314,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
self.processUpload(uploadprocessor, upload_dir)
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
[queue_item] = queue_items
self.assertEqual(
queue_item.sourcepackagerelease.component.name,
@@ -1441,8 +1441,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# Check in the queue to see if it really made it:
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
self.assertEqual(
queue_items.count(), 1,
"Expected one 'bar' item in the queue, actually got %d."
@@ -1480,8 +1480,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
# Check in the queue to see if it really made it:
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
self.assertEqual(
queue_items.count(), 1,
"Expected one 'bar' item in the queue, actually got %d."
@@ -1611,7 +1611,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
# Make sure it failed.
self.assertEqual(
uploadprocessor.last_processed_upload.rejection_message,
- u"Signer is not permitted to upload to the component 'universe'.")
+ "Signer is not permitted to upload to the component 'universe'.")
# Now add permission to upload "bar" for name16.
self.switchToAdmin()
@@ -1676,7 +1676,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
ap_set = getUtility(IArchivePermissionSet)
ps_set = getUtility(IPackagesetSet)
foo_ps = ps_set.new(
- u'foo-pkg-set', u'Packages that require special care.', uploader,
+ 'foo-pkg-set', 'Packages that require special care.', uploader,
distroseries=self.ubuntu['grumpy'])
self.layer.txn.commit()
@@ -1707,7 +1707,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
# Grant the permissions in the proper series.
self.switchToAdmin()
breezy_ps = ps_set.new(
- u'foo-pkg-set-breezy', u'Packages that require special care.',
+ 'foo-pkg-set-breezy', 'Packages that require special care.',
uploader, distroseries=self.breezy)
breezy_ps.add((bar_package, ))
ap_set.newPackagesetUploader(
@@ -1969,8 +1969,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
self.processUpload(uploadprocessor, upload_dir)
# ACCEPT the upload
queue_items = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
self.assertEqual(queue_items.count(), 1)
self.switchToAdmin()
queue_item = queue_items[0]
@@ -2114,8 +2114,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
"recipient": None,
}], allow_leftover=True)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.NEW, name=u"bar",
- version=u"1.0-1", exact_match=True)
+ status=PackageUploadStatus.NEW, name="bar",
+ version="1.0-1", exact_match=True)
self.assertEqual(PackagePublishingPocket.PROPOSED, queue_item.pocket)
queue_item.acceptFromQueue()
@@ -2128,8 +2128,8 @@ class TestUploadProcessor(TestUploadProcessorBase):
"recipient": None,
}], allow_leftover=True)
[queue_item] = self.breezy.getPackageUploads(
- status=PackageUploadStatus.DONE, name=u"bar",
- version=u"1.0-2", exact_match=True)
+ status=PackageUploadStatus.DONE, name="bar",
+ version="1.0-2", exact_match=True)
self.assertEqual(PackagePublishingPocket.PROPOSED, queue_item.pocket)
def test_source_buildinfo(self):
@@ -2155,7 +2155,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
self.switchToAdmin()
[queue_item] = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1", name=u"bar")
+ version="1.0-1", name="bar")
queue_item.setDone()
build.buildqueue_record.markAsBuilding(self.factory.makeBuilder())
build.updateStatus(
@@ -2187,7 +2187,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
self.switchToAdmin()
[queue_item] = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1", name=u"bar")
+ version="1.0-1", name="bar")
queue_item.setDone()
build.buildqueue_record.markAsBuilding(self.factory.makeBuilder())
build.updateStatus(
@@ -2213,7 +2213,7 @@ class TestUploadProcessor(TestUploadProcessorBase):
class TestUploadHandler(TestUploadProcessorBase):
def setUp(self):
- super(TestUploadHandler, self).setUp()
+ super().setUp()
self.uploadprocessor = self.setupBreezyAndGetUploadProcessor()
def testInvalidLeafName(self):
@@ -2252,7 +2252,7 @@ class TestUploadHandler(TestUploadProcessorBase):
self.switchToAdmin()
[queue_item] = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1", name=u"bar")
+ version="1.0-1", name="bar")
queue_item.setDone()
builder = self.factory.makeBuilder()
@@ -2295,7 +2295,7 @@ class TestUploadHandler(TestUploadProcessorBase):
self.switchToAdmin()
[queue_item] = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1", name=u"bar")
+ version="1.0-1", name="bar")
queue_item.setDone()
build.buildqueue_record.markAsBuilding(self.factory.makeBuilder())
@@ -2328,7 +2328,7 @@ class TestUploadHandler(TestUploadProcessorBase):
self.switchToAdmin()
archive = self.factory.makeArchive()
archive.require_virtualized = False
- build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar",
+ build = self.factory.makeSourcePackageRecipeBuild(sourcename="bar",
distroseries=self.breezy, archive=archive,
requester=archive.owner)
self.assertEqual(archive.owner, build.requester)
@@ -2377,7 +2377,7 @@ class TestUploadHandler(TestUploadProcessorBase):
self.switchToAdmin()
archive = self.factory.makeArchive()
archive.require_virtualized = False
- build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar",
+ build = self.factory.makeSourcePackageRecipeBuild(sourcename="bar",
distroseries=self.breezy, archive=archive)
# Commit so the build cookie has the right ids.
Store.of(build).flush()
@@ -2418,7 +2418,7 @@ class TestUploadHandler(TestUploadProcessorBase):
self.switchToAdmin()
archive = self.factory.makeArchive()
archive.require_virtualized = False
- build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar",
+ build = self.factory.makeSourcePackageRecipeBuild(sourcename="bar",
distroseries=self.breezy, archive=archive)
self.switchToUploader()
# Commit so the build cookie has the right ids.
@@ -2480,7 +2480,7 @@ class TestUploadHandler(TestUploadProcessorBase):
self.switchToAdmin()
[queue_item] = self.breezy.getPackageUploads(
status=PackageUploadStatus.ACCEPTED,
- version=u"1.0-1", name=u"bar")
+ version="1.0-1", name="bar")
queue_item.setDone()
pop_notifications()
diff --git a/lib/lp/archiveuploader/tests/test_utils.py b/lib/lp/archiveuploader/tests/test_utils.py
index 03ed90e..e65a6b5 100755
--- a/lib/lp/archiveuploader/tests/test_utils.py
+++ b/lib/lp/archiveuploader/tests/test_utils.py
@@ -5,8 +5,6 @@
import os
-import six
-
from lp.archiveuploader.tests import datadir
from lp.archiveuploader.utils import (
determine_binary_file_type,
@@ -170,54 +168,54 @@ class TestUtilities(TestCase):
)
cases = (
(b"No\xc3\xa8l K\xc3\xb6the <noel@xxxxxxxxxx>",
- u"No\xe8l K\xf6the <noel@xxxxxxxxxx>",
- u"No\xe8l K\xf6the",
- u"noel@xxxxxxxxxx"),
+ "No\xe8l K\xf6the <noel@xxxxxxxxxx>",
+ "No\xe8l K\xf6the",
+ "noel@xxxxxxxxxx"),
(b"No\xe8l K\xf6the <noel@xxxxxxxxxx>",
- u"No\xe8l K\xf6the <noel@xxxxxxxxxx>",
- u"No\xe8l K\xf6the",
- u"noel@xxxxxxxxxx"),
+ "No\xe8l K\xf6the <noel@xxxxxxxxxx>",
+ "No\xe8l K\xf6the",
+ "noel@xxxxxxxxxx"),
("James Troup <james@xxxxxxxxxx>",
- u"James Troup <james@xxxxxxxxxx>",
- u"James Troup",
- u"james@xxxxxxxxxx"),
+ "James Troup <james@xxxxxxxxxx>",
+ "James Troup",
+ "james@xxxxxxxxxx"),
("James J. Troup <james@xxxxxxxxxx>",
- u"james@xxxxxxxxxx (James J. Troup)",
- u"James J. Troup",
- u"james@xxxxxxxxxx"),
+ "james@xxxxxxxxxx (James J. Troup)",
+ "James J. Troup",
+ "james@xxxxxxxxxx"),
("James J, Troup <james@xxxxxxxxxx>",
- u"james@xxxxxxxxxx (James J, Troup)",
- u"James J, Troup",
- u"james@xxxxxxxxxx"),
+ "james@xxxxxxxxxx (James J, Troup)",
+ "James J, Troup",
+ "james@xxxxxxxxxx"),
("james@xxxxxxxxxx",
- u" <james@xxxxxxxxxx>",
- u"",
- u"james@xxxxxxxxxx"),
+ " <james@xxxxxxxxxx>",
+ "",
+ "james@xxxxxxxxxx"),
("<james@xxxxxxxxxx>",
- u" <james@xxxxxxxxxx>",
- u"",
- u"james@xxxxxxxxxx"),
+ " <james@xxxxxxxxxx>",
+ "",
+ "james@xxxxxxxxxx"),
("Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>",
- u"Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>",
- u"Cris van Pelt",
- u"\"Cris van Pelt\"@tribe.eu.org"),
+ "Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>",
+ "Cris van Pelt",
+ "\"Cris van Pelt\"@tribe.eu.org"),
("Zak B. Elep <zakame@xxxxxxxxxx>",
- u"zakame@xxxxxxxxxx (Zak B. Elep)",
- u"Zak B. Elep",
- u"zakame@xxxxxxxxxx"),
+ "zakame@xxxxxxxxxx (Zak B. Elep)",
+ "Zak B. Elep",
+ "zakame@xxxxxxxxxx"),
("zakame@xxxxxxxxxx (Zak B. Elep)",
- u" <zakame@xxxxxxxxxx (Zak B. Elep)>",
- u"",
- u"zakame@xxxxxxxxxx (Zak B. Elep)"),
+ " <zakame@xxxxxxxxxx (Zak B. Elep)>",
+ "",
+ "zakame@xxxxxxxxxx (Zak B. Elep)"),
)
for case in cases:
@@ -253,7 +251,7 @@ class TestUtilities(TestCase):
try:
parse_maintainer_bytes(case[0], 'Maintainer')
except ParseMaintError as e:
- self.assertEqual(case[1], six.text_type(e))
+ self.assertEqual(case[1], str(e))
else:
self.fail('ParseMaintError not raised')
diff --git a/lib/lp/archiveuploader/uploadpolicy.py b/lib/lp/archiveuploader/uploadpolicy.py
index 88a363d..1151deb 100644
--- a/lib/lp/archiveuploader/uploadpolicy.py
+++ b/lib/lp/archiveuploader/uploadpolicy.py
@@ -190,7 +190,7 @@ class InsecureUploadPolicy(AbstractUploadPolicy):
accepted_type = ArchiveUploadType.SOURCE_ONLY
def __init__(self):
- super(InsecureUploadPolicy, self).__init__()
+ super().__init__()
# Signatures on source buildinfo files aren't a big deal, and older
# versions of debsign didn't produce them.
self.unsigned_buildinfo_ok = True
@@ -201,7 +201,7 @@ class InsecureUploadPolicy(AbstractUploadPolicy):
The insecure policy redirects uploads to a different pocket if
Distribution.redirect_release_uploads is set.
"""
- super(InsecureUploadPolicy, self).setDistroSeriesAndPocket(dr_name)
+ super().setDistroSeriesAndPocket(dr_name)
if (self.archive.purpose == ArchivePurpose.PRIMARY and
self.distro.redirect_release_uploads and
self.pocket == PackagePublishingPocket.RELEASE):
@@ -292,7 +292,7 @@ class BuildDaemonUploadPolicy(AbstractUploadPolicy):
name = 'buildd'
def __init__(self):
- super(BuildDaemonUploadPolicy, self).__init__()
+ super().__init__()
# We permit unsigned uploads because we trust our build daemons
self.unsigned_changes_ok = True
self.unsigned_dsc_ok = True
@@ -300,7 +300,7 @@ class BuildDaemonUploadPolicy(AbstractUploadPolicy):
def setOptions(self, options):
"""Store the options for later."""
- super(BuildDaemonUploadPolicy, self).setOptions(options)
+ super().setOptions(options)
options.builds = True
def policySpecificChecks(self, upload):
diff --git a/lib/lp/archiveuploader/uploadprocessor.py b/lib/lp/archiveuploader/uploadprocessor.py
index c5341b0..b71d0aa 100644
--- a/lib/lp/archiveuploader/uploadprocessor.py
+++ b/lib/lp/archiveuploader/uploadprocessor.py
@@ -555,7 +555,7 @@ class BuildUploadHandler(UploadHandler):
will be retrieved using the id in the upload.
:raises: CannotGetBuild if the build could not be retrieved.
"""
- super(BuildUploadHandler, self).__init__(processor, fsroot, upload)
+ super().__init__(processor, fsroot, upload)
self.build = build
if self.build is None:
self.build = self._getBuild()
diff --git a/lib/lp/archiveuploader/utils.py b/lib/lp/archiveuploader/utils.py
index 5ff24d2..94e61df 100644
--- a/lib/lp/archiveuploader/utils.py
+++ b/lib/lp/archiveuploader/utils.py
@@ -56,7 +56,7 @@ class DpkgSourceError(Exception):
_fmt = "Unable to unpack source package (%(result)s): %(output)s"
def __init__(self, command, output, result):
- super(DpkgSourceError, self).__init__(
+ super().__init__(
self._fmt % {
"output": output, "result": result, "command": command})
self.output = output
@@ -179,14 +179,14 @@ def parse_maintainer(maintainer, field_name="Maintainer"):
"""
maintainer = maintainer.strip()
if not maintainer:
- return (u'', u'')
+ return ('', '')
- if maintainer.find(u"<") == -1:
+ if maintainer.find("<") == -1:
email = maintainer
- name = u""
- elif (maintainer[0] == u"<" and maintainer[-1:] == u">"):
+ name = ""
+ elif (maintainer[0] == "<" and maintainer[-1:] == ">"):
email = maintainer[1:-1]
- name = u""
+ name = ""
else:
m = re_parse_maintainer.match(maintainer)
if not m:
@@ -195,10 +195,10 @@ def parse_maintainer(maintainer, field_name="Maintainer"):
name = m.group(1)
email = m.group(2)
# Just in case the maintainer ended up with nested angles; check...
- while email.startswith(u"<"):
+ while email.startswith("<"):
email = email[1:]
- if email.find(u"@") == -1 and email.find(u"buildd_") != 0:
+ if email.find("@") == -1 and email.find("buildd_") != 0:
raise ParseMaintError("%s: no @ found in email address part."
% maintainer)
@@ -211,7 +211,7 @@ def parse_maintainer_bytes(content, fieldname):
It verifies the content type and transforms it to text with
guess(). Then we can safely call parse_maintainer().
"""
- if not isinstance(content, six.text_type):
+ if not isinstance(content, str):
content = guess_encoding(content)
return parse_maintainer(content, fieldname)
@@ -231,10 +231,10 @@ def rfc822_encode_address(name, email):
# not work directly as an email address due to a misfeature in the syntax
# specified in RFC822; see Debian policy 5.6.2 (Maintainer field syntax)
# for details.
- if name.find(u',') != -1 or name.find(u'.') != -1:
- return u"%s (%s)" % (email, name)
+ if name.find(',') != -1 or name.find('.') != -1:
+ return "%s (%s)" % (email, name)
else:
- return u"%s <%s>" % (name, email)
+ return "%s <%s>" % (name, email)
def extract_dpkg_source(dsc_filepath, target, vendor=None):
@@ -324,7 +324,7 @@ def merge_file_lists(files, checksums_sha1, checksums_sha256, changes=True):
(filename, file_hashes[filename], size))
# Ensure that each filename was only listed in Files once.
- if set(six.itervalues(file_counter)) - {1}:
+ if set(file_counter.values()) - {1}:
raise UploadError("Duplicate filenames in Files field.")
# Ensure that the Checksums-Sha1 and Checksums-Sha256 fields, if