Merge ~cjwatson/launchpad:py3only-super into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: c446ada94d9187eab90ca88f02d2a3072afd967e
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3only-super
Merge into: launchpad:master
Diff against target: 203 lines (+17/-23)
12 files modified
lib/lp/app/browser/tests/test_vocabulary.py (+1/-2)
lib/lp/app/stories/basics/xx-offsite-form-post.txt (+2/-3)
lib/lp/bugs/doc/checkwatches-cli-switches.txt (+1/-2)
lib/lp/bugs/doc/externalbugtracker-linking-back.txt (+1/-1)
lib/lp/buildmaster/tests/builderproxy.py (+1/-1)
lib/lp/codehosting/puller/tests/test_errors.py (+1/-1)
lib/lp/registry/doc/standing.txt (+1/-1)
lib/lp/registry/vocabularies.py (+5/-5)
lib/lp/services/webapp/tests/test_authorization.py (+1/-2)
lib/lp/services/webapp/vocabulary.py (+1/-2)
lib/lp/testing/keyserver/inprocess.py (+1/-1)
lib/lp/translations/doc/translations-export-to-branch.txt (+1/-2)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+414405@code.launchpad.net

Commit message

Rely on Python 3 zero-argument super()

Description of the change

pyupgrade missed these for various reasons (doctests, odd constructions due to long class names, and a few cases where `__new__` methods were passing the wrong class name to `super()`).

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/app/browser/tests/test_vocabulary.py b/lib/lp/app/browser/tests/test_vocabulary.py
2index 2585a02..8f745ee 100644
3--- a/lib/lp/app/browser/tests/test_vocabulary.py
4+++ b/lib/lp/app/browser/tests/test_vocabulary.py
5@@ -474,8 +474,7 @@ class TestVocabularyFilter(VocabularyFilter):
6 # A filter returning all objects.
7
8 def __new__(cls):
9- return super(VocabularyFilter, cls).__new__(
10- cls, 'FILTER', 'Test Filter', 'Test')
11+ return super().__new__(cls, 'FILTER', 'Test Filter', 'Test')
12
13 @property
14 def filter_terms(self):
15diff --git a/lib/lp/app/stories/basics/xx-offsite-form-post.txt b/lib/lp/app/stories/basics/xx-offsite-form-post.txt
16index b41aab4..132ea72 100644
17--- a/lib/lp/app/stories/basics/xx-offsite-form-post.txt
18+++ b/lib/lp/app/stories/basics/xx-offsite-form-post.txt
19@@ -15,12 +15,11 @@ functionality:
20 >>> class BrowserWithReferrer(Browser):
21 ... def __init__(self, referrer):
22 ... self._referrer = referrer
23- ... super(BrowserWithReferrer, self).__init__()
24+ ... super().__init__()
25 ...
26 ... @contextmanager
27 ... def _preparedRequest(self, url):
28- ... with super(BrowserWithReferrer, self)._preparedRequest(
29- ... url) as reqargs:
30+ ... with super()._preparedRequest(url) as reqargs:
31 ... reqargs["headers"] = [
32 ... (key, value) for key, value in reqargs["headers"]
33 ... if key.lower() != "referer"]
34diff --git a/lib/lp/bugs/doc/checkwatches-cli-switches.txt b/lib/lp/bugs/doc/checkwatches-cli-switches.txt
35index d3613e9..79873ac 100644
36--- a/lib/lp/bugs/doc/checkwatches-cli-switches.txt
37+++ b/lib/lp/bugs/doc/checkwatches-cli-switches.txt
38@@ -48,8 +48,7 @@ line.
39 >>> class TestCheckWatchesCronScript(CheckWatchesCronScript):
40 ...
41 ... def __init__(self, name, dbuser=None, test_args=None):
42- ... super(TestCheckWatchesCronScript, self).__init__(
43- ... name, dbuser, test_args)
44+ ... super().__init__(name, dbuser, test_args)
45 ... self.txn = transaction
46 ...
47 ... def handle_options(self):
48diff --git a/lib/lp/bugs/doc/externalbugtracker-linking-back.txt b/lib/lp/bugs/doc/externalbugtracker-linking-back.txt
49index 28b8597..cdd3783 100644
50--- a/lib/lp/bugs/doc/externalbugtracker-linking-back.txt
51+++ b/lib/lp/bugs/doc/externalbugtracker-linking-back.txt
52@@ -16,7 +16,7 @@ about the bug.
53 ... class BackLinkingExternalBugTracker(TestExternalBugTracker):
54 ...
55 ... def __init__(self, baseurl):
56- ... super(BackLinkingExternalBugTracker, self).__init__(baseurl)
57+ ... super().__init__(baseurl)
58 ... self.last_launchpad_bug_id = None
59 ...
60 ... def getLaunchpadBugId(self, remote_bug):
61diff --git a/lib/lp/buildmaster/tests/builderproxy.py b/lib/lp/buildmaster/tests/builderproxy.py
62index 5e9e4ac..82197ed 100644
63--- a/lib/lp/buildmaster/tests/builderproxy.py
64+++ b/lib/lp/buildmaster/tests/builderproxy.py
65@@ -69,7 +69,7 @@ class InProcessProxyAuthAPIFixture(fixtures.Fixture):
66
67 @defer.inlineCallbacks
68 def setUp(self):
69- super(TestSomething, self).setUp()
70+ super().setUp()
71 yield self.useFixture(InProcessProxyAuthAPIFixture()).start()
72 """
73
74diff --git a/lib/lp/codehosting/puller/tests/test_errors.py b/lib/lp/codehosting/puller/tests/test_errors.py
75index 47676ed..f06ca00 100644
76--- a/lib/lp/codehosting/puller/tests/test_errors.py
77+++ b/lib/lp/codehosting/puller/tests/test_errors.py
78@@ -55,7 +55,7 @@ class TestErrorCatching(TestCase):
79
80 class CustomErrorOpener(BranchMirrorer):
81 def __init__(self, exc):
82- super(TestErrorCatching.CustomErrorOpener, self).__init__(None)
83+ super().__init__(None)
84 self.exc = exc
85
86 def open(self, url):
87diff --git a/lib/lp/registry/doc/standing.txt b/lib/lp/registry/doc/standing.txt
88index f337a4a..4ecb3b4 100644
89--- a/lib/lp/registry/doc/standing.txt
90+++ b/lib/lp/registry/doc/standing.txt
91@@ -69,7 +69,7 @@ are not a member of, their message gets held for moderator approval.
92 ... switch_dbuser(config.standingupdater.dbuser)
93 ... self.txn = LaunchpadZopelessLayer.txn
94 ... self.logger = DevNullLogger()
95- ... results = super(TestableScript, self).main()
96+ ... results = super().main()
97 ... switch_dbuser(launchpad_dbuser)
98 ... return results
99 >>> script = TestableScript('update-standing', test_args=[])
100diff --git a/lib/lp/registry/vocabularies.py b/lib/lp/registry/vocabularies.py
101index 045cb4e..e0f9837 100644
102--- a/lib/lp/registry/vocabularies.py
103+++ b/lib/lp/registry/vocabularies.py
104@@ -521,7 +521,7 @@ class VocabularyFilterPerson(VocabularyFilter):
105 # A filter returning just persons.
106
107 def __new__(cls):
108- return super(VocabularyFilter, cls).__new__(
109+ return super().__new__(
110 cls, 'PERSON', 'Person',
111 'Display search results for people only')
112
113@@ -534,7 +534,7 @@ class VocabularyFilterTeam(VocabularyFilter):
114 # A filter returning just teams.
115
116 def __new__(cls):
117- return super(VocabularyFilter, cls).__new__(
118+ return super().__new__(
119 cls, 'TEAM', 'Team',
120 'Display search results for teams only')
121
122@@ -1785,7 +1785,7 @@ class VocabularyFilterProject(VocabularyFilter):
123 # A filter returning just projects.
124
125 def __new__(cls):
126- return super(VocabularyFilter, cls).__new__(
127+ return super().__new__(
128 cls, 'PROJECT', 'Project',
129 'Display search results associated with projects')
130
131@@ -1798,7 +1798,7 @@ class VocabularyFilterProjectGroup(VocabularyFilter):
132 # A filter returning just project groups.
133
134 def __new__(cls):
135- return super(VocabularyFilter, cls).__new__(
136+ return super().__new__(
137 cls, 'PROJECTGROUP', 'Project Group',
138 'Display search results associated with project groups')
139
140@@ -1811,7 +1811,7 @@ class VocabularyFilterDistribution(VocabularyFilter):
141 # A filter returning just distros.
142
143 def __new__(cls):
144- return super(VocabularyFilter, cls).__new__(
145+ return super().__new__(
146 cls, 'DISTRO', 'Distribution',
147 'Display search results associated with distributions')
148
149diff --git a/lib/lp/services/webapp/tests/test_authorization.py b/lib/lp/services/webapp/tests/test_authorization.py
150index 3b27dcc..5e31460 100644
151--- a/lib/lp/services/webapp/tests/test_authorization.py
152+++ b/lib/lp/services/webapp/tests/test_authorization.py
153@@ -426,8 +426,7 @@ class TestCheckPermissionCaching(TestCase):
154 class TestLaunchpadSecurityPolicy_getPrincipalsAccessLevel(TestCase):
155
156 def setUp(self):
157- cls = TestLaunchpadSecurityPolicy_getPrincipalsAccessLevel
158- super(cls, self).setUp()
159+ super().setUp()
160 self.principal = LaunchpadPrincipal(
161 'foo.bar@canonical.com', 'foo', 'foo', object())
162 self.security = LaunchpadSecurityPolicy()
163diff --git a/lib/lp/services/webapp/vocabulary.py b/lib/lp/services/webapp/vocabulary.py
164index 309d871..023deca 100644
165--- a/lib/lp/services/webapp/vocabulary.py
166+++ b/lib/lp/services/webapp/vocabulary.py
167@@ -239,8 +239,7 @@ class VocabularyFilterAll(VocabularyFilter):
168 # A filter returning all objects.
169
170 def __new__(cls):
171- return super(VocabularyFilter, cls).__new__(
172- cls, 'ALL', 'All', 'Display all search results')
173+ return super().__new__(cls, 'ALL', 'All', 'Display all search results')
174
175
176 class FilteredVocabularyBase:
177diff --git a/lib/lp/testing/keyserver/inprocess.py b/lib/lp/testing/keyserver/inprocess.py
178index 932ff2e..b994bea 100644
179--- a/lib/lp/testing/keyserver/inprocess.py
180+++ b/lib/lp/testing/keyserver/inprocess.py
181@@ -43,7 +43,7 @@ class InProcessKeyServerFixture(Fixture):
182
183 @defer.inlineCallbacks
184 def setUp(self):
185- super(TestSomething, self).setUp()
186+ super().setUp()
187 yield self.useFixture(InProcessKeyServerFixture()).start()
188
189 Unlike other fixtures, `InProcessKeyServerFixture` should not be used as
190diff --git a/lib/lp/translations/doc/translations-export-to-branch.txt b/lib/lp/translations/doc/translations-export-to-branch.txt
191index 76b63db..50e9dcc 100644
192--- a/lib/lp/translations/doc/translations-export-to-branch.txt
193+++ b/lib/lp/translations/doc/translations-export-to-branch.txt
194@@ -63,8 +63,7 @@ files into the branches. We mock it up here.
195 ... config_name = "translations_export_to_branch"
196 ...
197 ... def __init__(self, *args, **kwargs):
198- ... super(MockExportTranslationsToBranch, self).__init__(
199- ... *args, **kwargs)
200+ ... super().__init__(*args, **kwargs)
201 ... self.logger = FakeLogger()
202 ...
203 ... def _getLatestTranslationsCommit(self, branch):

Subscribers

People subscribed via source and target branches

to status/vote changes: