Merge ~cjwatson/launchpad:pyupgrade-py3-snappy into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-snappy
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | b777676333c9f8a6a0819737086535bf51008c52 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:pyupgrade-py3-snappy |
Merge into: | launchpad:master |
Diff against target: |
1190 lines (+115/-126) 40 files modified
.git-blame-ignore-revs (+2/-0) .pre-commit-config.yaml (+1/-0) lib/lp/snappy/adapters/buildarch.py (+7/-9) lib/lp/snappy/browser/snap.py (+22/-27) lib/lp/snappy/browser/snapbuild.py (+1/-1) lib/lp/snappy/browser/snaplisting.py (+2/-2) lib/lp/snappy/browser/snapsubscription.py (+2/-2) lib/lp/snappy/browser/tests/test_hassnaps.py (+1/-1) lib/lp/snappy/browser/tests/test_snap.py (+7/-7) lib/lp/snappy/browser/tests/test_snapbuild.py (+1/-1) lib/lp/snappy/browser/tests/test_snapsubscription.py (+1/-1) lib/lp/snappy/browser/widgets/snaparchive.py (+1/-1) lib/lp/snappy/browser/widgets/snapbuildchannels.py (+2/-2) lib/lp/snappy/browser/widgets/storechannels.py (+2/-2) lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py (+1/-1) lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py (+1/-1) lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py (+1/-1) lib/lp/snappy/interfaces/snap.py (+12/-15) lib/lp/snappy/interfaces/snapbase.py (+1/-2) lib/lp/snappy/interfaces/snapstoreclient.py (+1/-1) lib/lp/snappy/mail/snapbuild.py (+3/-4) lib/lp/snappy/model/snap.py (+1/-1) lib/lp/snappy/model/snapbase.py (+2/-3) lib/lp/snappy/model/snapbuild.py (+3/-3) lib/lp/snappy/model/snapbuildbehaviour.py (+1/-2) lib/lp/snappy/model/snapbuildjob.py (+4/-4) lib/lp/snappy/model/snapjob.py (+2/-2) lib/lp/snappy/model/snappyseries.py (+2/-2) lib/lp/snappy/model/snapstoreclient.py (+1/-1) lib/lp/snappy/model/snapsubscription.py (+1/-1) lib/lp/snappy/tests/test_snap.py (+7/-7) lib/lp/snappy/tests/test_snapbase.py (+1/-1) lib/lp/snappy/tests/test_snapbuild.py (+4/-4) lib/lp/snappy/tests/test_snapbuildbehaviour.py (+3/-3) lib/lp/snappy/tests/test_snapbuildjob.py (+2/-2) lib/lp/snappy/tests/test_snappyseries.py (+4/-4) lib/lp/snappy/tests/test_snapstoreclient.py (+2/-2) lib/lp/snappy/tests/test_snapvocabularies.py (+1/-1) lib/lp/snappy/validators/tests/test_channels.py (+1/-1) lib/lp/snappy/vocabularies.py (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+413834@code.launchpad.net |
Commit message
lp.snappy: Apply "pyupgrade --py3-plus"
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs |
2 | index 0177d98..c6458be 100644 |
3 | --- a/.git-blame-ignore-revs |
4 | +++ b/.git-blame-ignore-revs |
5 | @@ -40,3 +40,5 @@ fbed83f22424df8fa5647349493f78937a520db5 |
6 | 46f47b6eb925ce6d784c7a0ed47653da7a974110 |
7 | # apply pyupgrade --py3-plus to lp.services.[n-z]* |
8 | f3f15787ebabe305fbf3e3ae6c0fd8ca7dfb4465 |
9 | +# apply pyupgrade --py3-plus to lp.snappy |
10 | +2cda038936743a2f9271953c23b9fcc98968db63 |
11 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml |
12 | index d633860..d70d934 100644 |
13 | --- a/.pre-commit-config.yaml |
14 | +++ b/.pre-commit-config.yaml |
15 | @@ -55,6 +55,7 @@ repos: |
16 | |registry |
17 | |scripts |
18 | |services |
19 | + |snappy |
20 | )/ |
21 | - repo: https://github.com/PyCQA/isort |
22 | rev: 5.9.2 |
23 | diff --git a/lib/lp/snappy/adapters/buildarch.py b/lib/lp/snappy/adapters/buildarch.py |
24 | index e9b01cf..fe8680b 100644 |
25 | --- a/lib/lp/snappy/adapters/buildarch.py |
26 | +++ b/lib/lp/snappy/adapters/buildarch.py |
27 | @@ -7,8 +7,6 @@ __all__ = [ |
28 | |
29 | from collections import Counter |
30 | |
31 | -import six |
32 | - |
33 | from lp.services.helpers import english_list |
34 | |
35 | |
36 | @@ -20,7 +18,7 @@ class MissingPropertyError(SnapArchitecturesParserError): |
37 | """Error for when an expected property is not present in the YAML.""" |
38 | |
39 | def __init__(self, prop): |
40 | - super(MissingPropertyError, self).__init__( |
41 | + super().__init__( |
42 | "Architecture specification is missing the {!r} property".format( |
43 | prop)) |
44 | self.property = prop |
45 | @@ -30,7 +28,7 @@ class IncompatibleArchitecturesStyleError(SnapArchitecturesParserError): |
46 | """Error for when architectures mix incompatible styles.""" |
47 | |
48 | def __init__(self): |
49 | - super(IncompatibleArchitecturesStyleError, self).__init__( |
50 | + super().__init__( |
51 | "'architectures' must either be a list of strings or dicts, not " |
52 | "both") |
53 | |
54 | @@ -39,7 +37,7 @@ class DuplicateBuildOnError(SnapArchitecturesParserError): |
55 | """Error for when multiple `build-on`s include the same architecture.""" |
56 | |
57 | def __init__(self, duplicates): |
58 | - super(DuplicateBuildOnError, self).__init__( |
59 | + super().__init__( |
60 | "{} {} present in the 'build-on' of multiple items".format( |
61 | english_list(duplicates), |
62 | "is" if len(duplicates) == 1 else "are")) |
63 | @@ -49,7 +47,7 @@ class UnsupportedBuildOnError(SnapArchitecturesParserError): |
64 | """Error for when a requested architecture is not supported.""" |
65 | |
66 | def __init__(self, build_on): |
67 | - super(UnsupportedBuildOnError, self).__init__( |
68 | + super().__init__( |
69 | "build-on specifies no supported architectures: {!r}".format( |
70 | build_on)) |
71 | self.build_on = build_on |
72 | @@ -69,10 +67,10 @@ class SnapArchitecture: |
73 | snapcraft.yaml. |
74 | """ |
75 | self.build_on = ( |
76 | - [build_on] if isinstance(build_on, six.string_types) else build_on) |
77 | + [build_on] if isinstance(build_on, str) else build_on) |
78 | if run_on: |
79 | self.run_on = ( |
80 | - [run_on] if isinstance(run_on, six.string_types) else run_on) |
81 | + [run_on] if isinstance(run_on, str) else run_on) |
82 | else: |
83 | self.run_on = self.build_on |
84 | self.build_error = build_error |
85 | @@ -131,7 +129,7 @@ def determine_architectures_to_build(snapcraft_data, supported_arches): |
86 | if architectures_list: |
87 | # First, determine what style we're parsing. Is it a list of |
88 | # strings or a list of dicts? |
89 | - if all(isinstance(a, six.string_types) for a in architectures_list): |
90 | + if all(isinstance(a, str) for a in architectures_list): |
91 | # If a list of strings (old style), then that's only a single |
92 | # item. |
93 | architectures = [SnapArchitecture(build_on=architectures_list)] |
94 | diff --git a/lib/lp/snappy/browser/snap.py b/lib/lp/snappy/browser/snap.py |
95 | index 6055137..0fc63ca 100644 |
96 | --- a/lib/lp/snappy/browser/snap.py |
97 | +++ b/lib/lp/snappy/browser/snap.py |
98 | @@ -20,7 +20,6 @@ from lazr.restful.interface import ( |
99 | copy_field, |
100 | use_template, |
101 | ) |
102 | -import six |
103 | from six.moves.urllib.parse import urlencode |
104 | from zope.component import getUtility |
105 | from zope.error.interfaces import IErrorReportingUtility |
106 | @@ -184,9 +183,9 @@ class SnapFormMixin: |
107 | widget = self.widgets.get('vcs') |
108 | if widget is not None: |
109 | current_value = widget._getFormValue() |
110 | - self.vcs_bzr_radio, self.vcs_git_radio = [ |
111 | + self.vcs_bzr_radio, self.vcs_git_radio = ( |
112 | render_radio_widget_part(widget, value, current_value) |
113 | - for value in (VCSType.BZR, VCSType.GIT)] |
114 | + for value in (VCSType.BZR, VCSType.GIT)) |
115 | |
116 | |
117 | class SnapInformationTypeMixin: |
118 | @@ -565,7 +564,7 @@ class SnapAddView(SnapAuthorizeMixin, EnableProcessorsMixin, |
119 | |
120 | def initialize(self): |
121 | """See `LaunchpadView`.""" |
122 | - super(SnapAddView, self).initialize() |
123 | + super().initialize() |
124 | |
125 | # Once initialized, if the private_snap flag is disabled, it |
126 | # prevents snap creation for private contexts. |
127 | @@ -580,7 +579,7 @@ class SnapAddView(SnapAuthorizeMixin, EnableProcessorsMixin, |
128 | |
129 | def setUpFields(self): |
130 | """See `LaunchpadFormView`.""" |
131 | - super(SnapAddView, self).setUpFields() |
132 | + super().setUpFields() |
133 | self.form_fields += self.createEnabledProcessors( |
134 | getUtility(IProcessorSet).getAll(), |
135 | "The architectures that this snap package builds for. Some " |
136 | @@ -589,7 +588,7 @@ class SnapAddView(SnapAuthorizeMixin, EnableProcessorsMixin, |
137 | |
138 | def setUpWidgets(self): |
139 | """See `LaunchpadFormView`.""" |
140 | - super(SnapAddView, self).setUpWidgets() |
141 | + super().setUpWidgets() |
142 | self.widgets['processors'].widget_class = 'processors' |
143 | if self.is_project_context: |
144 | # If we are on Project:+new-snap page, we know which information |
145 | @@ -654,23 +653,23 @@ class SnapAddView(SnapAuthorizeMixin, EnableProcessorsMixin, |
146 | def validate_widgets(self, data, names=None): |
147 | """See `LaunchpadFormView`.""" |
148 | if self.widgets.get('vcs') is not None: |
149 | - super(SnapAddView, self).validate_widgets(data, ['vcs']) |
150 | + super().validate_widgets(data, ['vcs']) |
151 | self.validateVCSWidgets(SnapAddView, data) |
152 | if self.widgets.get('auto_build') is not None: |
153 | # Set widgets as required or optional depending on the |
154 | # auto_build field. |
155 | - super(SnapAddView, self).validate_widgets(data, ['auto_build']) |
156 | + super().validate_widgets(data, ['auto_build']) |
157 | auto_build = data.get('auto_build', False) |
158 | self.widgets['auto_build_archive'].context.required = auto_build |
159 | self.widgets['auto_build_pocket'].context.required = auto_build |
160 | if self.widgets.get('store_upload') is not None: |
161 | # Set widgets as required or optional depending on the |
162 | # store_upload field. |
163 | - super(SnapAddView, self).validate_widgets(data, ['store_upload']) |
164 | + super().validate_widgets(data, ['store_upload']) |
165 | store_upload = data.get('store_upload', False) |
166 | self.widgets['store_name'].context.required = store_upload |
167 | self.widgets['store_channels'].context.required = store_upload |
168 | - super(SnapAddView, self).validate_widgets(data, names=names) |
169 | + super().validate_widgets(data, names=names) |
170 | |
171 | @action('Create snap package', name='create') |
172 | def create_action(self, action, data): |
173 | @@ -709,7 +708,7 @@ class SnapAddView(SnapAuthorizeMixin, EnableProcessorsMixin, |
174 | self.next_url = canonical_url(snap) |
175 | |
176 | def validate(self, data): |
177 | - super(SnapAddView, self).validate(data) |
178 | + super().validate(data) |
179 | owner = data.get('owner', None) |
180 | name = data.get('name', None) |
181 | if owner and name: |
182 | @@ -732,7 +731,7 @@ class BaseSnapEditView(SnapAuthorizeMixin, SnapInformationTypeMixin, |
183 | |
184 | def setUpWidgets(self, context=None): |
185 | """See `LaunchpadFormView`.""" |
186 | - super(BaseSnapEditView, self).setUpWidgets() |
187 | + super().setUpWidgets() |
188 | self.setUpVCSWidgets() |
189 | |
190 | @property |
191 | @@ -742,28 +741,26 @@ class BaseSnapEditView(SnapAuthorizeMixin, SnapInformationTypeMixin, |
192 | def validate_widgets(self, data, names=None): |
193 | """See `LaunchpadFormView`.""" |
194 | if self.widgets.get('vcs') is not None: |
195 | - super(BaseSnapEditView, self).validate_widgets(data, ['vcs']) |
196 | + super().validate_widgets(data, ['vcs']) |
197 | self.validateVCSWidgets(BaseSnapEditView, data) |
198 | if self.widgets.get('auto_build') is not None: |
199 | # Set widgets as required or optional depending on the |
200 | # auto_build field. |
201 | - super(BaseSnapEditView, self).validate_widgets( |
202 | - data, ['auto_build']) |
203 | + super().validate_widgets(data, ['auto_build']) |
204 | auto_build = data.get('auto_build', False) |
205 | self.widgets['auto_build_archive'].context.required = auto_build |
206 | self.widgets['auto_build_pocket'].context.required = auto_build |
207 | if self.widgets.get('store_upload') is not None: |
208 | # Set widgets as required or optional depending on the |
209 | # store_upload field. |
210 | - super(BaseSnapEditView, self).validate_widgets( |
211 | - data, ['store_upload']) |
212 | + super().validate_widgets(data, ['store_upload']) |
213 | store_upload = data.get('store_upload', False) |
214 | self.widgets['store_name'].context.required = store_upload |
215 | self.widgets['store_channels'].context.required = store_upload |
216 | - super(BaseSnapEditView, self).validate_widgets(data, names=names) |
217 | + super().validate_widgets(data, names=names) |
218 | |
219 | def validate(self, data): |
220 | - super(BaseSnapEditView, self).validate(data) |
221 | + super().validate(data) |
222 | info_type = data.get('information_type', self.context.information_type) |
223 | editing_info_type = 'information_type' in data |
224 | private = info_type in PRIVATE_INFORMATION_TYPES |
225 | @@ -876,8 +873,7 @@ class SnapAdminView(BaseSnapEditView): |
226 | if 'project' in data: |
227 | project = data.pop('project') |
228 | self.context.setProject(project) |
229 | - super(SnapAdminView, self).updateContextFromData( |
230 | - data, context, notify_modified) |
231 | + super().updateContextFromData(data, context, notify_modified) |
232 | |
233 | |
234 | class SnapEditView(BaseSnapEditView, EnableProcessorsMixin): |
235 | @@ -926,7 +922,7 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin): |
236 | |
237 | def setUpFields(self): |
238 | """See `LaunchpadFormView`.""" |
239 | - super(SnapEditView, self).setUpFields() |
240 | + super().setUpFields() |
241 | self.form_fields += self.createEnabledProcessors( |
242 | self.context.available_processors, |
243 | "The architectures that this snap package builds for. Some " |
244 | @@ -934,7 +930,7 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin): |
245 | "disabled by administrators.") |
246 | |
247 | def setUpWidgets(self, context=None): |
248 | - super(SnapEditView, self).setUpWidgets(context) |
249 | + super().setUpWidgets(context) |
250 | info_type_widget = self.widgets['information_type'] |
251 | info_type_widget.vocabulary = InformationTypeVocabulary( |
252 | types=self.getPossibleInformationTypes(self.context, self.user)) |
253 | @@ -957,7 +953,7 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin): |
254 | return initial_values |
255 | |
256 | def validate(self, data): |
257 | - super(SnapEditView, self).validate(data) |
258 | + super().validate(data) |
259 | owner = data.get('owner', None) |
260 | name = data.get('name', None) |
261 | if owner and name: |
262 | @@ -988,8 +984,7 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin): |
263 | if 'project' in data: |
264 | project = data.pop('project') |
265 | self.context.setProject(project) |
266 | - super(SnapEditView, self).updateContextFromData( |
267 | - data, context, notify_modified) |
268 | + super().updateContextFromData(data, context, notify_modified) |
269 | |
270 | |
271 | class SnapAuthorizeView(LaunchpadEditFormView): |
272 | @@ -1029,7 +1024,7 @@ class SnapAuthorizeView(LaunchpadEditFormView): |
273 | ]) |
274 | return login_url |
275 | except CannotAuthorizeStoreUploads as e: |
276 | - request.response.addInfoNotification(six.text_type(e)) |
277 | + request.response.addInfoNotification(str(e)) |
278 | request.response.redirect(canonical_url(snap)) |
279 | return |
280 | |
281 | diff --git a/lib/lp/snappy/browser/snapbuild.py b/lib/lp/snappy/browser/snapbuild.py |
282 | index ff5e231..ad54692 100644 |
283 | --- a/lib/lp/snappy/browser/snapbuild.py |
284 | +++ b/lib/lp/snappy/browser/snapbuild.py |
285 | @@ -163,7 +163,7 @@ class SnapBuildRescoreView(LaunchpadFormView): |
286 | |
287 | def __call__(self): |
288 | if self.context.can_be_rescored: |
289 | - return super(SnapBuildRescoreView, self).__call__() |
290 | + return super().__call__() |
291 | self.request.response.addWarningNotification( |
292 | "Cannot rescore this build because it is not queued.") |
293 | self.request.response.redirect(canonical_url(self.context)) |
294 | diff --git a/lib/lp/snappy/browser/snaplisting.py b/lib/lp/snappy/browser/snaplisting.py |
295 | index 7c2e9d5..37098b5 100644 |
296 | --- a/lib/lp/snappy/browser/snaplisting.py |
297 | +++ b/lib/lp/snappy/browser/snaplisting.py |
298 | @@ -39,7 +39,7 @@ class SnapListingView(LaunchpadView, FeedsMixin): |
299 | 'displayname': self.context.displayname} |
300 | |
301 | def initialize(self): |
302 | - super(SnapListingView, self).initialize() |
303 | + super().initialize() |
304 | snaps = getUtility(ISnapSet).findByContext( |
305 | self.context, visible_by_user=self.user) |
306 | loader = partial( |
307 | @@ -56,7 +56,7 @@ class BranchSnapListingView(SnapListingView): |
308 | source_enabled = False |
309 | |
310 | def initialize(self): |
311 | - super(BranchSnapListingView, self).initialize() |
312 | + super().initialize() |
313 | # Replace our context with a decorated branch, if it is not already |
314 | # decorated. |
315 | if not isinstance(self.context, DecoratedBranch): |
316 | diff --git a/lib/lp/snappy/browser/snapsubscription.py b/lib/lp/snappy/browser/snapsubscription.py |
317 | index 0b4afb3..dcb6a2c 100644 |
318 | --- a/lib/lp/snappy/browser/snapsubscription.py |
319 | +++ b/lib/lp/snappy/browser/snapsubscription.py |
320 | @@ -93,7 +93,7 @@ class SnapSubscriptionEditView(RedirectToSnapMixin, LaunchpadEditFormView): |
321 | def initialize(self): |
322 | self.snap = self.context.snap |
323 | self.person = self.context.person |
324 | - super(SnapSubscriptionEditView, self).initialize() |
325 | + super().initialize() |
326 | |
327 | @action("Unsubscribe", name="unsubscribe") |
328 | def unsubscribe_action(self, action, data): |
329 | @@ -112,7 +112,7 @@ class _SnapSubscriptionCreationView(RedirectToSnapMixin, LaunchpadFormView): |
330 | |
331 | def initialize(self): |
332 | self.snap = self.context |
333 | - super(_SnapSubscriptionCreationView, self).initialize() |
334 | + super().initialize() |
335 | |
336 | |
337 | class SnapSubscriptionAddView(_SnapSubscriptionCreationView): |
338 | diff --git a/lib/lp/snappy/browser/tests/test_hassnaps.py b/lib/lp/snappy/browser/tests/test_hassnaps.py |
339 | index b70994a..88608a6 100644 |
340 | --- a/lib/lp/snappy/browser/tests/test_hassnaps.py |
341 | +++ b/lib/lp/snappy/browser/tests/test_hassnaps.py |
342 | @@ -104,7 +104,7 @@ class TestHasSnapsMenu(WithScenarios, TestCaseWithFactory): |
343 | ] |
344 | |
345 | def setUp(self): |
346 | - super(TestHasSnapsMenu, self).setUp() |
347 | + super().setUp() |
348 | if self.needs_git_hosting_fixture: |
349 | self.useFixture(GitHostingFixture()) |
350 | |
351 | diff --git a/lib/lp/snappy/browser/tests/test_snap.py b/lib/lp/snappy/browser/tests/test_snap.py |
352 | index 3e54942..c513111 100644 |
353 | --- a/lib/lp/snappy/browser/tests/test_snap.py |
354 | +++ b/lib/lp/snappy/browser/tests/test_snap.py |
355 | @@ -118,7 +118,7 @@ class TestSnapNavigation(TestCaseWithFactory): |
356 | layer = DatabaseFunctionalLayer |
357 | |
358 | def setUp(self): |
359 | - super(TestSnapNavigation, self).setUp() |
360 | + super().setUp() |
361 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
362 | |
363 | def test_canonical_url(self): |
364 | @@ -162,7 +162,7 @@ class BaseTestSnapView(BrowserTestCase): |
365 | layer = LaunchpadFunctionalLayer |
366 | |
367 | def setUp(self): |
368 | - super(BaseTestSnapView, self).setUp() |
369 | + super().setUp() |
370 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
371 | self.useFixture(FakeLogger()) |
372 | self.snap_store_client = FakeMethod() |
373 | @@ -181,7 +181,7 @@ class BaseTestSnapView(BrowserTestCase): |
374 | class TestSnapAddView(BaseTestSnapView): |
375 | |
376 | def setUp(self): |
377 | - super(TestSnapAddView, self).setUp() |
378 | + super().setUp() |
379 | self.distroseries = self.factory.makeUbuntuDistroSeries( |
380 | version="13.10") |
381 | with admin_logged_in(): |
382 | @@ -846,7 +846,7 @@ class TestSnapAdminView(BaseTestSnapView): |
383 | class TestSnapEditView(BaseTestSnapView): |
384 | |
385 | def setUp(self): |
386 | - super(TestSnapEditView, self).setUp() |
387 | + super().setUp() |
388 | self.distroseries = self.factory.makeUbuntuDistroSeries( |
389 | version="13.10") |
390 | with admin_logged_in(): |
391 | @@ -1472,7 +1472,7 @@ class TestSnapEditView(BaseTestSnapView): |
392 | class TestSnapAuthorizeView(BaseTestSnapView): |
393 | |
394 | def setUp(self): |
395 | - super(TestSnapAuthorizeView, self).setUp() |
396 | + super().setUp() |
397 | self.distroseries = self.factory.makeUbuntuDistroSeries() |
398 | with admin_logged_in(): |
399 | self.snappyseries = self.factory.makeSnappySeries( |
400 | @@ -1620,7 +1620,7 @@ class TestSnapDeleteView(BaseTestSnapView): |
401 | class TestSnapView(BaseTestSnapView): |
402 | |
403 | def setUp(self): |
404 | - super(TestSnapView, self).setUp() |
405 | + super().setUp() |
406 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
407 | self.distroseries = self.factory.makeDistroSeries( |
408 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
409 | @@ -2080,7 +2080,7 @@ class TestSnapView(BaseTestSnapView): |
410 | class TestSnapRequestBuildsView(BaseTestSnapView): |
411 | |
412 | def setUp(self): |
413 | - super(TestSnapRequestBuildsView, self).setUp() |
414 | + super().setUp() |
415 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
416 | self.distroseries = self.factory.makeDistroSeries( |
417 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
418 | diff --git a/lib/lp/snappy/browser/tests/test_snapbuild.py b/lib/lp/snappy/browser/tests/test_snapbuild.py |
419 | index ef78906..5b802d5 100644 |
420 | --- a/lib/lp/snappy/browser/tests/test_snapbuild.py |
421 | +++ b/lib/lp/snappy/browser/tests/test_snapbuild.py |
422 | @@ -236,7 +236,7 @@ class TestSnapBuildOperations(BrowserTestCase): |
423 | layer = DatabaseFunctionalLayer |
424 | |
425 | def setUp(self): |
426 | - super(TestSnapBuildOperations, self).setUp() |
427 | + super().setUp() |
428 | self.useFixture(FakeLogger()) |
429 | self.build = self.factory.makeSnapBuild() |
430 | self.build_url = canonical_url(self.build) |
431 | diff --git a/lib/lp/snappy/browser/tests/test_snapsubscription.py b/lib/lp/snappy/browser/tests/test_snapsubscription.py |
432 | index d73e0cc..575c0d6 100644 |
433 | --- a/lib/lp/snappy/browser/tests/test_snapsubscription.py |
434 | +++ b/lib/lp/snappy/browser/tests/test_snapsubscription.py |
435 | @@ -30,7 +30,7 @@ class BaseTestSnapView(BrowserTestCase): |
436 | layer = DatabaseFunctionalLayer |
437 | |
438 | def setUp(self): |
439 | - super(BaseTestSnapView, self).setUp() |
440 | + super().setUp() |
441 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
442 | self.useFixture(FakeLogger()) |
443 | self.person = self.factory.makePerson(name='snap-owner') |
444 | diff --git a/lib/lp/snappy/browser/widgets/snaparchive.py b/lib/lp/snappy/browser/widgets/snaparchive.py |
445 | index 74102aa..538123e 100644 |
446 | --- a/lib/lp/snappy/browser/widgets/snaparchive.py |
447 | +++ b/lib/lp/snappy/browser/widgets/snaparchive.py |
448 | @@ -137,7 +137,7 @@ class SnapArchiveWidget(BrowserWidget, InputWidget): |
449 | self.getInputValue() |
450 | except InputErrors as error: |
451 | self._error = error |
452 | - return super(SnapArchiveWidget, self).error() |
453 | + return super().error() |
454 | |
455 | def __call__(self): |
456 | """See `IBrowserWidget`.""" |
457 | diff --git a/lib/lp/snappy/browser/widgets/snapbuildchannels.py b/lib/lp/snappy/browser/widgets/snapbuildchannels.py |
458 | index 1be81fc..8d0264d 100644 |
459 | --- a/lib/lp/snappy/browser/widgets/snapbuildchannels.py |
460 | +++ b/lib/lp/snappy/browser/widgets/snapbuildchannels.py |
461 | @@ -37,7 +37,7 @@ class SnapBuildChannelsWidget(BrowserWidget, InputWidget): |
462 | _widgets_set_up = False |
463 | |
464 | def __init__(self, context, request): |
465 | - super(SnapBuildChannelsWidget, self).__init__(context, request) |
466 | + super().__init__(context, request) |
467 | self.hint = ( |
468 | 'The channels to use for build tools when building the snap ' |
469 | 'package.\n') |
470 | @@ -112,7 +112,7 @@ class SnapBuildChannelsWidget(BrowserWidget, InputWidget): |
471 | self.getInputValue() |
472 | except InputErrors as error: |
473 | self._error = error |
474 | - return super(SnapBuildChannelsWidget, self).error() |
475 | + return super().error() |
476 | |
477 | def __call__(self): |
478 | """See `IBrowserWidget`.""" |
479 | diff --git a/lib/lp/snappy/browser/widgets/storechannels.py b/lib/lp/snappy/browser/widgets/storechannels.py |
480 | index 996393b..7b0badf 100644 |
481 | --- a/lib/lp/snappy/browser/widgets/storechannels.py |
482 | +++ b/lib/lp/snappy/browser/widgets/storechannels.py |
483 | @@ -48,7 +48,7 @@ class StoreChannelsWidget(BrowserWidget, InputWidget): |
484 | |
485 | def __init__(self, field, value_type, request): |
486 | # We don't use value_type. |
487 | - super(StoreChannelsWidget, self).__init__(field, request) |
488 | + super().__init__(field, request) |
489 | # disable help_text for the global widget |
490 | self.hint = None |
491 | |
492 | @@ -168,7 +168,7 @@ class StoreChannelsWidget(BrowserWidget, InputWidget): |
493 | self.getInputValue() |
494 | except InputErrors as error: |
495 | self._error = error |
496 | - return super(StoreChannelsWidget, self).error() |
497 | + return super().error() |
498 | |
499 | def __call__(self): |
500 | """See `IBrowserWidget`.""" |
501 | diff --git a/lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py b/lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py |
502 | index e6b1ec1..5116684 100644 |
503 | --- a/lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py |
504 | +++ b/lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py |
505 | @@ -60,7 +60,7 @@ class TestSnapArchiveWidget(WithScenarios, TestCaseWithFactory): |
506 | ] |
507 | |
508 | def setUp(self): |
509 | - super(TestSnapArchiveWidget, self).setUp() |
510 | + super().setUp() |
511 | self.distroseries = self.factory.makeDistroSeries() |
512 | field = Reference(__name__="archive", schema=IArchive, title="Archive") |
513 | self.context = self.context_factory(self) |
514 | diff --git a/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py b/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py |
515 | index 2d4dc25..543d4ed 100644 |
516 | --- a/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py |
517 | +++ b/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py |
518 | @@ -28,7 +28,7 @@ class TestSnapBuildChannelsWidget(TestCaseWithFactory): |
519 | layer = DatabaseFunctionalLayer |
520 | |
521 | def setUp(self): |
522 | - super(TestSnapBuildChannelsWidget, self).setUp() |
523 | + super().setUp() |
524 | field = Dict( |
525 | __name__="auto_build_channels", |
526 | title="Source snap channels for automatic builds") |
527 | diff --git a/lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py b/lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py |
528 | index bc452aa..6deb9de 100644 |
529 | --- a/lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py |
530 | +++ b/lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py |
531 | @@ -31,7 +31,7 @@ class TestStoreChannelsWidget(TestCaseWithFactory): |
532 | layer = DatabaseFunctionalLayer |
533 | |
534 | def setUp(self): |
535 | - super(TestStoreChannelsWidget, self).setUp() |
536 | + super().setUp() |
537 | field = List(__name__="channels", title="Store channels") |
538 | self.context = self.factory.makeSnap() |
539 | field = field.bind(self.context) |
540 | diff --git a/lib/lp/snappy/interfaces/snap.py b/lib/lp/snappy/interfaces/snap.py |
541 | index 957a378..af3cfd8 100644 |
542 | --- a/lib/lp/snappy/interfaces/snap.py |
543 | +++ b/lib/lp/snappy/interfaces/snap.py |
544 | @@ -133,7 +133,7 @@ class SnapBuildAlreadyPending(Exception): |
545 | """A build was requested when an identical build was already pending.""" |
546 | |
547 | def __init__(self): |
548 | - super(SnapBuildAlreadyPending, self).__init__( |
549 | + super().__init__( |
550 | "An identical build of this snap package is already pending.") |
551 | |
552 | |
553 | @@ -150,7 +150,7 @@ class SnapBuildArchiveOwnerMismatch(Forbidden): |
554 | """ |
555 | |
556 | def __init__(self): |
557 | - super(SnapBuildArchiveOwnerMismatch, self).__init__( |
558 | + super().__init__( |
559 | "Snap package builds against private archives are only allowed " |
560 | "if the snap package owner and the archive owner are equal.") |
561 | |
562 | @@ -160,7 +160,7 @@ class SnapBuildDisallowedArchitecture(Exception): |
563 | """A build was requested for a disallowed architecture.""" |
564 | |
565 | def __init__(self, das, pocket): |
566 | - super(SnapBuildDisallowedArchitecture, self).__init__( |
567 | + super().__init__( |
568 | "This snap package is not allowed to build for %s/%s." % |
569 | (das.distroseries.getSuite(pocket), das.architecturetag)) |
570 | |
571 | @@ -170,8 +170,7 @@ class SnapPrivateFeatureDisabled(Unauthorized): |
572 | """Only certain users can create private snap objects.""" |
573 | |
574 | def __init__(self): |
575 | - super(SnapPrivateFeatureDisabled, self).__init__( |
576 | - "You do not have permission to create private snaps") |
577 | + super().__init__("You do not have permission to create private snaps") |
578 | |
579 | |
580 | @error_status(http.client.BAD_REQUEST) |
581 | @@ -179,7 +178,7 @@ class DuplicateSnapName(Exception): |
582 | """Raised for snap packages with duplicate name/owner.""" |
583 | |
584 | def __init__(self): |
585 | - super(DuplicateSnapName, self).__init__( |
586 | + super().__init__( |
587 | "There is already a snap package with the same name and owner.") |
588 | |
589 | |
590 | @@ -198,7 +197,7 @@ class NoSourceForSnap(Exception): |
591 | """Snap packages must have a source (Bazaar or Git branch).""" |
592 | |
593 | def __init__(self): |
594 | - super(NoSourceForSnap, self).__init__( |
595 | + super().__init__( |
596 | "New snap packages must have either a Bazaar branch or a Git " |
597 | "branch.") |
598 | |
599 | @@ -213,7 +212,7 @@ class SnapPrivacyMismatch(Exception): |
600 | """Snap package privacy does not match its content.""" |
601 | |
602 | def __init__(self, message=None): |
603 | - super(SnapPrivacyMismatch, self).__init__( |
604 | + super().__init__( |
605 | message or |
606 | "Snap recipe contains private information and cannot be public.") |
607 | |
608 | @@ -223,7 +222,7 @@ class SnapPrivacyPillarError(Exception): |
609 | """Private Snaps should be based in a pillar.""" |
610 | |
611 | def __init__(self, message=None): |
612 | - super(SnapPrivacyPillarError, self).__init__( |
613 | + super().__init__( |
614 | message or "Private Snap recipes should have a pillar.") |
615 | |
616 | |
617 | @@ -240,8 +239,7 @@ class CannotModifySnapProcessor(Exception): |
618 | 'by administrators.') |
619 | |
620 | def __init__(self, processor): |
621 | - super(CannotModifySnapProcessor, self).__init__( |
622 | - self._fmt % {'processor': processor.name}) |
623 | + super().__init__(self._fmt % {'processor': processor.name}) |
624 | |
625 | |
626 | @error_status(http.client.BAD_REQUEST) |
627 | @@ -264,7 +262,7 @@ class CannotRequestAutoBuilds(Exception): |
628 | """Snap package is not configured for automatic builds.""" |
629 | |
630 | def __init__(self, field): |
631 | - super(CannotRequestAutoBuilds, self).__init__( |
632 | + super().__init__( |
633 | "This snap package cannot have automatic builds created for it " |
634 | "because %s is not set." % field) |
635 | |
636 | @@ -273,15 +271,14 @@ class MissingSnapcraftYaml(Exception): |
637 | """The repository for this snap package does not have a snapcraft.yaml.""" |
638 | |
639 | def __init__(self, branch_name): |
640 | - super(MissingSnapcraftYaml, self).__init__( |
641 | - "Cannot find snapcraft.yaml in %s" % branch_name) |
642 | + super().__init__("Cannot find snapcraft.yaml in %s" % branch_name) |
643 | |
644 | |
645 | class CannotFetchSnapcraftYaml(Exception): |
646 | """Launchpad cannot fetch this snap package's snapcraft.yaml.""" |
647 | |
648 | def __init__(self, message, unsupported_remote=False): |
649 | - super(CannotFetchSnapcraftYaml, self).__init__(message) |
650 | + super().__init__(message) |
651 | self.unsupported_remote = unsupported_remote |
652 | |
653 | |
654 | diff --git a/lib/lp/snappy/interfaces/snapbase.py b/lib/lp/snappy/interfaces/snapbase.py |
655 | index ace5443..d635bfb 100644 |
656 | --- a/lib/lp/snappy/interfaces/snapbase.py |
657 | +++ b/lib/lp/snappy/interfaces/snapbase.py |
658 | @@ -34,7 +34,6 @@ from lazr.restful.fields import ( |
659 | Reference, |
660 | ) |
661 | from lazr.restful.interface import copy_field |
662 | -import six |
663 | from zope.component import getUtility |
664 | from zope.interface import Interface |
665 | from zope.schema import ( |
666 | @@ -179,7 +178,7 @@ class ISnapBaseEdit(Interface): |
667 | |
668 | @operation_parameters( |
669 | component=copy_field(IArchiveDependency["component_name"])) |
670 | - @export_operation_as(six.ensure_str("addArchiveDependency")) |
671 | + @export_operation_as("addArchiveDependency") |
672 | @export_factory_operation(IArchiveDependency, ["dependency", "pocket"]) |
673 | @operation_for_version("devel") |
674 | def _addArchiveDependency(dependency, pocket, component=None): |
675 | diff --git a/lib/lp/snappy/interfaces/snapstoreclient.py b/lib/lp/snappy/interfaces/snapstoreclient.py |
676 | index 30740d2..1e00979 100644 |
677 | --- a/lib/lp/snappy/interfaces/snapstoreclient.py |
678 | +++ b/lib/lp/snappy/interfaces/snapstoreclient.py |
679 | @@ -27,7 +27,7 @@ class SnapStoreError(Exception): |
680 | |
681 | def __init__( |
682 | self, message="", detail=None, messages=None, can_retry=False): |
683 | - super(SnapStoreError, self).__init__(message) |
684 | + super().__init__(message) |
685 | self.message = message |
686 | self.detail = detail |
687 | self.messages = messages |
688 | diff --git a/lib/lp/snappy/mail/snapbuild.py b/lib/lp/snappy/mail/snapbuild.py |
689 | index 310c782..aee1685 100644 |
690 | --- a/lib/lp/snappy/mail/snapbuild.py |
691 | +++ b/lib/lp/snappy/mail/snapbuild.py |
692 | @@ -89,14 +89,14 @@ class SnapBuildMailer(BaseMailer): |
693 | |
694 | def __init__(self, subject, template_name, recipients, from_address, |
695 | notification_type, build): |
696 | - super(SnapBuildMailer, self).__init__( |
697 | + super().__init__( |
698 | subject, template_name, recipients, from_address, |
699 | notification_type=notification_type) |
700 | self.build = build |
701 | |
702 | def _getHeaders(self, email, recipient): |
703 | """See `BaseMailer`.""" |
704 | - headers = super(SnapBuildMailer, self)._getHeaders(email, recipient) |
705 | + headers = super()._getHeaders(email, recipient) |
706 | headers["X-Launchpad-Build-State"] = self.build.status.name |
707 | return headers |
708 | |
709 | @@ -110,8 +110,7 @@ class SnapBuildMailer(BaseMailer): |
710 | else: |
711 | error_message = upload_job.error_message or "" |
712 | store_url = upload_job.store_url or "" |
713 | - params = super(SnapBuildMailer, self)._getTemplateParams( |
714 | - email, recipient) |
715 | + params = super()._getTemplateParams(email, recipient) |
716 | params.update({ |
717 | "archive_tag": build.archive.reference, |
718 | "build_id": build.id, |
719 | diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py |
720 | index 6798eb2..f6251d9 100644 |
721 | --- a/lib/lp/snappy/model/snap.py |
722 | +++ b/lib/lp/snappy/model/snap.py |
723 | @@ -426,7 +426,7 @@ class Snap(Storm, WebhookTargetMixin): |
724 | store_upload=False, store_series=None, store_name=None, |
725 | store_secrets=None, store_channels=None, project=None): |
726 | """Construct a `Snap`.""" |
727 | - super(Snap, self).__init__() |
728 | + super().__init__() |
729 | |
730 | # Set the information type first so that other validators can perform |
731 | # suitable privacy checks, but pillar should also be set, since it's |
732 | diff --git a/lib/lp/snappy/model/snapbase.py b/lib/lp/snappy/model/snapbase.py |
733 | index 1ad5c25..7577c81 100644 |
734 | --- a/lib/lp/snappy/model/snapbase.py |
735 | +++ b/lib/lp/snappy/model/snapbase.py |
736 | @@ -8,7 +8,6 @@ __all__ = [ |
737 | ] |
738 | |
739 | import pytz |
740 | -import six |
741 | from storm.locals import ( |
742 | Bool, |
743 | DateTime, |
744 | @@ -74,7 +73,7 @@ class SnapBase(Storm): |
745 | |
746 | def __init__(self, registrant, name, display_name, distro_series, |
747 | build_channels, date_created=DEFAULT): |
748 | - super(SnapBase, self).__init__() |
749 | + super().__init__() |
750 | self.registrant = registrant |
751 | self.name = name |
752 | self.display_name = display_name |
753 | @@ -145,7 +144,7 @@ class SnapBase(Storm): |
754 | |
755 | def _addArchiveDependency(self, dependency, pocket, component=None): |
756 | """See `ISnapBase`.""" |
757 | - if isinstance(component, six.text_type): |
758 | + if isinstance(component, str): |
759 | try: |
760 | component = getUtility(IComponentSet)[component] |
761 | except NotFoundError as e: |
762 | diff --git a/lib/lp/snappy/model/snapbuild.py b/lib/lp/snappy/model/snapbuild.py |
763 | index 31955e9..a4405de 100644 |
764 | --- a/lib/lp/snappy/model/snapbuild.py |
765 | +++ b/lib/lp/snappy/model/snapbuild.py |
766 | @@ -123,7 +123,7 @@ class SnapFile(Storm): |
767 | |
768 | def __init__(self, snapbuild, libraryfile): |
769 | """Construct a `SnapFile`.""" |
770 | - super(SnapFile, self).__init__() |
771 | + super().__init__() |
772 | self.snapbuild = snapbuild |
773 | self.libraryfile = libraryfile |
774 | |
775 | @@ -199,7 +199,7 @@ class SnapBuild(PackageBuildMixin, Storm): |
776 | processor, virtualized, date_created, |
777 | store_upload_metadata=None, build_request=None): |
778 | """Construct a `SnapBuild`.""" |
779 | - super(SnapBuild, self).__init__() |
780 | + super().__init__() |
781 | self.build_farm_job = build_farm_job |
782 | self.requester = requester |
783 | self.snap = snap |
784 | @@ -416,7 +416,7 @@ class SnapBuild(PackageBuildMixin, Storm): |
785 | force_invalid_transition=False): |
786 | """See `IBuildFarmJob`.""" |
787 | old_status = self.status |
788 | - super(SnapBuild, self).updateStatus( |
789 | + super().updateStatus( |
790 | status, builder=builder, slave_status=slave_status, |
791 | date_started=date_started, date_finished=date_finished, |
792 | force_invalid_transition=force_invalid_transition) |
793 | diff --git a/lib/lp/snappy/model/snapbuildbehaviour.py b/lib/lp/snappy/model/snapbuildbehaviour.py |
794 | index cfbf645..a136e58 100644 |
795 | --- a/lib/lp/snappy/model/snapbuildbehaviour.py |
796 | +++ b/lib/lp/snappy/model/snapbuildbehaviour.py |
797 | @@ -106,8 +106,7 @@ class SnapBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
798 | Return the extra arguments required by the slave for the given build. |
799 | """ |
800 | build = self.build |
801 | - args = yield super(SnapBuildBehaviour, self).extraBuildArgs( |
802 | - logger=logger) |
803 | + args = yield super().extraBuildArgs(logger=logger) |
804 | yield self.addProxyArgs(args, build.snap.allow_internet) |
805 | args["name"] = build.snap.store_name or build.snap.name |
806 | channels = build.channels or {} |
807 | diff --git a/lib/lp/snappy/model/snapbuildjob.py b/lib/lp/snappy/model/snapbuildjob.py |
808 | index 55d219b..7888c90 100644 |
809 | --- a/lib/lp/snappy/model/snapbuildjob.py |
810 | +++ b/lib/lp/snappy/model/snapbuildjob.py |
811 | @@ -101,7 +101,7 @@ class SnapBuildJob(StormBase): |
812 | :param metadata: The type-specific variables, as a JSON-compatible |
813 | dict. |
814 | """ |
815 | - super(SnapBuildJob, self).__init__() |
816 | + super().__init__() |
817 | self.job = Job(**job_args) |
818 | self.snapbuild = snapbuild |
819 | self.job_type = job_type |
820 | @@ -152,7 +152,7 @@ class SnapBuildJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass): |
821 | |
822 | def getOopsVars(self): |
823 | """See `IRunnableJob`.""" |
824 | - oops_vars = super(SnapBuildJobDerived, self).getOopsVars() |
825 | + oops_vars = super().getOopsVars() |
826 | oops_vars.extend([ |
827 | ('job_id', self.context.job.id), |
828 | ('job_type', self.context.job_type.title), |
829 | @@ -291,7 +291,7 @@ class SnapStoreUploadJob(SnapBuildJobDerived): |
830 | def _do_lifecycle(self, method_name, manage_transaction=False, |
831 | *args, **kwargs): |
832 | old_store_upload_status = self.snapbuild.store_upload_status |
833 | - getattr(super(SnapStoreUploadJob, self), method_name)( |
834 | + getattr(super(), method_name)( |
835 | *args, manage_transaction=manage_transaction, **kwargs) |
836 | if self.snapbuild.store_upload_status != old_store_upload_status: |
837 | notify(SnapBuildStoreUploadStatusChangedEvent(self.snapbuild)) |
838 | @@ -318,7 +318,7 @@ class SnapStoreUploadJob(SnapBuildJobDerived): |
839 | |
840 | def getOopsVars(self): |
841 | """See `IRunnableJob`.""" |
842 | - oops_vars = super(SnapStoreUploadJob, self).getOopsVars() |
843 | + oops_vars = super().getOopsVars() |
844 | oops_vars.append(('error_detail', self.error_detail)) |
845 | return oops_vars |
846 | |
847 | diff --git a/lib/lp/snappy/model/snapjob.py b/lib/lp/snappy/model/snapjob.py |
848 | index bf16b2d..c84f823 100644 |
849 | --- a/lib/lp/snappy/model/snapjob.py |
850 | +++ b/lib/lp/snappy/model/snapjob.py |
851 | @@ -106,7 +106,7 @@ class SnapJob(StormBase): |
852 | :param metadata: The type-specific variables, as a JSON-compatible |
853 | dict. |
854 | """ |
855 | - super(SnapJob, self).__init__() |
856 | + super().__init__() |
857 | self.job = Job(**job_args) |
858 | self.snap = snap |
859 | self.job_type = job_type |
860 | @@ -155,7 +155,7 @@ class SnapJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass): |
861 | |
862 | def getOopsVars(self): |
863 | """See `IRunnableJob`.""" |
864 | - oops_vars = super(SnapJobDerived, self).getOopsVars() |
865 | + oops_vars = super().getOopsVars() |
866 | oops_vars.extend([ |
867 | ("job_id", self.context.job.id), |
868 | ("job_type", self.context.job_type.title), |
869 | diff --git a/lib/lp/snappy/model/snappyseries.py b/lib/lp/snappy/model/snappyseries.py |
870 | index 52de880..50cef2a 100644 |
871 | --- a/lib/lp/snappy/model/snappyseries.py |
872 | +++ b/lib/lp/snappy/model/snappyseries.py |
873 | @@ -65,7 +65,7 @@ class SnappySeries(Storm): |
874 | |
875 | def __init__(self, registrant, name, display_name, status, |
876 | preferred_distro_series=None, date_created=DEFAULT): |
877 | - super(SnappySeries, self).__init__() |
878 | + super().__init__() |
879 | self.registrant = registrant |
880 | self.name = name |
881 | self.display_name = display_name |
882 | @@ -207,7 +207,7 @@ class SnappyDistroSeries(Storm, SnappyDistroSeriesMixin): |
883 | preferred = Bool(name='preferred', allow_none=False) |
884 | |
885 | def __init__(self, snappy_series, distro_series, preferred=False): |
886 | - super(SnappyDistroSeries, self).__init__() |
887 | + super().__init__() |
888 | self.snappy_series = snappy_series |
889 | self.distro_series = distro_series |
890 | self.preferred = preferred |
891 | diff --git a/lib/lp/snappy/model/snapstoreclient.py b/lib/lp/snappy/model/snapstoreclient.py |
892 | index a288a35..e5900fc 100644 |
893 | --- a/lib/lp/snappy/model/snapstoreclient.py |
894 | +++ b/lib/lp/snappy/model/snapstoreclient.py |
895 | @@ -398,7 +398,7 @@ class SnapStoreClient: |
896 | channels = memcache_client.get_json(memcache_key, log, description) |
897 | |
898 | if (channels is None and |
899 | - not getFeatureFlag(u"snap.disable_channel_search")): |
900 | + not getFeatureFlag("snap.disable_channel_search")): |
901 | path = "api/v1/channels" |
902 | timeline = cls._getTimeline() |
903 | if timeline is not None: |
904 | diff --git a/lib/lp/snappy/model/snapsubscription.py b/lib/lp/snappy/model/snapsubscription.py |
905 | index fd36b12..4384cd5 100644 |
906 | --- a/lib/lp/snappy/model/snapsubscription.py |
907 | +++ b/lib/lp/snappy/model/snapsubscription.py |
908 | @@ -44,7 +44,7 @@ class SnapSubscription(StormBase): |
909 | subscribed_by = Reference(subscribed_by_id, "Person.id") |
910 | |
911 | def __init__(self, snap, person, subscribed_by): |
912 | - super(SnapSubscription, self).__init__() |
913 | + super().__init__() |
914 | self.snap = snap |
915 | self.person = person |
916 | self.subscribed_by = subscribed_by |
917 | diff --git a/lib/lp/snappy/tests/test_snap.py b/lib/lp/snappy/tests/test_snap.py |
918 | index 08ce35b..178c4fc 100644 |
919 | --- a/lib/lp/snappy/tests/test_snap.py |
920 | +++ b/lib/lp/snappy/tests/test_snap.py |
921 | @@ -186,7 +186,7 @@ class TestSnap(TestCaseWithFactory): |
922 | layer = DatabaseFunctionalLayer |
923 | |
924 | def setUp(self): |
925 | - super(TestSnap, self).setUp() |
926 | + super().setUp() |
927 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
928 | |
929 | def test_implements_interfaces(self): |
930 | @@ -1391,7 +1391,7 @@ class TestSnapDeleteWithBuilds(TestCaseWithFactory): |
931 | layer = LaunchpadFunctionalLayer |
932 | |
933 | def setUp(self): |
934 | - super(TestSnapDeleteWithBuilds, self).setUp() |
935 | + super().setUp() |
936 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
937 | |
938 | def test_delete_with_builds(self): |
939 | @@ -1507,7 +1507,7 @@ class TestSnapVisibility(TestCaseWithFactory): |
940 | layer = DatabaseFunctionalLayer |
941 | |
942 | def setUp(self): |
943 | - super(TestSnapVisibility, self).setUp() |
944 | + super().setUp() |
945 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
946 | |
947 | def getSnapGrants(self, snap, person=None): |
948 | @@ -1654,7 +1654,7 @@ class TestSnapSet(TestCaseWithFactory): |
949 | layer = DatabaseFunctionalLayer |
950 | |
951 | def setUp(self): |
952 | - super(TestSnapSet, self).setUp() |
953 | + super().setUp() |
954 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
955 | |
956 | def test_class_implements_interfaces(self): |
957 | @@ -1891,7 +1891,7 @@ class TestSnapSet(TestCaseWithFactory): |
958 | self.assertContentEqual(snaps[3:], snap_set.findByPerson(owners[1])) |
959 | |
960 | def test_get_snap_privacy_filter_includes_grants(self): |
961 | - grantee, creator = [self.factory.makePerson() for i in range(2)] |
962 | + grantee, creator = (self.factory.makePerson() for i in range(2)) |
963 | # All snaps are owned by "creator", and "grantee" will later have |
964 | # access granted using sharing service. |
965 | snap_data = dict(registrant=creator, owner=creator, private=True) |
966 | @@ -2763,7 +2763,7 @@ class TestSnapProcessors(TestCaseWithFactory): |
967 | layer = LaunchpadFunctionalLayer |
968 | |
969 | def setUp(self): |
970 | - super(TestSnapProcessors, self).setUp(user="foo.bar@canonical.com") |
971 | + super().setUp(user="foo.bar@canonical.com") |
972 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
973 | self.default_procs = [ |
974 | getUtility(IProcessorSet).getByName("386"), |
975 | @@ -2880,7 +2880,7 @@ class TestSnapWebservice(TestCaseWithFactory): |
976 | layer = LaunchpadFunctionalLayer |
977 | |
978 | def setUp(self): |
979 | - super(TestSnapWebservice, self).setUp() |
980 | + super().setUp() |
981 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
982 | self.snap_store_client = FakeMethod() |
983 | self.snap_store_client.listChannels = FakeMethod(result=[ |
984 | diff --git a/lib/lp/snappy/tests/test_snapbase.py b/lib/lp/snappy/tests/test_snapbase.py |
985 | index 88bf5ff..a5de6f2 100644 |
986 | --- a/lib/lp/snappy/tests/test_snapbase.py |
987 | +++ b/lib/lp/snappy/tests/test_snapbase.py |
988 | @@ -80,7 +80,7 @@ class TestSnapBaseProcessors(TestCaseWithFactory): |
989 | layer = ZopelessDatabaseLayer |
990 | |
991 | def setUp(self): |
992 | - super(TestSnapBaseProcessors, self).setUp(user="foo.bar@canonical.com") |
993 | + super().setUp(user="foo.bar@canonical.com") |
994 | self.unrestricted_procs = [ |
995 | self.factory.makeProcessor() for _ in range(3)] |
996 | self.restricted_procs = [ |
997 | diff --git a/lib/lp/snappy/tests/test_snapbuild.py b/lib/lp/snappy/tests/test_snapbuild.py |
998 | index 9ed98cb..639893f 100644 |
999 | --- a/lib/lp/snappy/tests/test_snapbuild.py |
1000 | +++ b/lib/lp/snappy/tests/test_snapbuild.py |
1001 | @@ -100,7 +100,7 @@ class TestSnapBuild(TestCaseWithFactory): |
1002 | layer = LaunchpadZopelessLayer |
1003 | |
1004 | def setUp(self): |
1005 | - super(TestSnapBuild, self).setUp() |
1006 | + super().setUp() |
1007 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1008 | self.pushConfig( |
1009 | "snappy", store_url="http://sca.example/", |
1010 | @@ -700,7 +700,7 @@ class TestSnapBuildSet(TestCaseWithFactory): |
1011 | layer = LaunchpadZopelessLayer |
1012 | |
1013 | def setUp(self): |
1014 | - super(TestSnapBuildSet, self).setUp() |
1015 | + super().setUp() |
1016 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1017 | |
1018 | def test_getByBuildFarmJob_works(self): |
1019 | @@ -731,7 +731,7 @@ class TestSnapBuildWebservice(TestCaseWithFactory): |
1020 | layer = LaunchpadFunctionalLayer |
1021 | |
1022 | def setUp(self): |
1023 | - super(TestSnapBuildWebservice, self).setUp() |
1024 | + super().setUp() |
1025 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1026 | self.person = self.factory.makePerson() |
1027 | self.webservice = webservice_for_person( |
1028 | @@ -897,7 +897,7 @@ class TestSnapBuildMacaroonIssuer(MacaroonTestMixin, TestCaseWithFactory): |
1029 | layer = LaunchpadZopelessLayer |
1030 | |
1031 | def setUp(self): |
1032 | - super(TestSnapBuildMacaroonIssuer, self).setUp() |
1033 | + super().setUp() |
1034 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1035 | self.pushConfig( |
1036 | "launchpad", internal_macaroon_secret_key="some-secret") |
1037 | diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py |
1038 | index dbd91e7..fc2d5a8 100644 |
1039 | --- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py |
1040 | +++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py |
1041 | @@ -125,7 +125,7 @@ class TestSnapBuildBehaviourBase(TestCaseWithFactory): |
1042 | layer = LaunchpadZopelessLayer |
1043 | |
1044 | def setUp(self): |
1045 | - super(TestSnapBuildBehaviourBase, self).setUp() |
1046 | + super().setUp() |
1047 | self.pushConfig("snappy", tools_source=None, tools_fingerprint=None) |
1048 | |
1049 | def makeJob(self, archive=None, pocket=PackagePublishingPocket.UPDATES, |
1050 | @@ -251,7 +251,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase): |
1051 | |
1052 | @defer.inlineCallbacks |
1053 | def setUp(self): |
1054 | - super(TestAsyncSnapBuildBehaviour, self).setUp() |
1055 | + super().setUp() |
1056 | build_username = 'SNAPBUILD-1' |
1057 | self.token = {'secret': uuid.uuid4().hex, |
1058 | 'username': build_username, |
1059 | @@ -273,7 +273,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase): |
1060 | def makeJob(self, **kwargs): |
1061 | # We need a builder slave in these tests, in order that requesting a |
1062 | # proxy token can piggyback on its reactor and pool. |
1063 | - job = super(TestAsyncSnapBuildBehaviour, self).makeJob(**kwargs) |
1064 | + job = super().makeJob(**kwargs) |
1065 | builder = MockBuilder() |
1066 | builder.processor = job.build.processor |
1067 | slave = self.useFixture(SlaveTestHelpers()).getClientSlave() |
1068 | diff --git a/lib/lp/snappy/tests/test_snapbuildjob.py b/lib/lp/snappy/tests/test_snapbuildjob.py |
1069 | index 1918da5..e0c485e 100644 |
1070 | --- a/lib/lp/snappy/tests/test_snapbuildjob.py |
1071 | +++ b/lib/lp/snappy/tests/test_snapbuildjob.py |
1072 | @@ -95,7 +95,7 @@ class TestSnapBuildJob(TestCaseWithFactory): |
1073 | layer = DatabaseFunctionalLayer |
1074 | |
1075 | def setUp(self): |
1076 | - super(TestSnapBuildJob, self).setUp() |
1077 | + super().setUp() |
1078 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1079 | |
1080 | def test_provides_interface(self): |
1081 | @@ -111,7 +111,7 @@ class TestSnapStoreUploadJob(TestCaseWithFactory): |
1082 | layer = LaunchpadZopelessLayer |
1083 | |
1084 | def setUp(self): |
1085 | - super(TestSnapStoreUploadJob, self).setUp() |
1086 | + super().setUp() |
1087 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1088 | self.status_url = "http://sca.example/dev/api/snaps/1/builds/1/status" |
1089 | self.store_url = "http://sca.example/dev/click-apps/1/rev/1/" |
1090 | diff --git a/lib/lp/snappy/tests/test_snappyseries.py b/lib/lp/snappy/tests/test_snappyseries.py |
1091 | index cfdf194..7d4e64c 100644 |
1092 | --- a/lib/lp/snappy/tests/test_snappyseries.py |
1093 | +++ b/lib/lp/snappy/tests/test_snappyseries.py |
1094 | @@ -43,7 +43,7 @@ class TestSnappySeries(TestCaseWithFactory): |
1095 | layer = ZopelessDatabaseLayer |
1096 | |
1097 | def setUp(self): |
1098 | - super(TestSnappySeries, self).setUp() |
1099 | + super().setUp() |
1100 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1101 | |
1102 | def test_implements_interface(self): |
1103 | @@ -108,7 +108,7 @@ class TestSnappySeriesSet(TestCaseWithFactory): |
1104 | layer = ZopelessDatabaseLayer |
1105 | |
1106 | def setUp(self): |
1107 | - super(TestSnappySeriesSet, self).setUp() |
1108 | + super().setUp() |
1109 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1110 | |
1111 | def test_getByName(self): |
1112 | @@ -132,7 +132,7 @@ class TestSnappySeriesWebservice(TestCaseWithFactory): |
1113 | layer = DatabaseFunctionalLayer |
1114 | |
1115 | def setUp(self): |
1116 | - super(TestSnappySeriesWebservice, self).setUp() |
1117 | + super().setUp() |
1118 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1119 | |
1120 | def test_new_unpriv(self): |
1121 | @@ -234,7 +234,7 @@ class TestSnappyDistroSeriesSet(TestCaseWithFactory): |
1122 | layer = ZopelessDatabaseLayer |
1123 | |
1124 | def setUp(self): |
1125 | - super(TestSnappyDistroSeriesSet, self).setUp() |
1126 | + super().setUp() |
1127 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1128 | |
1129 | def test_getByBothSeries(self): |
1130 | diff --git a/lib/lp/snappy/tests/test_snapstoreclient.py b/lib/lp/snappy/tests/test_snapstoreclient.py |
1131 | index 66e446b..b4bd3ea 100644 |
1132 | --- a/lib/lp/snappy/tests/test_snapstoreclient.py |
1133 | +++ b/lib/lp/snappy/tests/test_snapstoreclient.py |
1134 | @@ -213,7 +213,7 @@ class TestSnapStoreClient(TestCaseWithFactory): |
1135 | layer = LaunchpadZopelessLayer |
1136 | |
1137 | def setUp(self): |
1138 | - super(TestSnapStoreClient, self).setUp() |
1139 | + super().setUp() |
1140 | self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)) |
1141 | self.pushConfig( |
1142 | "snappy", store_url="http://sca.example/", |
1143 | @@ -769,7 +769,7 @@ class TestSnapStoreClient(TestCaseWithFactory): |
1144 | @responses.activate |
1145 | def test_listChannels_disable_search(self): |
1146 | self.useFixture( |
1147 | - FeatureFixture({u"snap.disable_channel_search": u"on"})) |
1148 | + FeatureFixture({"snap.disable_channel_search": "on"})) |
1149 | expected_channels = [ |
1150 | {"name": "candidate", "display_name": "Candidate"}, |
1151 | {"name": "edge", "display_name": "Edge"}, |
1152 | diff --git a/lib/lp/snappy/tests/test_snapvocabularies.py b/lib/lp/snappy/tests/test_snapvocabularies.py |
1153 | index bac4756..942b5c6 100644 |
1154 | --- a/lib/lp/snappy/tests/test_snapvocabularies.py |
1155 | +++ b/lib/lp/snappy/tests/test_snapvocabularies.py |
1156 | @@ -15,7 +15,7 @@ class TestSnappyDistroSeriesVocabulary(TestCaseWithFactory): |
1157 | layer = ZopelessDatabaseLayer |
1158 | |
1159 | def setUp(self): |
1160 | - super(TestSnappyDistroSeriesVocabulary, self).setUp() |
1161 | + super().setUp() |
1162 | self.vocab = SnappyDistroSeriesVocabulary() |
1163 | |
1164 | def test_getTermByToken(self): |
1165 | diff --git a/lib/lp/snappy/validators/tests/test_channels.py b/lib/lp/snappy/validators/tests/test_channels.py |
1166 | index e2da963..02b19ad 100644 |
1167 | --- a/lib/lp/snappy/validators/tests/test_channels.py |
1168 | +++ b/lib/lp/snappy/validators/tests/test_channels.py |
1169 | @@ -18,7 +18,7 @@ class TestChannelsValidator(TestCaseWithFactory): |
1170 | layer = LaunchpadFunctionalLayer |
1171 | |
1172 | def setUp(self): |
1173 | - super(TestChannelsValidator, self).setUp() |
1174 | + super().setUp() |
1175 | self.risks = [ |
1176 | {"name": "stable", "display_name": "Stable"}, |
1177 | {"name": "candidate", "display_name": "Candidate"}, |
1178 | diff --git a/lib/lp/snappy/vocabularies.py b/lib/lp/snappy/vocabularies.py |
1179 | index 6fa31a9..8a22a9c 100644 |
1180 | --- a/lib/lp/snappy/vocabularies.py |
1181 | +++ b/lib/lp/snappy/vocabularies.py |
1182 | @@ -238,7 +238,7 @@ class SnapStoreChannelVocabulary(SimpleVocabulary): |
1183 | for name in context_channels: |
1184 | if name not in known_names: |
1185 | terms.append(self.createTerm(name, name, name)) |
1186 | - super(SnapStoreChannelVocabulary, self).__init__(terms) |
1187 | + super().__init__(terms) |
1188 | |
1189 | @classmethod |
1190 | def createTerm(cls, *args): |
Self-approving (mechanical).