launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27852
[Merge] ~cjwatson/launchpad:pyupgrade-py3-codehosting into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pyupgrade-py3-codehosting into launchpad:master.
Commit message:
lp.codehosting: Apply "pyupgrade --py3-plus"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413400
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pyupgrade-py3-codehosting into launchpad:master.
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 4691daf..2e06d20 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -24,3 +24,5 @@ b6725842a2470e3927bb73bf400c4476a06ee3ba
47ee1259461aa54ad7ee967e85f6131be2b74125
# apply pyupgrade --py3-plus to lp.code
cee9b128d3e49ca814464eeeeec50e6bcabcc4ba
+# apply pyupgrade --py3-plus to lp.codehosting
+f36fe66e5e5a5e82ba8c3269e32d76bd573d1175
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d82d7fe..77a3d08 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -49,6 +49,7 @@ repos:
|buildmaster
|charms
|code
+ |codehosting
)/
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
diff --git a/lib/lp/codehosting/bzrutils.py b/lib/lp/codehosting/bzrutils.py
index f9fddaf..8df9813 100644
--- a/lib/lp/codehosting/bzrutils.py
+++ b/lib/lp/codehosting/bzrutils.py
@@ -192,7 +192,7 @@ class BazaarOopsRequest(ScriptRequest):
:param user_id: The database ID of the user doing this.
"""
data = [('user_id', user_id)]
- super(BazaarOopsRequest, self).__init__(data, URL=None)
+ super().__init__(data, URL=None)
def make_error_utility(pid=None):
@@ -229,8 +229,7 @@ class HttpAsLocalTransport(LocalTransport):
def __init__(self, http_url):
file_url = URI(
scheme='file', host='', path=URI(http_url).path)
- return super(HttpAsLocalTransport, self).__init__(
- str(file_url))
+ return super().__init__(str(file_url))
@classmethod
def register(cls):
diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
index 5835dc1..becf674 100644
--- a/lib/lp/codehosting/inmemory.py
+++ b/lib/lp/codehosting/inmemory.py
@@ -299,7 +299,7 @@ class FakeTeam(FakePerson):
is_team = True
def __init__(self, name, members=None):
- super(FakeTeam, self).__init__(name)
+ super().__init__(name)
if members is None:
self._members = []
else:
@@ -400,7 +400,7 @@ class FakeObjectFactory(ObjectFactory):
def __init__(self, branch_set, person_set, product_set, distribution_set,
distroseries_set, sourcepackagename_set):
- super(FakeObjectFactory, self).__init__()
+ super().__init__()
self._branch_set = branch_set
self._person_set = person_set
self._product_set = product_set
diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py
index f6a6538..1680e65 100644
--- a/lib/lp/codehosting/puller/scheduler.py
+++ b/lib/lp/codehosting/puller/scheduler.py
@@ -466,7 +466,7 @@ class JobScheduler:
class LockError(Exception):
def __init__(self, lockfilename):
- super(LockError, self).__init__()
+ super().__init__()
self.lockfilename = lockfilename
def __str__(self):
diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py
index 6a32406..340a11c 100644
--- a/lib/lp/codehosting/puller/tests/__init__.py
+++ b/lib/lp/codehosting/puller/tests/__init__.py
@@ -6,7 +6,6 @@
import io
import os
import shutil
-import socket
from breezy.tests import TestCaseWithTransport
from breezy.tests.http_server import (
@@ -67,7 +66,7 @@ def fixed_handle_request(self):
"""Handle one request, possibly blocking. """
try:
request, client_address = self.get_request()
- except socket.error:
+ except OSError:
return
if self.verify_request(request, client_address):
try:
@@ -94,7 +93,7 @@ class PullerBranchTestCase(TestCaseWithTransport, TestCaseWithFactory,
"""Some useful code for the more-integration-y puller tests."""
def setUp(self):
- super(PullerBranchTestCase, self).setUp()
+ super().setUp()
self.disable_directory_isolation()
def makeCleanDirectory(self, path):
diff --git a/lib/lp/codehosting/puller/tests/test_scheduler.py b/lib/lp/codehosting/puller/tests/test_scheduler.py
index 3205446..7be95b6 100644
--- a/lib/lp/codehosting/puller/tests/test_scheduler.py
+++ b/lib/lp/codehosting/puller/tests/test_scheduler.py
@@ -72,14 +72,14 @@ class FakeCodehostingEndpointProxy:
class TestJobScheduler(TestCase):
def setUp(self):
- super(TestJobScheduler, self).setUp()
+ super().setUp()
self.masterlock = 'master.lock'
def tearDown(self):
reset_logging()
if os.path.exists(self.masterlock):
os.unlink(self.masterlock)
- super(TestJobScheduler, self).tearDown()
+ super().tearDown()
def makeJobScheduler(self, branch_type_names=()):
return scheduler.JobScheduler(
@@ -140,7 +140,7 @@ class TestPullerWireProtocol(TestCase):
self.failure = failure
def setUp(self):
- super(TestPullerWireProtocol, self).setUp()
+ super().setUp()
self.puller_protocol = self.StubPullerProtocol()
self.protocol = scheduler.PullerWireProtocol(self.puller_protocol)
self.protocol.makeConnection(self.StubTransport())
@@ -153,7 +153,7 @@ class TestPullerWireProtocol(TestCase):
"""Send each element of `arguments` to the protocol as a netstring."""
for argument in arguments:
if not isinstance(argument, bytes):
- argument = six.text_type(argument).encode('UTF-8')
+ argument = str(argument).encode('UTF-8')
self.protocol.dataReceived(self.convertToNetstring(argument))
def assertUnexpectedErrorCalled(self, exception_type):
@@ -256,7 +256,7 @@ class TestPullerMonitorProtocol(ProcessTestsMixin, TestCase):
def setUp(self):
self.listener = self.StubPullerListener()
- super(TestPullerMonitorProtocol, self).setUp()
+ super().setUp()
def assertProtocolSuccess(self):
"""Assert that the protocol saw no unexpected errors."""
@@ -427,7 +427,7 @@ class TestPullerMaster(TestCase):
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(TestPullerMaster, self).setUp()
+ super().setUp()
self.status_client = FakeCodehostingEndpointProxy()
self.arbitrary_branch_id = 1
self.eventHandler = scheduler.PullerMaster(
@@ -502,7 +502,7 @@ class TestPullerMasterSpawning(TestCase):
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(TestPullerMasterSpawning, self).setUp()
+ super().setUp()
self.eventHandler = self.makePullerMaster('HOSTED')
self.patch(reactor, 'spawnProcess', self.spawnProcess)
self.commands_spawned = []
@@ -564,7 +564,7 @@ class TestPullerMasterIntegration(PullerBranchTestCase):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
def setUp(self):
- super(TestPullerMasterIntegration, self).setUp()
+ super().setUp()
self.makeCleanDirectory(config.codehosting.mirrored_branches_root)
self.bzr_tree = self.make_branch_and_tree('src-branch')
url = urljoin(self.serveOverHTTP(), 'src-branch')
diff --git a/lib/lp/codehosting/puller/tests/test_worker.py b/lib/lp/codehosting/puller/tests/test_worker.py
index e412ba5..7ea9daf 100644
--- a/lib/lp/codehosting/puller/tests/test_worker.py
+++ b/lib/lp/codehosting/puller/tests/test_worker.py
@@ -84,7 +84,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
"""Test the mirroring functionality of PullerWorker."""
def setUp(self):
- super(TestPullerWorker, self).setUp()
+ super().setUp()
BranchOpener.install_hook()
def test_mirror_opener_with_stacked_on_url(self):
@@ -275,7 +275,7 @@ class TestReferenceOpener(TestCaseWithTransport):
"""Feature tests for safe opening of branch references."""
def setUp(self):
- super(TestReferenceOpener, self).setUp()
+ super().setUp()
BranchOpener.install_hook()
def createBranchReference(self, url):
@@ -337,7 +337,7 @@ class TestMirroredBranchPolicy(TestCase):
"""Tests specific to `MirroredBranchPolicy`."""
def setUp(self):
- super(TestMirroredBranchPolicy, self).setUp()
+ super().setUp()
self.factory = LaunchpadObjectFactory()
def testNoFileURL(self):
@@ -494,7 +494,7 @@ class TestWorkerProgressReporting(TestCaseWithTransport):
self.calls.append(type)
def setUp(self):
- super(TestWorkerProgressReporting, self).setUp()
+ super().setUp()
BranchOpener.install_hook()
self.saved_factory = breezy.ui.ui_factory
self.disable_directory_isolation()
diff --git a/lib/lp/codehosting/puller/worker.py b/lib/lp/codehosting/puller/worker.py
index fb3c21a..75cb919 100644
--- a/lib/lp/codehosting/puller/worker.py
+++ b/lib/lp/codehosting/puller/worker.py
@@ -2,7 +2,6 @@
# GNU Affero General Public License version 3 (see the file LICENSE).
import http.client
-import socket
import sys
@@ -115,7 +114,7 @@ class PullerWorkerProtocol:
self.sendNetstring(str(len(args)))
for argument in args:
if not isinstance(argument, bytes):
- argument = six.text_type(argument).encode('UTF-8')
+ argument = str(argument).encode('UTF-8')
self.sendNetstring(argument)
def startMirroring(self):
@@ -178,7 +177,7 @@ class BranchMirrorerPolicy(BranchOpenPolicy):
return None
-class BranchMirrorer(object):
+class BranchMirrorer:
"""A `BranchMirrorer` safely makes mirrors of branches.
A `BranchMirrorer` has a `BranchOpenPolicy` to tell it which URLs are safe
@@ -399,7 +398,7 @@ class PullerWorker:
msg = "Authentication required."
self._mirrorFailed(msg)
- except socket.error as e:
+ except OSError as e:
msg = 'A socket error occurred: %s' % str(e)
self._mirrorFailed(msg)
diff --git a/lib/lp/codehosting/scanner/buglinks.py b/lib/lp/codehosting/scanner/buglinks.py
index 8b93ccd..33a18ed 100644
--- a/lib/lp/codehosting/scanner/buglinks.py
+++ b/lib/lp/codehosting/scanner/buglinks.py
@@ -8,7 +8,6 @@ __all__ = [
]
from breezy.bugtracker import InvalidBugStatus
-import six
from six.moves.urllib.parse import urlsplit
from zope.component import getUtility
@@ -77,7 +76,7 @@ class BugBranchLinker:
except InvalidBugStatus:
return
bug_set = getUtility(IBugSet)
- for bug_id, status in six.iteritems(bug_info):
+ for bug_id, status in bug_info.items():
try:
bug = bug_set.get(bug_id)
except NotFoundError:
diff --git a/lib/lp/codehosting/scanner/bzrsync.py b/lib/lp/codehosting/scanner/bzrsync.py
index 1f60b07..4847e37 100755
--- a/lib/lp/codehosting/scanner/bzrsync.py
+++ b/lib/lp/codehosting/scanner/bzrsync.py
@@ -306,7 +306,7 @@ class BzrSync:
"""Insert a batch of BranchRevision rows."""
self.logger.info("Inserting %d branchrevision records.",
len(revids_to_insert))
- revid_seq_pairs = six.iteritems(revids_to_insert)
+ revid_seq_pairs = revids_to_insert.items()
for revid_seq_pair_chunk in iter_chunks(revid_seq_pairs, 10000):
self.db_branch.createBranchRevisionFromIDs(revid_seq_pair_chunk)
diff --git a/lib/lp/codehosting/scanner/tests/test_buglinks.py b/lib/lp/codehosting/scanner/tests/test_buglinks.py
index 17cdd5f..790a9af 100644
--- a/lib/lp/codehosting/scanner/tests/test_buglinks.py
+++ b/lib/lp/codehosting/scanner/tests/test_buglinks.py
@@ -113,7 +113,7 @@ class TestBugLinking(BzrSyncTestCase):
BzrSyncTestCase.setUp(self)
def makeFixtures(self):
- super(TestBugLinking, self).makeFixtures()
+ super().makeFixtures()
self.bug1 = self.factory.makeBug()
sp = self.factory.makeSourcePackage(publish=True)
self.bug1.addTask(self.bug1.owner, sp)
@@ -192,7 +192,7 @@ class TestBugLinking(BzrSyncTestCase):
# required to generate the revision-id.
with override_environ(BRZ_EMAIL='me@xxxxxxxxxxx'):
self.bzr_tree.commit(
- u'common parent', committer=author, rev_id=b'r1',
+ 'common parent', committer=author, rev_id=b'r1',
allow_pointless=True)
# Branch from the base revision.
@@ -201,17 +201,17 @@ class TestBugLinking(BzrSyncTestCase):
# Commit to both branches
self.bzr_tree.commit(
- u'commit one', committer=author, rev_id=b'r2',
+ 'commit one', committer=author, rev_id=b'r2',
allow_pointless=True)
new_tree.commit(
- u'commit two', committer=author, rev_id=b'r1.1.1',
+ 'commit two', committer=author, rev_id=b'r1.1.1',
allow_pointless=True,
revprops={'bugs': '%s fixed' % self.getBugURL(self.bug1)})
# Merge and commit.
self.bzr_tree.merge_from_branch(new_tree.branch)
self.bzr_tree.commit(
- u'merge', committer=author, rev_id=b'r3',
+ 'merge', committer=author, rev_id=b'r3',
allow_pointless=True)
self.syncBazaarBranchToDatabase(self.bzr_branch, self.db_branch)
diff --git a/lib/lp/codehosting/scanner/tests/test_bzrsync.py b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
index 7fe8ad3..6d6fba5 100644
--- a/lib/lp/codehosting/scanner/tests/test_bzrsync.py
+++ b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
@@ -91,7 +91,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
LOG = "Log message"
def setUp(self):
- super(BzrSyncTestCase, self).setUp()
+ super().setUp()
BranchOpener.install_hook()
self.disable_directory_isolation()
self.useBzrBranches(direct_database=True)
@@ -101,7 +101,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
self.addCleanup(Store.of(self.db_branch).flush)
def tearDown(self):
- super(BzrSyncTestCase, self).tearDown()
+ super().tearDown()
def makeFixtures(self):
"""Makes test fixtures before we switch to the scanner db user."""
@@ -243,7 +243,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
# XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
# required to generate the revision-id.
with override_environ(BRZ_EMAIL='me@xxxxxxxxxxx'):
- trunk_tree.commit(u'base revision', rev_id=base_rev_id)
+ trunk_tree.commit('base revision', rev_id=base_rev_id)
# Branch from the base revision.
new_db_branch = self.makeDatabaseBranch(
@@ -253,12 +253,12 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
branch_tree.pull(trunk_tree.branch)
# Commit to both branches.
- trunk_tree.commit(u'trunk revision', rev_id=trunk_rev_id)
- branch_tree.commit(u'branch revision', rev_id=branch_rev_id)
+ trunk_tree.commit('trunk revision', rev_id=trunk_rev_id)
+ branch_tree.commit('branch revision', rev_id=branch_rev_id)
# Merge branch into trunk.
trunk_tree.merge_from_branch(branch_tree.branch)
- trunk_tree.commit(u'merge revision', rev_id=merge_rev_id)
+ trunk_tree.commit('merge revision', rev_id=merge_rev_id)
return (db_branch, trunk_tree), (new_db_branch, branch_tree)
diff --git a/lib/lp/codehosting/scanner/tests/test_mergedetection.py b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
index 4d3a93d..07dcf12 100644
--- a/lib/lp/codehosting/scanner/tests/test_mergedetection.py
+++ b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
@@ -143,7 +143,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
# XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
# required to generate the revision-id.
with override_environ(BRZ_EMAIL='me@xxxxxxxxxxx'):
- branch_tree.commit(u'another revision', rev_id=b'another-rev')
+ branch_tree.commit('another revision', rev_id=b'another-rev')
current_proposal_status = proposal.queue_status
self.assertNotEqual(
current_proposal_status,
@@ -164,7 +164,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
# XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
# required to generate the revision-id.
with override_environ(BRZ_EMAIL='me@xxxxxxxxxxx'):
- branch_tree.commit(u'another revision', rev_id=b'another-rev')
+ branch_tree.commit('another revision', rev_id=b'another-rev')
current_proposal_status = proposal.queue_status
self.assertNotEqual(
current_proposal_status,
diff --git a/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py b/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py
index 6d1faf2..7683988 100644
--- a/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py
+++ b/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py
@@ -154,7 +154,7 @@ class TestModifiedBranchesUpdateLocations(TestCase):
"""Test the path splitting an reassebly adding to locations."""
def setUp(self):
- super(TestModifiedBranchesUpdateLocations, self).setUp()
+ super().setUp()
self.script = ModifiedBranchesScript(
'modified-branches', test_args=['--last-hours=12'])
diff --git a/lib/lp/codehosting/scripts/tests/test_sync_branches.py b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
index 938b73f..f085078 100644
--- a/lib/lp/codehosting/scripts/tests/test_sync_branches.py
+++ b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
@@ -41,7 +41,7 @@ class BranchSyncProcessMatches(MatchesListwise):
def __init__(self, branch):
branch_path = branch_id_to_path(branch.id)
- super(BranchSyncProcessMatches, self).__init__([
+ super().__init__([
Equals(([
"rsync", "-a", "--delete-after",
"bazaar.launchpad.net::mirrors/%s/" % branch_path,
@@ -57,7 +57,7 @@ class TestSyncBranches(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestSyncBranches, self).setUp()
+ super().setUp()
self.tempdir = self.useFixture(TempDir()).path
self.pushConfig("codehosting", mirrored_branches_root=self.tempdir)
self.mock_check_output = self.useFixture(
diff --git a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
index b8c5578..d552e0b 100644
--- a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
+++ b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
@@ -25,7 +25,7 @@ class TestUpgradeAllBranchesScript(TestCaseWithFactory):
layer = AppServerLayer
def setUp(self):
- super(TestUpgradeAllBranchesScript, self).setUp()
+ super().setUp()
# useBzrBranches changes cwd
self.cwd = os.getcwd()
diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py
index 8e6f9cd..238dcb8 100644
--- a/lib/lp/codehosting/sftp.py
+++ b/lib/lp/codehosting/sftp.py
@@ -30,7 +30,6 @@ from breezy import (
)
from breezy.transport.local import LocalTransport
from lazr.sshserver.sftp import FileIsADirectory
-import six
from twisted.conch.interfaces import (
ISFTPFile,
ISFTPServer,
@@ -97,7 +96,7 @@ def with_sftp_error(func):
return util.mergeFunctionMetadata(func, decorator)
-class DirectoryListing(six.Iterator):
+class DirectoryListing:
"""Class to satisfy openDirectory return interface.
openDirectory returns an iterator -- with a `close` method. Hence
diff --git a/lib/lp/codehosting/sshserver/session.py b/lib/lp/codehosting/sshserver/session.py
index 88d8836..9dc9a5d 100644
--- a/lib/lp/codehosting/sshserver/session.py
+++ b/lib/lp/codehosting/sshserver/session.py
@@ -39,7 +39,7 @@ class ExecOnlySession(DoNothingSession):
"""Conch session that only allows executing commands."""
def __init__(self, avatar, reactor, environment=None):
- super(ExecOnlySession, self).__init__(avatar)
+ super().__init__(avatar)
self.reactor = reactor
self.environment = environment
self._transport = None
diff --git a/lib/lp/codehosting/tests/helpers.py b/lib/lp/codehosting/tests/helpers.py
index 8c581b1..bb4a256 100644
--- a/lib/lp/codehosting/tests/helpers.py
+++ b/lib/lp/codehosting/tests/helpers.py
@@ -33,7 +33,7 @@ class AvatarTestCase(TestCase):
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(AvatarTestCase, self).setUp()
+ super().setUp()
# A basic user dict, 'alice' is a member of no teams (aside from the
# user themself).
self.aliceUserDict = {
diff --git a/lib/lp/codehosting/tests/servers.py b/lib/lp/codehosting/tests/servers.py
index fd9ead3..2bfa45e 100644
--- a/lib/lp/codehosting/tests/servers.py
+++ b/lib/lp/codehosting/tests/servers.py
@@ -50,7 +50,7 @@ def set_up_test_user(test_user, test_team):
class CodeHostingTac(TacTestSetup):
def __init__(self, mirrored_area):
- super(CodeHostingTac, self).__init__()
+ super().__init__()
# The mirrored area.
self._mirror_root = mirrored_area
# Where the pidfile, logfile etc will go.
diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
index 7189670..0beee84 100644
--- a/lib/lp/codehosting/tests/test_acceptance.py
+++ b/lib/lp/codehosting/tests/test_acceptance.py
@@ -100,7 +100,7 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
scheme = None
def setUp(self):
- super(SSHTestCase, self).setUp()
+ super().setUp()
self.disable_directory_isolation()
tac_handler = SSHServerLayer.getTacHandler()
self.server = SSHCodeHostingServer(self.scheme, tac_handler)
@@ -268,7 +268,7 @@ class SmokeTest(WithScenarios, SSHTestCase):
def setUp(self):
self.scheme = 'bzr+ssh'
- super(SmokeTest, self).setUp()
+ super().setUp()
self.first_tree = 'first'
self.second_tree = 'second'
diff --git a/lib/lp/codehosting/tests/test_bzrutils.py b/lib/lp/codehosting/tests/test_bzrutils.py
index b4cba97..33e0dfa 100644
--- a/lib/lp/codehosting/tests/test_bzrutils.py
+++ b/lib/lp/codehosting/tests/test_bzrutils.py
@@ -71,7 +71,7 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
"""
if result is None:
result = self.defaultTestResult()
- super(TestGetBranchStackedOnURL, self).run(TestResultWrapper(result))
+ super().run(TestResultWrapper(result))
def testGetBranchStackedOnUrl(self):
# get_branch_stacked_on_url returns the URL of the stacked-on branch.
@@ -212,7 +212,7 @@ class TestGetVfsFormatClasses(TestCaseWithTransport):
"""
def setUp(self):
- super(TestGetVfsFormatClasses, self).setUp()
+ super().setUp()
self.disable_directory_isolation()
# This makes sure the connections held by the branches opened in the
# test are dropped, so the daemon threads serving those branches can
diff --git a/lib/lp/codehosting/tests/test_rewrite.py b/lib/lp/codehosting/tests/test_rewrite.py
index 047715b..288f1cb 100644
--- a/lib/lp/codehosting/tests/test_rewrite.py
+++ b/lib/lp/codehosting/tests/test_rewrite.py
@@ -36,7 +36,7 @@ class TestBranchRewriter(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBranchRewriter, self).setUp()
+ super().setUp()
self.fake_time = FakeTime(0)
def makeRewriter(self):
@@ -217,7 +217,7 @@ class TestBranchRewriter(TestCaseWithFactory):
rewriter = self.makeRewriter()
branch = self.factory.makeAnyBranch()
transaction.commit()
- id_path = (branch.id, u'/.bzr/README',)
+ id_path = (branch.id, '/.bzr/README',)
result = rewriter._getBranchIdAndTrailingPath(
'/' + branch.unique_name + '/.bzr/README')
self.assertEqual(id_path + ('MISS',), result)
diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py
index 240892b..65e5494 100644
--- a/lib/lp/codehosting/vfs/branchfs.py
+++ b/lib/lp/codehosting/vfs/branchfs.py
@@ -420,12 +420,11 @@ class LaunchpadInternalServer(_BaseLaunchpadServer):
area where Launchpad branches are stored, generally either the
hosted or mirrored areas.
"""
- super(LaunchpadInternalServer, self).__init__(
- scheme, codehosting_api, LAUNCHPAD_SERVICES)
+ super().__init__(scheme, codehosting_api, LAUNCHPAD_SERVICES)
self._transport_dispatch = BranchTransportDispatch(branch_transport)
def start_server(self):
- super(LaunchpadInternalServer, self).start_server()
+ super().start_server()
try:
self._transport_dispatch.base_transport.ensure_base()
except TransportNotPossible:
@@ -444,7 +443,7 @@ class DirectDatabaseLaunchpadServer(AsyncVirtualServer):
self._transport_dispatch = BranchTransportDispatch(branch_transport)
def start_server(self):
- super(DirectDatabaseLaunchpadServer, self).start_server()
+ super().start_server()
try:
self._transport_dispatch.base_transport.ensure_base()
except TransportNotPossible:
@@ -573,7 +572,7 @@ class LaunchpadServer(_BaseLaunchpadServer):
each branch accessed via this server.
"""
scheme = 'lp-%d:///' % id(self)
- super(LaunchpadServer, self).__init__(
+ super().__init__(
scheme, codehosting_api, user_id, seen_new_branch_hook)
self._transport_dispatch = TransportDispatch(branch_transport)
diff --git a/lib/lp/codehosting/vfs/branchfsclient.py b/lib/lp/codehosting/vfs/branchfsclient.py
index e35c003..b6f8e92 100644
--- a/lib/lp/codehosting/vfs/branchfsclient.py
+++ b/lib/lp/codehosting/vfs/branchfsclient.py
@@ -13,7 +13,6 @@ __all__ = [
import time
-import six
from twisted.internet import defer
from lp.code.interfaces.codehosting import BRANCH_TRANSPORT
@@ -84,7 +83,7 @@ class BranchFileSystemClient:
def _getFromCache(self, path):
"""Get the cached 'transport_tuple' for 'path'."""
split_path = path.strip('/').split('/')
- for object_path, value in six.iteritems(self._cache):
+ for object_path, value in self._cache.items():
transport_type, data, inserted_time = value
split_object_path = object_path.strip('/').split('/')
# Do a segment-by-segment comparison. Python sucks, lists should
diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
index d2b96a3..c32130e 100644
--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
@@ -84,7 +84,7 @@ def branch_to_path(branch, add_slash=True):
class TestBranchTransportDispatch(TestCase):
def setUp(self):
- super(TestBranchTransportDispatch, self).setUp()
+ super().setUp()
memory_server = MemoryServer()
memory_server.start_server()
self.base_transport = get_transport(memory_server.get_url())
@@ -125,7 +125,7 @@ class TestTransportDispatch(TestCase):
"""Tests for the transport factory."""
def setUp(self):
- super(TestTransportDispatch, self).setUp()
+ super().setUp()
memory_server = MemoryServer()
memory_server.start_server()
base_transport = get_transport(memory_server.get_url())
@@ -385,7 +385,7 @@ class TestDirectDatabaseLaunchpadServer(TestCaseWithFactory,
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(TestDirectDatabaseLaunchpadServer, self).setUp()
+ super().setUp()
self.requester = self.factory.makePerson()
self.server = DirectDatabaseLaunchpadServer(
'lp-test://', MemoryTransport())
@@ -847,7 +847,7 @@ class TestBranchChangedNotification(TestCaseWithTransport):
"""Test notification of branch changes."""
def setUp(self):
- super(TestBranchChangedNotification, self).setUp()
+ super().setUp()
self._server = None
self._branch_changed_log = []
frontend = InMemoryFrontend()
@@ -1005,7 +1005,7 @@ class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase):
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(TestBranchChangedErrorHandling, self).setUp()
+ super().setUp()
self._server = None
frontend = InMemoryFrontend()
self.factory = frontend.getLaunchpadObjectFactory()
diff --git a/lib/lp/codehosting/vfs/tests/test_branchfsclient.py b/lib/lp/codehosting/vfs/tests/test_branchfsclient.py
index e15432f..b896aa4 100644
--- a/lib/lp/codehosting/vfs/tests/test_branchfsclient.py
+++ b/lib/lp/codehosting/vfs/tests/test_branchfsclient.py
@@ -27,7 +27,7 @@ class TestBranchFileSystemClient(TestCase):
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(TestBranchFileSystemClient, self).setUp()
+ super().setUp()
frontend = InMemoryFrontend()
self.factory = frontend.getLaunchpadObjectFactory()
self.user = self.factory.makePerson()
diff --git a/lib/lp/codehosting/vfs/tests/test_filesystem.py b/lib/lp/codehosting/vfs/tests/test_filesystem.py
index c0554d0..b8bc531 100644
--- a/lib/lp/codehosting/vfs/tests/test_filesystem.py
+++ b/lib/lp/codehosting/vfs/tests/test_filesystem.py
@@ -27,7 +27,7 @@ class TestFilesystem(TestCaseWithTransport):
# and remove the ones that aren't needed.
def setUp(self):
- super(TestFilesystem, self).setUp()
+ super().setUp()
self.disable_directory_isolation()
frontend = InMemoryFrontend()
self.factory = frontend.getLaunchpadObjectFactory()
diff --git a/lib/lp/codehosting/vfs/tests/test_transport.py b/lib/lp/codehosting/vfs/tests/test_transport.py
index 1ce47f3..20130d8 100644
--- a/lib/lp/codehosting/vfs/tests/test_transport.py
+++ b/lib/lp/codehosting/vfs/tests/test_transport.py
@@ -97,12 +97,11 @@ class TestLaunchpadTransportImplementation(per_transport.TransportTests):
"""Arrange for `get_transport` to return wrapped LaunchpadTransports.
"""
self.transport_server = TestingServer
- super(TestLaunchpadTransportImplementation, self).setUp()
+ super().setUp()
def run(self, result=None):
"""Run the test, with the result wrapped so that it knows about skips.
"""
if result is None:
result = self.defaultTestResult()
- super(TestLaunchpadTransportImplementation, self).run(
- TestResultWrapper(result))
+ super().run(TestResultWrapper(result))