Merge ~cjwatson/launchpad:pyupgrade-py3-codehosting into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 15cccd363d81d1689ee720f2791fd8c9849f8955
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:pyupgrade-py3-codehosting
Merge into: launchpad:master
Diff against target: 736 lines (+68/-73)
30 files modified
.git-blame-ignore-revs (+2/-0)
.pre-commit-config.yaml (+1/-0)
lib/lp/codehosting/bzrutils.py (+2/-3)
lib/lp/codehosting/inmemory.py (+2/-2)
lib/lp/codehosting/puller/scheduler.py (+1/-1)
lib/lp/codehosting/puller/tests/__init__.py (+2/-3)
lib/lp/codehosting/puller/tests/test_scheduler.py (+8/-8)
lib/lp/codehosting/puller/tests/test_worker.py (+4/-4)
lib/lp/codehosting/puller/worker.py (+3/-4)
lib/lp/codehosting/scanner/buglinks.py (+1/-2)
lib/lp/codehosting/scanner/bzrsync.py (+1/-1)
lib/lp/codehosting/scanner/tests/test_buglinks.py (+5/-5)
lib/lp/codehosting/scanner/tests/test_bzrsync.py (+6/-6)
lib/lp/codehosting/scanner/tests/test_mergedetection.py (+2/-2)
lib/lp/codehosting/scripts/tests/test_modifiedbranches.py (+1/-1)
lib/lp/codehosting/scripts/tests/test_sync_branches.py (+2/-2)
lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py (+1/-1)
lib/lp/codehosting/sftp.py (+1/-2)
lib/lp/codehosting/sshserver/session.py (+1/-1)
lib/lp/codehosting/tests/helpers.py (+1/-1)
lib/lp/codehosting/tests/servers.py (+1/-1)
lib/lp/codehosting/tests/test_acceptance.py (+2/-2)
lib/lp/codehosting/tests/test_bzrutils.py (+2/-2)
lib/lp/codehosting/tests/test_rewrite.py (+2/-2)
lib/lp/codehosting/vfs/branchfs.py (+4/-5)
lib/lp/codehosting/vfs/branchfsclient.py (+1/-2)
lib/lp/codehosting/vfs/tests/test_branchfs.py (+5/-5)
lib/lp/codehosting/vfs/tests/test_branchfsclient.py (+1/-1)
lib/lp/codehosting/vfs/tests/test_filesystem.py (+1/-1)
lib/lp/codehosting/vfs/tests/test_transport.py (+2/-3)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+413400@code.launchpad.net

Commit message

lp.codehosting: Apply "pyupgrade --py3-plus"

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

Self-approving (mechanical).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
2index 4691daf..2e06d20 100644
3--- a/.git-blame-ignore-revs
4+++ b/.git-blame-ignore-revs
5@@ -24,3 +24,5 @@ b6725842a2470e3927bb73bf400c4476a06ee3ba
6 47ee1259461aa54ad7ee967e85f6131be2b74125
7 # apply pyupgrade --py3-plus to lp.code
8 cee9b128d3e49ca814464eeeeec50e6bcabcc4ba
9+# apply pyupgrade --py3-plus to lp.codehosting
10+f36fe66e5e5a5e82ba8c3269e32d76bd573d1175
11diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
12index d82d7fe..77a3d08 100644
13--- a/.pre-commit-config.yaml
14+++ b/.pre-commit-config.yaml
15@@ -49,6 +49,7 @@ repos:
16 |buildmaster
17 |charms
18 |code
19+ |codehosting
20 )/
21 - repo: https://github.com/PyCQA/isort
22 rev: 5.9.2
23diff --git a/lib/lp/codehosting/bzrutils.py b/lib/lp/codehosting/bzrutils.py
24index f9fddaf..8df9813 100644
25--- a/lib/lp/codehosting/bzrutils.py
26+++ b/lib/lp/codehosting/bzrutils.py
27@@ -192,7 +192,7 @@ class BazaarOopsRequest(ScriptRequest):
28 :param user_id: The database ID of the user doing this.
29 """
30 data = [('user_id', user_id)]
31- super(BazaarOopsRequest, self).__init__(data, URL=None)
32+ super().__init__(data, URL=None)
33
34
35 def make_error_utility(pid=None):
36@@ -229,8 +229,7 @@ class HttpAsLocalTransport(LocalTransport):
37 def __init__(self, http_url):
38 file_url = URI(
39 scheme='file', host='', path=URI(http_url).path)
40- return super(HttpAsLocalTransport, self).__init__(
41- str(file_url))
42+ return super().__init__(str(file_url))
43
44 @classmethod
45 def register(cls):
46diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
47index 5835dc1..becf674 100644
48--- a/lib/lp/codehosting/inmemory.py
49+++ b/lib/lp/codehosting/inmemory.py
50@@ -299,7 +299,7 @@ class FakeTeam(FakePerson):
51 is_team = True
52
53 def __init__(self, name, members=None):
54- super(FakeTeam, self).__init__(name)
55+ super().__init__(name)
56 if members is None:
57 self._members = []
58 else:
59@@ -400,7 +400,7 @@ class FakeObjectFactory(ObjectFactory):
60
61 def __init__(self, branch_set, person_set, product_set, distribution_set,
62 distroseries_set, sourcepackagename_set):
63- super(FakeObjectFactory, self).__init__()
64+ super().__init__()
65 self._branch_set = branch_set
66 self._person_set = person_set
67 self._product_set = product_set
68diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py
69index f6a6538..1680e65 100644
70--- a/lib/lp/codehosting/puller/scheduler.py
71+++ b/lib/lp/codehosting/puller/scheduler.py
72@@ -466,7 +466,7 @@ class JobScheduler:
73 class LockError(Exception):
74
75 def __init__(self, lockfilename):
76- super(LockError, self).__init__()
77+ super().__init__()
78 self.lockfilename = lockfilename
79
80 def __str__(self):
81diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py
82index 6a32406..340a11c 100644
83--- a/lib/lp/codehosting/puller/tests/__init__.py
84+++ b/lib/lp/codehosting/puller/tests/__init__.py
85@@ -6,7 +6,6 @@
86 import io
87 import os
88 import shutil
89-import socket
90
91 from breezy.tests import TestCaseWithTransport
92 from breezy.tests.http_server import (
93@@ -67,7 +66,7 @@ def fixed_handle_request(self):
94 """Handle one request, possibly blocking. """
95 try:
96 request, client_address = self.get_request()
97- except socket.error:
98+ except OSError:
99 return
100 if self.verify_request(request, client_address):
101 try:
102@@ -94,7 +93,7 @@ class PullerBranchTestCase(TestCaseWithTransport, TestCaseWithFactory,
103 """Some useful code for the more-integration-y puller tests."""
104
105 def setUp(self):
106- super(PullerBranchTestCase, self).setUp()
107+ super().setUp()
108 self.disable_directory_isolation()
109
110 def makeCleanDirectory(self, path):
111diff --git a/lib/lp/codehosting/puller/tests/test_scheduler.py b/lib/lp/codehosting/puller/tests/test_scheduler.py
112index 3205446..7be95b6 100644
113--- a/lib/lp/codehosting/puller/tests/test_scheduler.py
114+++ b/lib/lp/codehosting/puller/tests/test_scheduler.py
115@@ -72,14 +72,14 @@ class FakeCodehostingEndpointProxy:
116 class TestJobScheduler(TestCase):
117
118 def setUp(self):
119- super(TestJobScheduler, self).setUp()
120+ super().setUp()
121 self.masterlock = 'master.lock'
122
123 def tearDown(self):
124 reset_logging()
125 if os.path.exists(self.masterlock):
126 os.unlink(self.masterlock)
127- super(TestJobScheduler, self).tearDown()
128+ super().tearDown()
129
130 def makeJobScheduler(self, branch_type_names=()):
131 return scheduler.JobScheduler(
132@@ -140,7 +140,7 @@ class TestPullerWireProtocol(TestCase):
133 self.failure = failure
134
135 def setUp(self):
136- super(TestPullerWireProtocol, self).setUp()
137+ super().setUp()
138 self.puller_protocol = self.StubPullerProtocol()
139 self.protocol = scheduler.PullerWireProtocol(self.puller_protocol)
140 self.protocol.makeConnection(self.StubTransport())
141@@ -153,7 +153,7 @@ class TestPullerWireProtocol(TestCase):
142 """Send each element of `arguments` to the protocol as a netstring."""
143 for argument in arguments:
144 if not isinstance(argument, bytes):
145- argument = six.text_type(argument).encode('UTF-8')
146+ argument = str(argument).encode('UTF-8')
147 self.protocol.dataReceived(self.convertToNetstring(argument))
148
149 def assertUnexpectedErrorCalled(self, exception_type):
150@@ -256,7 +256,7 @@ class TestPullerMonitorProtocol(ProcessTestsMixin, TestCase):
151
152 def setUp(self):
153 self.listener = self.StubPullerListener()
154- super(TestPullerMonitorProtocol, self).setUp()
155+ super().setUp()
156
157 def assertProtocolSuccess(self):
158 """Assert that the protocol saw no unexpected errors."""
159@@ -427,7 +427,7 @@ class TestPullerMaster(TestCase):
160 run_tests_with = AsynchronousDeferredRunTest
161
162 def setUp(self):
163- super(TestPullerMaster, self).setUp()
164+ super().setUp()
165 self.status_client = FakeCodehostingEndpointProxy()
166 self.arbitrary_branch_id = 1
167 self.eventHandler = scheduler.PullerMaster(
168@@ -502,7 +502,7 @@ class TestPullerMasterSpawning(TestCase):
169 run_tests_with = AsynchronousDeferredRunTest
170
171 def setUp(self):
172- super(TestPullerMasterSpawning, self).setUp()
173+ super().setUp()
174 self.eventHandler = self.makePullerMaster('HOSTED')
175 self.patch(reactor, 'spawnProcess', self.spawnProcess)
176 self.commands_spawned = []
177@@ -564,7 +564,7 @@ class TestPullerMasterIntegration(PullerBranchTestCase):
178 run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
179
180 def setUp(self):
181- super(TestPullerMasterIntegration, self).setUp()
182+ super().setUp()
183 self.makeCleanDirectory(config.codehosting.mirrored_branches_root)
184 self.bzr_tree = self.make_branch_and_tree('src-branch')
185 url = urljoin(self.serveOverHTTP(), 'src-branch')
186diff --git a/lib/lp/codehosting/puller/tests/test_worker.py b/lib/lp/codehosting/puller/tests/test_worker.py
187index e412ba5..7ea9daf 100644
188--- a/lib/lp/codehosting/puller/tests/test_worker.py
189+++ b/lib/lp/codehosting/puller/tests/test_worker.py
190@@ -84,7 +84,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
191 """Test the mirroring functionality of PullerWorker."""
192
193 def setUp(self):
194- super(TestPullerWorker, self).setUp()
195+ super().setUp()
196 BranchOpener.install_hook()
197
198 def test_mirror_opener_with_stacked_on_url(self):
199@@ -275,7 +275,7 @@ class TestReferenceOpener(TestCaseWithTransport):
200 """Feature tests for safe opening of branch references."""
201
202 def setUp(self):
203- super(TestReferenceOpener, self).setUp()
204+ super().setUp()
205 BranchOpener.install_hook()
206
207 def createBranchReference(self, url):
208@@ -337,7 +337,7 @@ class TestMirroredBranchPolicy(TestCase):
209 """Tests specific to `MirroredBranchPolicy`."""
210
211 def setUp(self):
212- super(TestMirroredBranchPolicy, self).setUp()
213+ super().setUp()
214 self.factory = LaunchpadObjectFactory()
215
216 def testNoFileURL(self):
217@@ -494,7 +494,7 @@ class TestWorkerProgressReporting(TestCaseWithTransport):
218 self.calls.append(type)
219
220 def setUp(self):
221- super(TestWorkerProgressReporting, self).setUp()
222+ super().setUp()
223 BranchOpener.install_hook()
224 self.saved_factory = breezy.ui.ui_factory
225 self.disable_directory_isolation()
226diff --git a/lib/lp/codehosting/puller/worker.py b/lib/lp/codehosting/puller/worker.py
227index fb3c21a..75cb919 100644
228--- a/lib/lp/codehosting/puller/worker.py
229+++ b/lib/lp/codehosting/puller/worker.py
230@@ -2,7 +2,6 @@
231 # GNU Affero General Public License version 3 (see the file LICENSE).
232
233 import http.client
234-import socket
235 import sys
236
237
238@@ -115,7 +114,7 @@ class PullerWorkerProtocol:
239 self.sendNetstring(str(len(args)))
240 for argument in args:
241 if not isinstance(argument, bytes):
242- argument = six.text_type(argument).encode('UTF-8')
243+ argument = str(argument).encode('UTF-8')
244 self.sendNetstring(argument)
245
246 def startMirroring(self):
247@@ -178,7 +177,7 @@ class BranchMirrorerPolicy(BranchOpenPolicy):
248 return None
249
250
251-class BranchMirrorer(object):
252+class BranchMirrorer:
253 """A `BranchMirrorer` safely makes mirrors of branches.
254
255 A `BranchMirrorer` has a `BranchOpenPolicy` to tell it which URLs are safe
256@@ -399,7 +398,7 @@ class PullerWorker:
257 msg = "Authentication required."
258 self._mirrorFailed(msg)
259
260- except socket.error as e:
261+ except OSError as e:
262 msg = 'A socket error occurred: %s' % str(e)
263 self._mirrorFailed(msg)
264
265diff --git a/lib/lp/codehosting/scanner/buglinks.py b/lib/lp/codehosting/scanner/buglinks.py
266index 8b93ccd..33a18ed 100644
267--- a/lib/lp/codehosting/scanner/buglinks.py
268+++ b/lib/lp/codehosting/scanner/buglinks.py
269@@ -8,7 +8,6 @@ __all__ = [
270 ]
271
272 from breezy.bugtracker import InvalidBugStatus
273-import six
274 from six.moves.urllib.parse import urlsplit
275 from zope.component import getUtility
276
277@@ -77,7 +76,7 @@ class BugBranchLinker:
278 except InvalidBugStatus:
279 return
280 bug_set = getUtility(IBugSet)
281- for bug_id, status in six.iteritems(bug_info):
282+ for bug_id, status in bug_info.items():
283 try:
284 bug = bug_set.get(bug_id)
285 except NotFoundError:
286diff --git a/lib/lp/codehosting/scanner/bzrsync.py b/lib/lp/codehosting/scanner/bzrsync.py
287index 1f60b07..4847e37 100755
288--- a/lib/lp/codehosting/scanner/bzrsync.py
289+++ b/lib/lp/codehosting/scanner/bzrsync.py
290@@ -306,7 +306,7 @@ class BzrSync:
291 """Insert a batch of BranchRevision rows."""
292 self.logger.info("Inserting %d branchrevision records.",
293 len(revids_to_insert))
294- revid_seq_pairs = six.iteritems(revids_to_insert)
295+ revid_seq_pairs = revids_to_insert.items()
296 for revid_seq_pair_chunk in iter_chunks(revid_seq_pairs, 10000):
297 self.db_branch.createBranchRevisionFromIDs(revid_seq_pair_chunk)
298
299diff --git a/lib/lp/codehosting/scanner/tests/test_buglinks.py b/lib/lp/codehosting/scanner/tests/test_buglinks.py
300index 17cdd5f..790a9af 100644
301--- a/lib/lp/codehosting/scanner/tests/test_buglinks.py
302+++ b/lib/lp/codehosting/scanner/tests/test_buglinks.py
303@@ -113,7 +113,7 @@ class TestBugLinking(BzrSyncTestCase):
304 BzrSyncTestCase.setUp(self)
305
306 def makeFixtures(self):
307- super(TestBugLinking, self).makeFixtures()
308+ super().makeFixtures()
309 self.bug1 = self.factory.makeBug()
310 sp = self.factory.makeSourcePackage(publish=True)
311 self.bug1.addTask(self.bug1.owner, sp)
312@@ -192,7 +192,7 @@ class TestBugLinking(BzrSyncTestCase):
313 # required to generate the revision-id.
314 with override_environ(BRZ_EMAIL='me@example.com'):
315 self.bzr_tree.commit(
316- u'common parent', committer=author, rev_id=b'r1',
317+ 'common parent', committer=author, rev_id=b'r1',
318 allow_pointless=True)
319
320 # Branch from the base revision.
321@@ -201,17 +201,17 @@ class TestBugLinking(BzrSyncTestCase):
322
323 # Commit to both branches
324 self.bzr_tree.commit(
325- u'commit one', committer=author, rev_id=b'r2',
326+ 'commit one', committer=author, rev_id=b'r2',
327 allow_pointless=True)
328 new_tree.commit(
329- u'commit two', committer=author, rev_id=b'r1.1.1',
330+ 'commit two', committer=author, rev_id=b'r1.1.1',
331 allow_pointless=True,
332 revprops={'bugs': '%s fixed' % self.getBugURL(self.bug1)})
333
334 # Merge and commit.
335 self.bzr_tree.merge_from_branch(new_tree.branch)
336 self.bzr_tree.commit(
337- u'merge', committer=author, rev_id=b'r3',
338+ 'merge', committer=author, rev_id=b'r3',
339 allow_pointless=True)
340
341 self.syncBazaarBranchToDatabase(self.bzr_branch, self.db_branch)
342diff --git a/lib/lp/codehosting/scanner/tests/test_bzrsync.py b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
343index 7fe8ad3..6d6fba5 100644
344--- a/lib/lp/codehosting/scanner/tests/test_bzrsync.py
345+++ b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
346@@ -91,7 +91,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
347 LOG = "Log message"
348
349 def setUp(self):
350- super(BzrSyncTestCase, self).setUp()
351+ super().setUp()
352 BranchOpener.install_hook()
353 self.disable_directory_isolation()
354 self.useBzrBranches(direct_database=True)
355@@ -101,7 +101,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
356 self.addCleanup(Store.of(self.db_branch).flush)
357
358 def tearDown(self):
359- super(BzrSyncTestCase, self).tearDown()
360+ super().tearDown()
361
362 def makeFixtures(self):
363 """Makes test fixtures before we switch to the scanner db user."""
364@@ -243,7 +243,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
365 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
366 # required to generate the revision-id.
367 with override_environ(BRZ_EMAIL='me@example.com'):
368- trunk_tree.commit(u'base revision', rev_id=base_rev_id)
369+ trunk_tree.commit('base revision', rev_id=base_rev_id)
370
371 # Branch from the base revision.
372 new_db_branch = self.makeDatabaseBranch(
373@@ -253,12 +253,12 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
374 branch_tree.pull(trunk_tree.branch)
375
376 # Commit to both branches.
377- trunk_tree.commit(u'trunk revision', rev_id=trunk_rev_id)
378- branch_tree.commit(u'branch revision', rev_id=branch_rev_id)
379+ trunk_tree.commit('trunk revision', rev_id=trunk_rev_id)
380+ branch_tree.commit('branch revision', rev_id=branch_rev_id)
381
382 # Merge branch into trunk.
383 trunk_tree.merge_from_branch(branch_tree.branch)
384- trunk_tree.commit(u'merge revision', rev_id=merge_rev_id)
385+ trunk_tree.commit('merge revision', rev_id=merge_rev_id)
386
387 return (db_branch, trunk_tree), (new_db_branch, branch_tree)
388
389diff --git a/lib/lp/codehosting/scanner/tests/test_mergedetection.py b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
390index 4d3a93d..07dcf12 100644
391--- a/lib/lp/codehosting/scanner/tests/test_mergedetection.py
392+++ b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
393@@ -143,7 +143,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
394 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
395 # required to generate the revision-id.
396 with override_environ(BRZ_EMAIL='me@example.com'):
397- branch_tree.commit(u'another revision', rev_id=b'another-rev')
398+ branch_tree.commit('another revision', rev_id=b'another-rev')
399 current_proposal_status = proposal.queue_status
400 self.assertNotEqual(
401 current_proposal_status,
402@@ -164,7 +164,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
403 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
404 # required to generate the revision-id.
405 with override_environ(BRZ_EMAIL='me@example.com'):
406- branch_tree.commit(u'another revision', rev_id=b'another-rev')
407+ branch_tree.commit('another revision', rev_id=b'another-rev')
408 current_proposal_status = proposal.queue_status
409 self.assertNotEqual(
410 current_proposal_status,
411diff --git a/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py b/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py
412index 6d1faf2..7683988 100644
413--- a/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py
414+++ b/lib/lp/codehosting/scripts/tests/test_modifiedbranches.py
415@@ -154,7 +154,7 @@ class TestModifiedBranchesUpdateLocations(TestCase):
416 """Test the path splitting an reassebly adding to locations."""
417
418 def setUp(self):
419- super(TestModifiedBranchesUpdateLocations, self).setUp()
420+ super().setUp()
421 self.script = ModifiedBranchesScript(
422 'modified-branches', test_args=['--last-hours=12'])
423
424diff --git a/lib/lp/codehosting/scripts/tests/test_sync_branches.py b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
425index 938b73f..f085078 100644
426--- a/lib/lp/codehosting/scripts/tests/test_sync_branches.py
427+++ b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
428@@ -41,7 +41,7 @@ class BranchSyncProcessMatches(MatchesListwise):
429
430 def __init__(self, branch):
431 branch_path = branch_id_to_path(branch.id)
432- super(BranchSyncProcessMatches, self).__init__([
433+ super().__init__([
434 Equals(([
435 "rsync", "-a", "--delete-after",
436 "bazaar.launchpad.net::mirrors/%s/" % branch_path,
437@@ -57,7 +57,7 @@ class TestSyncBranches(TestCaseWithFactory):
438 layer = ZopelessDatabaseLayer
439
440 def setUp(self):
441- super(TestSyncBranches, self).setUp()
442+ super().setUp()
443 self.tempdir = self.useFixture(TempDir()).path
444 self.pushConfig("codehosting", mirrored_branches_root=self.tempdir)
445 self.mock_check_output = self.useFixture(
446diff --git a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
447index b8c5578..d552e0b 100644
448--- a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
449+++ b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
450@@ -25,7 +25,7 @@ class TestUpgradeAllBranchesScript(TestCaseWithFactory):
451 layer = AppServerLayer
452
453 def setUp(self):
454- super(TestUpgradeAllBranchesScript, self).setUp()
455+ super().setUp()
456 # useBzrBranches changes cwd
457 self.cwd = os.getcwd()
458
459diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py
460index 8e6f9cd..238dcb8 100644
461--- a/lib/lp/codehosting/sftp.py
462+++ b/lib/lp/codehosting/sftp.py
463@@ -30,7 +30,6 @@ from breezy import (
464 )
465 from breezy.transport.local import LocalTransport
466 from lazr.sshserver.sftp import FileIsADirectory
467-import six
468 from twisted.conch.interfaces import (
469 ISFTPFile,
470 ISFTPServer,
471@@ -97,7 +96,7 @@ def with_sftp_error(func):
472 return util.mergeFunctionMetadata(func, decorator)
473
474
475-class DirectoryListing(six.Iterator):
476+class DirectoryListing:
477 """Class to satisfy openDirectory return interface.
478
479 openDirectory returns an iterator -- with a `close` method. Hence
480diff --git a/lib/lp/codehosting/sshserver/session.py b/lib/lp/codehosting/sshserver/session.py
481index 88d8836..9dc9a5d 100644
482--- a/lib/lp/codehosting/sshserver/session.py
483+++ b/lib/lp/codehosting/sshserver/session.py
484@@ -39,7 +39,7 @@ class ExecOnlySession(DoNothingSession):
485 """Conch session that only allows executing commands."""
486
487 def __init__(self, avatar, reactor, environment=None):
488- super(ExecOnlySession, self).__init__(avatar)
489+ super().__init__(avatar)
490 self.reactor = reactor
491 self.environment = environment
492 self._transport = None
493diff --git a/lib/lp/codehosting/tests/helpers.py b/lib/lp/codehosting/tests/helpers.py
494index 8c581b1..bb4a256 100644
495--- a/lib/lp/codehosting/tests/helpers.py
496+++ b/lib/lp/codehosting/tests/helpers.py
497@@ -33,7 +33,7 @@ class AvatarTestCase(TestCase):
498 run_tests_with = AsynchronousDeferredRunTest
499
500 def setUp(self):
501- super(AvatarTestCase, self).setUp()
502+ super().setUp()
503 # A basic user dict, 'alice' is a member of no teams (aside from the
504 # user themself).
505 self.aliceUserDict = {
506diff --git a/lib/lp/codehosting/tests/servers.py b/lib/lp/codehosting/tests/servers.py
507index fd9ead3..2bfa45e 100644
508--- a/lib/lp/codehosting/tests/servers.py
509+++ b/lib/lp/codehosting/tests/servers.py
510@@ -50,7 +50,7 @@ def set_up_test_user(test_user, test_team):
511 class CodeHostingTac(TacTestSetup):
512
513 def __init__(self, mirrored_area):
514- super(CodeHostingTac, self).__init__()
515+ super().__init__()
516 # The mirrored area.
517 self._mirror_root = mirrored_area
518 # Where the pidfile, logfile etc will go.
519diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
520index 7189670..0beee84 100644
521--- a/lib/lp/codehosting/tests/test_acceptance.py
522+++ b/lib/lp/codehosting/tests/test_acceptance.py
523@@ -100,7 +100,7 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
524 scheme = None
525
526 def setUp(self):
527- super(SSHTestCase, self).setUp()
528+ super().setUp()
529 self.disable_directory_isolation()
530 tac_handler = SSHServerLayer.getTacHandler()
531 self.server = SSHCodeHostingServer(self.scheme, tac_handler)
532@@ -268,7 +268,7 @@ class SmokeTest(WithScenarios, SSHTestCase):
533
534 def setUp(self):
535 self.scheme = 'bzr+ssh'
536- super(SmokeTest, self).setUp()
537+ super().setUp()
538 self.first_tree = 'first'
539 self.second_tree = 'second'
540
541diff --git a/lib/lp/codehosting/tests/test_bzrutils.py b/lib/lp/codehosting/tests/test_bzrutils.py
542index b4cba97..33e0dfa 100644
543--- a/lib/lp/codehosting/tests/test_bzrutils.py
544+++ b/lib/lp/codehosting/tests/test_bzrutils.py
545@@ -71,7 +71,7 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
546 """
547 if result is None:
548 result = self.defaultTestResult()
549- super(TestGetBranchStackedOnURL, self).run(TestResultWrapper(result))
550+ super().run(TestResultWrapper(result))
551
552 def testGetBranchStackedOnUrl(self):
553 # get_branch_stacked_on_url returns the URL of the stacked-on branch.
554@@ -212,7 +212,7 @@ class TestGetVfsFormatClasses(TestCaseWithTransport):
555 """
556
557 def setUp(self):
558- super(TestGetVfsFormatClasses, self).setUp()
559+ super().setUp()
560 self.disable_directory_isolation()
561 # This makes sure the connections held by the branches opened in the
562 # test are dropped, so the daemon threads serving those branches can
563diff --git a/lib/lp/codehosting/tests/test_rewrite.py b/lib/lp/codehosting/tests/test_rewrite.py
564index 047715b..288f1cb 100644
565--- a/lib/lp/codehosting/tests/test_rewrite.py
566+++ b/lib/lp/codehosting/tests/test_rewrite.py
567@@ -36,7 +36,7 @@ class TestBranchRewriter(TestCaseWithFactory):
568 layer = DatabaseFunctionalLayer
569
570 def setUp(self):
571- super(TestBranchRewriter, self).setUp()
572+ super().setUp()
573 self.fake_time = FakeTime(0)
574
575 def makeRewriter(self):
576@@ -217,7 +217,7 @@ class TestBranchRewriter(TestCaseWithFactory):
577 rewriter = self.makeRewriter()
578 branch = self.factory.makeAnyBranch()
579 transaction.commit()
580- id_path = (branch.id, u'/.bzr/README',)
581+ id_path = (branch.id, '/.bzr/README',)
582 result = rewriter._getBranchIdAndTrailingPath(
583 '/' + branch.unique_name + '/.bzr/README')
584 self.assertEqual(id_path + ('MISS',), result)
585diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py
586index 240892b..65e5494 100644
587--- a/lib/lp/codehosting/vfs/branchfs.py
588+++ b/lib/lp/codehosting/vfs/branchfs.py
589@@ -420,12 +420,11 @@ class LaunchpadInternalServer(_BaseLaunchpadServer):
590 area where Launchpad branches are stored, generally either the
591 hosted or mirrored areas.
592 """
593- super(LaunchpadInternalServer, self).__init__(
594- scheme, codehosting_api, LAUNCHPAD_SERVICES)
595+ super().__init__(scheme, codehosting_api, LAUNCHPAD_SERVICES)
596 self._transport_dispatch = BranchTransportDispatch(branch_transport)
597
598 def start_server(self):
599- super(LaunchpadInternalServer, self).start_server()
600+ super().start_server()
601 try:
602 self._transport_dispatch.base_transport.ensure_base()
603 except TransportNotPossible:
604@@ -444,7 +443,7 @@ class DirectDatabaseLaunchpadServer(AsyncVirtualServer):
605 self._transport_dispatch = BranchTransportDispatch(branch_transport)
606
607 def start_server(self):
608- super(DirectDatabaseLaunchpadServer, self).start_server()
609+ super().start_server()
610 try:
611 self._transport_dispatch.base_transport.ensure_base()
612 except TransportNotPossible:
613@@ -573,7 +572,7 @@ class LaunchpadServer(_BaseLaunchpadServer):
614 each branch accessed via this server.
615 """
616 scheme = 'lp-%d:///' % id(self)
617- super(LaunchpadServer, self).__init__(
618+ super().__init__(
619 scheme, codehosting_api, user_id, seen_new_branch_hook)
620 self._transport_dispatch = TransportDispatch(branch_transport)
621
622diff --git a/lib/lp/codehosting/vfs/branchfsclient.py b/lib/lp/codehosting/vfs/branchfsclient.py
623index e35c003..b6f8e92 100644
624--- a/lib/lp/codehosting/vfs/branchfsclient.py
625+++ b/lib/lp/codehosting/vfs/branchfsclient.py
626@@ -13,7 +13,6 @@ __all__ = [
627
628 import time
629
630-import six
631 from twisted.internet import defer
632
633 from lp.code.interfaces.codehosting import BRANCH_TRANSPORT
634@@ -84,7 +83,7 @@ class BranchFileSystemClient:
635 def _getFromCache(self, path):
636 """Get the cached 'transport_tuple' for 'path'."""
637 split_path = path.strip('/').split('/')
638- for object_path, value in six.iteritems(self._cache):
639+ for object_path, value in self._cache.items():
640 transport_type, data, inserted_time = value
641 split_object_path = object_path.strip('/').split('/')
642 # Do a segment-by-segment comparison. Python sucks, lists should
643diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
644index d2b96a3..c32130e 100644
645--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
646+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
647@@ -84,7 +84,7 @@ def branch_to_path(branch, add_slash=True):
648 class TestBranchTransportDispatch(TestCase):
649
650 def setUp(self):
651- super(TestBranchTransportDispatch, self).setUp()
652+ super().setUp()
653 memory_server = MemoryServer()
654 memory_server.start_server()
655 self.base_transport = get_transport(memory_server.get_url())
656@@ -125,7 +125,7 @@ class TestTransportDispatch(TestCase):
657 """Tests for the transport factory."""
658
659 def setUp(self):
660- super(TestTransportDispatch, self).setUp()
661+ super().setUp()
662 memory_server = MemoryServer()
663 memory_server.start_server()
664 base_transport = get_transport(memory_server.get_url())
665@@ -385,7 +385,7 @@ class TestDirectDatabaseLaunchpadServer(TestCaseWithFactory,
666 run_tests_with = AsynchronousDeferredRunTest
667
668 def setUp(self):
669- super(TestDirectDatabaseLaunchpadServer, self).setUp()
670+ super().setUp()
671 self.requester = self.factory.makePerson()
672 self.server = DirectDatabaseLaunchpadServer(
673 'lp-test://', MemoryTransport())
674@@ -847,7 +847,7 @@ class TestBranchChangedNotification(TestCaseWithTransport):
675 """Test notification of branch changes."""
676
677 def setUp(self):
678- super(TestBranchChangedNotification, self).setUp()
679+ super().setUp()
680 self._server = None
681 self._branch_changed_log = []
682 frontend = InMemoryFrontend()
683@@ -1005,7 +1005,7 @@ class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase):
684 run_tests_with = AsynchronousDeferredRunTest
685
686 def setUp(self):
687- super(TestBranchChangedErrorHandling, self).setUp()
688+ super().setUp()
689 self._server = None
690 frontend = InMemoryFrontend()
691 self.factory = frontend.getLaunchpadObjectFactory()
692diff --git a/lib/lp/codehosting/vfs/tests/test_branchfsclient.py b/lib/lp/codehosting/vfs/tests/test_branchfsclient.py
693index e15432f..b896aa4 100644
694--- a/lib/lp/codehosting/vfs/tests/test_branchfsclient.py
695+++ b/lib/lp/codehosting/vfs/tests/test_branchfsclient.py
696@@ -27,7 +27,7 @@ class TestBranchFileSystemClient(TestCase):
697 run_tests_with = AsynchronousDeferredRunTest
698
699 def setUp(self):
700- super(TestBranchFileSystemClient, self).setUp()
701+ super().setUp()
702 frontend = InMemoryFrontend()
703 self.factory = frontend.getLaunchpadObjectFactory()
704 self.user = self.factory.makePerson()
705diff --git a/lib/lp/codehosting/vfs/tests/test_filesystem.py b/lib/lp/codehosting/vfs/tests/test_filesystem.py
706index c0554d0..b8bc531 100644
707--- a/lib/lp/codehosting/vfs/tests/test_filesystem.py
708+++ b/lib/lp/codehosting/vfs/tests/test_filesystem.py
709@@ -27,7 +27,7 @@ class TestFilesystem(TestCaseWithTransport):
710 # and remove the ones that aren't needed.
711
712 def setUp(self):
713- super(TestFilesystem, self).setUp()
714+ super().setUp()
715 self.disable_directory_isolation()
716 frontend = InMemoryFrontend()
717 self.factory = frontend.getLaunchpadObjectFactory()
718diff --git a/lib/lp/codehosting/vfs/tests/test_transport.py b/lib/lp/codehosting/vfs/tests/test_transport.py
719index 1ce47f3..20130d8 100644
720--- a/lib/lp/codehosting/vfs/tests/test_transport.py
721+++ b/lib/lp/codehosting/vfs/tests/test_transport.py
722@@ -97,12 +97,11 @@ class TestLaunchpadTransportImplementation(per_transport.TransportTests):
723 """Arrange for `get_transport` to return wrapped LaunchpadTransports.
724 """
725 self.transport_server = TestingServer
726- super(TestLaunchpadTransportImplementation, self).setUp()
727+ super().setUp()
728
729 def run(self, result=None):
730 """Run the test, with the result wrapped so that it knows about skips.
731 """
732 if result is None:
733 result = self.defaultTestResult()
734- super(TestLaunchpadTransportImplementation, self).run(
735- TestResultWrapper(result))
736+ super().run(TestResultWrapper(result))

Subscribers

People subscribed via source and target branches

to status/vote changes: