Merge ~cjwatson/launchpad:pyupgrade-py3-coop-oci into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-coop-oci
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | f2edab727f50c25f1e84aa13c4bd7b39cf5200a6 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:pyupgrade-py3-coop-oci |
Merge into: | launchpad:master |
Diff against target: |
1076 lines (+110/-116) 29 files modified
.git-blame-ignore-revs (+2/-0) .pre-commit-config.yaml (+2/-0) lib/lp/coop/answersbugs/tests/test_doc.py (+2/-2) lib/lp/oci/browser/ocirecipe.py (+20/-21) lib/lp/oci/browser/ocirecipebuild.py (+1/-1) lib/lp/oci/browser/ocirecipesubscription.py (+2/-2) lib/lp/oci/browser/tests/test_ocirecipe.py (+11/-11) lib/lp/oci/browser/tests/test_ocirecipebuild.py (+3/-3) lib/lp/oci/browser/tests/test_ocirecipesubscription.py (+1/-1) lib/lp/oci/interfaces/ocipushrule.py (+1/-1) lib/lp/oci/interfaces/ocirecipe.py (+7/-8) lib/lp/oci/interfaces/ociregistryclient.py (+1/-1) lib/lp/oci/interfaces/ociregistrycredentials.py (+1/-1) lib/lp/oci/model/ocirecipe.py (+2/-4) lib/lp/oci/model/ocirecipebuild.py (+2/-2) lib/lp/oci/model/ocirecipebuildbehaviour.py (+2/-3) lib/lp/oci/model/ocirecipebuildjob.py (+3/-3) lib/lp/oci/model/ocirecipejob.py (+2/-2) lib/lp/oci/model/ocirecipesubscription.py (+1/-1) lib/lp/oci/model/ociregistryclient.py (+3/-3) lib/lp/oci/tests/helpers.py (+1/-1) lib/lp/oci/tests/test_ocipushrule.py (+2/-2) lib/lp/oci/tests/test_ocirecipe.py (+11/-14) lib/lp/oci/tests/test_ocirecipebuild.py (+7/-8) lib/lp/oci/tests/test_ocirecipebuildbehaviour.py (+6/-6) lib/lp/oci/tests/test_ocirecipebuildjob.py (+5/-6) lib/lp/oci/tests/test_ocirecipejob.py (+1/-1) lib/lp/oci/tests/test_ociregistryclient.py (+6/-6) lib/lp/oci/tests/test_ociregistrycredentials.py (+2/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+413412@code.launchpad.net |
Commit message
lp.{coop,oci}: 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 2e06d20..a251b8f 100644 |
3 | --- a/.git-blame-ignore-revs |
4 | +++ b/.git-blame-ignore-revs |
5 | @@ -26,3 +26,5 @@ b6725842a2470e3927bb73bf400c4476a06ee3ba |
6 | cee9b128d3e49ca814464eeeeec50e6bcabcc4ba |
7 | # apply pyupgrade --py3-plus to lp.codehosting |
8 | f36fe66e5e5a5e82ba8c3269e32d76bd573d1175 |
9 | +# apply pyupgrade --py3-plus to lp.{coop,oci} |
10 | +fbed83f22424df8fa5647349493f78937a520db5 |
11 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml |
12 | index 77a3d08..22c2329 100644 |
13 | --- a/.pre-commit-config.yaml |
14 | +++ b/.pre-commit-config.yaml |
15 | @@ -50,6 +50,8 @@ repos: |
16 | |charms |
17 | |code |
18 | |codehosting |
19 | + |coop |
20 | + |oci |
21 | )/ |
22 | - repo: https://github.com/PyCQA/isort |
23 | rev: 5.9.2 |
24 | diff --git a/lib/lp/coop/answersbugs/tests/test_doc.py b/lib/lp/coop/answersbugs/tests/test_doc.py |
25 | index a917db1..a3e2eb0 100644 |
26 | --- a/lib/lp/coop/answersbugs/tests/test_doc.py |
27 | +++ b/lib/lp/coop/answersbugs/tests/test_doc.py |
28 | @@ -54,8 +54,8 @@ def _createUbuntuBugTaskLinkedToQuestion(): |
29 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
30 | ubuntu.addAnswerContact(ubuntu_team, ubuntu_team.teamowner) |
31 | ubuntu_question = ubuntu.newQuestion( |
32 | - sample_person, u"Can't install Ubuntu", |
33 | - u"I insert the install CD in the CD-ROM drive, but it won't boot.") |
34 | + sample_person, "Can't install Ubuntu", |
35 | + "I insert the install CD in the CD-ROM drive, but it won't boot.") |
36 | no_priv = getUtility(IPersonSet).getByEmail('no-priv@canonical.com') |
37 | params = CreateBugParams( |
38 | owner=no_priv, title="Installer fails on a Mac PPC", |
39 | diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py |
40 | index 3b12dff..7329652 100644 |
41 | --- a/lib/lp/oci/browser/ocirecipe.py |
42 | +++ b/lib/lp/oci/browser/ocirecipe.py |
43 | @@ -20,7 +20,6 @@ from lazr.restful.interface import ( |
44 | copy_field, |
45 | use_template, |
46 | ) |
47 | -import six |
48 | from zope.component import getUtility |
49 | from zope.formlib.form import FormFields |
50 | from zope.formlib.textwidgets import TextAreaWidget |
51 | @@ -448,7 +447,7 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): |
52 | return field_type, rule_id |
53 | |
54 | def setUpFields(self): |
55 | - super(OCIRecipeEditPushRulesView, self).setUpFields() |
56 | + super().setUpFields() |
57 | image_name_fields = [] |
58 | url_fields = [] |
59 | region_fields = [] |
60 | @@ -510,7 +509,7 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): |
61 | required=True, readonly=False)) |
62 | image_name_fields.append( |
63 | TextLine( |
64 | - __name__=u'add_image_name', |
65 | + __name__='add_image_name', |
66 | required=False, readonly=False)) |
67 | add_credentials = Choice( |
68 | __name__='add_credentials', |
69 | @@ -519,26 +518,26 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): |
70 | existing_credentials = Choice( |
71 | vocabulary='OCIRegistryCredentials', |
72 | required=False, |
73 | - __name__=u'existing_credentials') |
74 | + __name__='existing_credentials') |
75 | url_fields.append( |
76 | TextLine( |
77 | - __name__=u'add_url', |
78 | + __name__='add_url', |
79 | required=False, readonly=False)) |
80 | region_fields.append( |
81 | TextLine( |
82 | - __name__=u'add_region', |
83 | + __name__='add_region', |
84 | required=False, readonly=False)) |
85 | username_fields.append( |
86 | TextLine( |
87 | - __name__=u'add_username', |
88 | + __name__='add_username', |
89 | required=False, readonly=False)) |
90 | password_fields.append( |
91 | Password( |
92 | - __name__=u'add_password', |
93 | + __name__='add_password', |
94 | required=False, readonly=False)) |
95 | password_fields.append( |
96 | Password( |
97 | - __name__=u'add_confirm_password', |
98 | + __name__='add_confirm_password', |
99 | required=False, readonly=False)) |
100 | |
101 | self.form_fields = ( |
102 | @@ -561,7 +560,7 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): |
103 | |
104 | def setUpWidgets(self, context=None): |
105 | """See `LaunchpadFormView`.""" |
106 | - super(OCIRecipeEditPushRulesView, self).setUpWidgets(context=context) |
107 | + super().setUpWidgets(context=context) |
108 | for widget in self.widgets: |
109 | widget.display_label = False |
110 | widget.hint = None |
111 | @@ -846,7 +845,7 @@ class OCIRecipeFormMixin: |
112 | default = "" |
113 | return FormFields(Text( |
114 | __name__='build_args', |
115 | - title=u'Build-time ARG variables', |
116 | + title='Build-time ARG variables', |
117 | description=("One per line. Each ARG should be in the format " |
118 | "of ARG_KEY=arg_value."), |
119 | default=default, |
120 | @@ -861,7 +860,7 @@ class OCIRecipeFormMixin: |
121 | if '=' not in line: |
122 | msg = ("'%s' at line %s is not a valid KEY=value pair." % |
123 | (line, i + 1)) |
124 | - self.setFieldError("build_args", six.text_type(msg)) |
125 | + self.setFieldError("build_args", str(msg)) |
126 | return |
127 | k, v = line.split('=', 1) |
128 | build_args[k] = v |
129 | @@ -919,13 +918,13 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, |
130 | custom_widget_git_ref = GitRefWidget |
131 | |
132 | def initialize(self): |
133 | - super(OCIRecipeAddView, self).initialize() |
134 | + super().initialize() |
135 | if not getFeatureFlag(OCI_RECIPE_ALLOW_CREATE): |
136 | raise OCIRecipeFeatureDisabled() |
137 | |
138 | def setUpFields(self): |
139 | """See `LaunchpadFormView`.""" |
140 | - super(OCIRecipeAddView, self).setUpFields() |
141 | + super().setUpFields() |
142 | self.form_fields += self.createBuildArgsField() |
143 | self.form_fields += self.createEnabledProcessors( |
144 | getUtility(IProcessorSet).getAll(), |
145 | @@ -945,7 +944,7 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, |
146 | if self.distribution_has_credentials: |
147 | self.form_fields += FormFields(TextLine( |
148 | __name__='image_name', |
149 | - title=u"Image name", |
150 | + title="Image name", |
151 | description=( |
152 | "Name to use for registry upload. " |
153 | "Defaults to the name of the recipe."), |
154 | @@ -976,7 +975,7 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, |
155 | |
156 | def setUpWidgets(self): |
157 | """See `LaunchpadFormView`.""" |
158 | - super(OCIRecipeAddView, self).setUpWidgets() |
159 | + super().setUpWidgets() |
160 | self.setUpInformationTypeWidget() |
161 | self.widgets["processors"].widget_class = "processors" |
162 | self.setUpGitRefWidget() |
163 | @@ -1005,7 +1004,7 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, |
164 | |
165 | def validate(self, data): |
166 | """See `LaunchpadFormView`.""" |
167 | - super(OCIRecipeAddView, self).validate(data) |
168 | + super().validate(data) |
169 | owner = data.get("owner", None) |
170 | name = data.get("name", None) |
171 | if owner and name: |
172 | @@ -1137,7 +1136,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, |
173 | |
174 | def setUpWidgets(self): |
175 | """See `LaunchpadFormView`.""" |
176 | - super(OCIRecipeEditView, self).setUpWidgets() |
177 | + super().setUpWidgets() |
178 | self.setUpInformationTypeWidget() |
179 | self.setUpGitRefWidget() |
180 | # disable the official recipe button if the user doesn't have |
181 | @@ -1148,7 +1147,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, |
182 | |
183 | def setUpFields(self): |
184 | """See `LaunchpadFormView`.""" |
185 | - super(OCIRecipeEditView, self).setUpFields() |
186 | + super().setUpFields() |
187 | self.form_fields += self.createBuildArgsField() |
188 | self.form_fields += self.createEnabledProcessors( |
189 | self.context.available_processors, |
190 | @@ -1168,7 +1167,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, |
191 | if self.distribution_has_credentials: |
192 | self.form_fields += FormFields(TextLine( |
193 | __name__='image_name', |
194 | - title=u"Image name", |
195 | + title="Image name", |
196 | description=( |
197 | "Name to use for registry upload. " |
198 | "Defaults to the name of the recipe."), |
199 | @@ -1177,7 +1176,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, |
200 | |
201 | def validate(self, data): |
202 | """See `LaunchpadFormView`.""" |
203 | - super(OCIRecipeEditView, self).validate(data) |
204 | + super().validate(data) |
205 | # XXX cjwatson 2020-02-18: We should permit and check moving recipes |
206 | # between OCI projects too. |
207 | owner = data.get("owner", None) |
208 | diff --git a/lib/lp/oci/browser/ocirecipebuild.py b/lib/lp/oci/browser/ocirecipebuild.py |
209 | index bdc63ad..9f1d55e 100644 |
210 | --- a/lib/lp/oci/browser/ocirecipebuild.py |
211 | +++ b/lib/lp/oci/browser/ocirecipebuild.py |
212 | @@ -166,7 +166,7 @@ class OCIRecipeBuildRescoreView(LaunchpadFormView): |
213 | |
214 | def __call__(self): |
215 | if self.context.can_be_rescored: |
216 | - return super(OCIRecipeBuildRescoreView, self).__call__() |
217 | + return super().__call__() |
218 | self.request.response.addWarningNotification( |
219 | "Cannot rescore this build because it is not queued.") |
220 | self.request.response.redirect(canonical_url(self.context)) |
221 | diff --git a/lib/lp/oci/browser/ocirecipesubscription.py b/lib/lp/oci/browser/ocirecipesubscription.py |
222 | index 4edf12e..c4f016f 100644 |
223 | --- a/lib/lp/oci/browser/ocirecipesubscription.py |
224 | +++ b/lib/lp/oci/browser/ocirecipesubscription.py |
225 | @@ -94,7 +94,7 @@ class OCIRecipeSubscriptionEditView(RedirectToOCIRecipeMixin, |
226 | def initialize(self): |
227 | self.ocirecipe = self.context.recipe |
228 | self.person = self.context.person |
229 | - super(OCIRecipeSubscriptionEditView, self).initialize() |
230 | + super().initialize() |
231 | |
232 | @action("Unsubscribe", name="unsubscribe") |
233 | def unsubscribe_action(self, action, data): |
234 | @@ -114,7 +114,7 @@ class _OCIRecipeSubscriptionCreationView(RedirectToOCIRecipeMixin, |
235 | |
236 | def initialize(self): |
237 | self.ocirecipe = self.context |
238 | - super(_OCIRecipeSubscriptionCreationView, self).initialize() |
239 | + super().initialize() |
240 | |
241 | |
242 | class OCIRecipeSubscriptionAddView(_OCIRecipeSubscriptionCreationView): |
243 | diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py |
244 | index 0479b15..9b17ee7 100644 |
245 | --- a/lib/lp/oci/browser/tests/test_ocirecipe.py |
246 | +++ b/lib/lp/oci/browser/tests/test_ocirecipe.py |
247 | @@ -101,7 +101,7 @@ class TestOCIRecipeNavigation(TestCaseWithFactory): |
248 | layer = DatabaseFunctionalLayer |
249 | |
250 | def setUp(self): |
251 | - super(TestOCIRecipeNavigation, self).setUp() |
252 | + super().setUp() |
253 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
254 | |
255 | def test_canonical_url(self): |
256 | @@ -144,7 +144,7 @@ class BaseTestOCIRecipeView(BrowserTestCase): |
257 | layer = LaunchpadFunctionalLayer |
258 | |
259 | def setUp(self): |
260 | - super(BaseTestOCIRecipeView, self).setUp() |
261 | + super().setUp() |
262 | self.useFixture(FakeLogger()) |
263 | self.person = self.factory.makePerson( |
264 | name="test-person", displayname="Test Person") |
265 | @@ -153,7 +153,7 @@ class BaseTestOCIRecipeView(BrowserTestCase): |
266 | class TestOCIRecipeAddView(OCIConfigHelperMixin, BaseTestOCIRecipeView): |
267 | |
268 | def setUp(self): |
269 | - super(TestOCIRecipeAddView, self).setUp() |
270 | + super().setUp() |
271 | self.distroseries = self.factory.makeDistroSeries() |
272 | self.distribution = self.distroseries.distribution |
273 | self.useFixture(FeatureFixture({ |
274 | @@ -539,7 +539,7 @@ class TestOCIRecipeAddView(OCIConfigHelperMixin, BaseTestOCIRecipeView): |
275 | class TestOCIRecipeAdminView(BaseTestOCIRecipeView): |
276 | |
277 | def setUp(self): |
278 | - super(TestOCIRecipeAdminView, self).setUp() |
279 | + super().setUp() |
280 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
281 | |
282 | def test_unauthorized(self): |
283 | @@ -594,7 +594,7 @@ class TestOCIRecipeAdminView(BaseTestOCIRecipeView): |
284 | class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView): |
285 | |
286 | def setUp(self): |
287 | - super(TestOCIRecipeEditView, self).setUp() |
288 | + super().setUp() |
289 | self.distroseries = self.factory.makeDistroSeries() |
290 | self.distribution = self.distroseries.distribution |
291 | self.useFixture(FeatureFixture({ |
292 | @@ -1140,7 +1140,7 @@ class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView): |
293 | class TestOCIRecipeDeleteView(BaseTestOCIRecipeView): |
294 | |
295 | def setUp(self): |
296 | - super(TestOCIRecipeDeleteView, self).setUp() |
297 | + super().setUp() |
298 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
299 | |
300 | def test_unauthorized(self): |
301 | @@ -1208,7 +1208,7 @@ class TestOCIRecipeDeleteView(BaseTestOCIRecipeView): |
302 | class TestOCIRecipeView(BaseTestOCIRecipeView): |
303 | |
304 | def setUp(self): |
305 | - super(TestOCIRecipeView, self).setUp() |
306 | + super().setUp() |
307 | self.distroseries = self.factory.makeDistroSeries() |
308 | processor = getUtility(IProcessorSet).getByName("386") |
309 | self.distroarchseries = self.factory.makeDistroArchSeries( |
310 | @@ -1721,7 +1721,7 @@ class TestOCIRecipeView(BaseTestOCIRecipeView): |
311 | class TestOCIRecipeRequestBuildsView(BaseTestOCIRecipeView): |
312 | |
313 | def setUp(self): |
314 | - super(TestOCIRecipeRequestBuildsView, self).setUp() |
315 | + super().setUp() |
316 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
317 | self.distroseries = self.factory.makeDistroSeries( |
318 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
319 | @@ -1802,7 +1802,7 @@ class TestOCIRecipeRequestBuildsView(BaseTestOCIRecipeView): |
320 | class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, |
321 | BaseTestOCIRecipeView): |
322 | def setUp(self): |
323 | - super(TestOCIRecipeEditPushRulesView, self).setUp() |
324 | + super().setUp() |
325 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
326 | self.distroseries = self.factory.makeDistroSeries( |
327 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
328 | @@ -2232,7 +2232,7 @@ class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, |
329 | self.assertEqual(len(rules), 1) |
330 | rule = rules[0] |
331 | self.assertThat(rule, MatchesStructure( |
332 | - image_name=Equals(u'imagename1'), |
333 | + image_name=Equals('imagename1'), |
334 | registry_url=Equals(url), |
335 | registry_credentials=MatchesStructure( |
336 | url=Equals(url), |
337 | @@ -2325,7 +2325,7 @@ class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, |
338 | |
339 | class TestOCIRecipeListingView(BaseTestOCIRecipeView): |
340 | def setUp(self): |
341 | - super(TestOCIRecipeListingView, self).setUp() |
342 | + super().setUp() |
343 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
344 | self.distroseries = self.factory.makeDistroSeries( |
345 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
346 | diff --git a/lib/lp/oci/browser/tests/test_ocirecipebuild.py b/lib/lp/oci/browser/tests/test_ocirecipebuild.py |
347 | index 7fa823e..2466f85 100644 |
348 | --- a/lib/lp/oci/browser/tests/test_ocirecipebuild.py |
349 | +++ b/lib/lp/oci/browser/tests/test_ocirecipebuild.py |
350 | @@ -46,7 +46,7 @@ class TestCanonicalUrlForOCIRecipeBuild(TestCaseWithFactory): |
351 | layer = DatabaseFunctionalLayer |
352 | |
353 | def setUp(self): |
354 | - super(TestCanonicalUrlForOCIRecipeBuild, self).setUp() |
355 | + super().setUp() |
356 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
357 | |
358 | def test_canonical_url(self): |
359 | @@ -70,7 +70,7 @@ class TestOCIRecipeBuildView(BrowserTestCase): |
360 | layer = LaunchpadFunctionalLayer |
361 | |
362 | def setUp(self): |
363 | - super(TestOCIRecipeBuildView, self).setUp() |
364 | + super().setUp() |
365 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
366 | |
367 | def test_index(self): |
368 | @@ -157,7 +157,7 @@ class TestOCIRecipeBuildOperations(BrowserTestCase): |
369 | layer = DatabaseFunctionalLayer |
370 | |
371 | def setUp(self): |
372 | - super(TestOCIRecipeBuildOperations, self).setUp() |
373 | + super().setUp() |
374 | self.useFixture(FakeLogger()) |
375 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
376 | self.build = self.factory.makeOCIRecipeBuild() |
377 | diff --git a/lib/lp/oci/browser/tests/test_ocirecipesubscription.py b/lib/lp/oci/browser/tests/test_ocirecipesubscription.py |
378 | index 41b76b9..fbd60d6 100644 |
379 | --- a/lib/lp/oci/browser/tests/test_ocirecipesubscription.py |
380 | +++ b/lib/lp/oci/browser/tests/test_ocirecipesubscription.py |
381 | @@ -29,7 +29,7 @@ class BaseTestOCIRecipeView(OCIConfigHelperMixin, BrowserTestCase): |
382 | layer = DatabaseFunctionalLayer |
383 | |
384 | def setUp(self): |
385 | - super(BaseTestOCIRecipeView, self).setUp() |
386 | + super().setUp() |
387 | self.setConfig() |
388 | self.useFixture(FakeLogger()) |
389 | self.person = self.factory.makePerson(name='recipe-owner') |
390 | diff --git a/lib/lp/oci/interfaces/ocipushrule.py b/lib/lp/oci/interfaces/ocipushrule.py |
391 | index 5619875..9c800fa 100644 |
392 | --- a/lib/lp/oci/interfaces/ocipushrule.py |
393 | +++ b/lib/lp/oci/interfaces/ocipushrule.py |
394 | @@ -40,7 +40,7 @@ class OCIPushRuleAlreadyExists(Exception): |
395 | """ |
396 | |
397 | def __init__(self): |
398 | - super(OCIPushRuleAlreadyExists, self).__init__( |
399 | + super().__init__( |
400 | "A push rule already exists with the same URL, image name, " |
401 | "and credentials") |
402 | |
403 | diff --git a/lib/lp/oci/interfaces/ocirecipe.py b/lib/lp/oci/interfaces/ocirecipe.py |
404 | index 47fffe7..2a7256c 100644 |
405 | --- a/lib/lp/oci/interfaces/ocirecipe.py |
406 | +++ b/lib/lp/oci/interfaces/ocirecipe.py |
407 | @@ -94,7 +94,7 @@ class OCIRecipeFeatureDisabled(Unauthorized): |
408 | """Only certain users can create new OCI recipes.""" |
409 | |
410 | def __init__(self): |
411 | - super(OCIRecipeFeatureDisabled, self).__init__( |
412 | + super().__init__( |
413 | "You do not have permission to create new OCI recipes.") |
414 | |
415 | |
416 | @@ -108,7 +108,7 @@ class OCIRecipeBuildAlreadyPending(Exception): |
417 | """A build was requested when an identical build was already pending.""" |
418 | |
419 | def __init__(self): |
420 | - super(OCIRecipeBuildAlreadyPending, self).__init__( |
421 | + super().__init__( |
422 | "An identical build of this OCI recipe is already pending.") |
423 | |
424 | |
425 | @@ -127,7 +127,7 @@ class UsingDistributionCredentials(Exception): |
426 | """The OCI Recipe is in a Distribution that has credentials set.""" |
427 | |
428 | def __init__(self): |
429 | - super(UsingDistributionCredentials, self).__init__( |
430 | + super().__init__( |
431 | "The OCI recipe is in a distribution that has credentials set.") |
432 | |
433 | |
434 | @@ -136,7 +136,7 @@ class NoSourceForOCIRecipe(Exception): |
435 | """OCI Recipes must have a source and build file.""" |
436 | |
437 | def __init__(self): |
438 | - super(NoSourceForOCIRecipe, self).__init__( |
439 | + super().__init__( |
440 | "New OCI recipes must have a git branch and build file.") |
441 | |
442 | |
443 | @@ -149,8 +149,7 @@ class CannotModifyOCIRecipeProcessor(Exception): |
444 | 'by administrators.') |
445 | |
446 | def __init__(self, processor): |
447 | - super(CannotModifyOCIRecipeProcessor, self).__init__( |
448 | - self._fmt % {'processor': processor.name}) |
449 | + super().__init__(self._fmt % {'processor': processor.name}) |
450 | |
451 | |
452 | @error_status(http.client.BAD_REQUEST) |
453 | @@ -158,7 +157,7 @@ class OCIRecipePrivacyMismatch(Exception): |
454 | """OCI recipe privacy does not match its content.""" |
455 | |
456 | def __init__(self, message=None): |
457 | - super(OCIRecipePrivacyMismatch, self).__init__( |
458 | + super().__init__( |
459 | message or |
460 | "OCI recipe contains private information and cannot be public.") |
461 | |
462 | @@ -168,7 +167,7 @@ class OCIRecipeBranchHasInvalidFormat(Exception): |
463 | """The branch name for the OCI recipe does not match the correct format.""" |
464 | |
465 | def __init__(self): |
466 | - super(OCIRecipeBranchHasInvalidFormat, self).__init__( |
467 | + super().__init__( |
468 | "The branch name for the OCI recipe does not " |
469 | "match the APPVERSION-UBUNTUVERSION format (ex. v1.0-20.04)") |
470 | |
471 | diff --git a/lib/lp/oci/interfaces/ociregistryclient.py b/lib/lp/oci/interfaces/ociregistryclient.py |
472 | index 323137d..e149a28 100644 |
473 | --- a/lib/lp/oci/interfaces/ociregistryclient.py |
474 | +++ b/lib/lp/oci/interfaces/ociregistryclient.py |
475 | @@ -18,7 +18,7 @@ class OCIRegistryError(Exception): |
476 | """An error returned by an OCI registry.""" |
477 | |
478 | def __init__(self, summary, errors): |
479 | - super(OCIRegistryError, self).__init__(summary) |
480 | + super().__init__(summary) |
481 | self.errors = errors |
482 | |
483 | |
484 | diff --git a/lib/lp/oci/interfaces/ociregistrycredentials.py b/lib/lp/oci/interfaces/ociregistrycredentials.py |
485 | index 16af53e..a10400c 100644 |
486 | --- a/lib/lp/oci/interfaces/ociregistrycredentials.py |
487 | +++ b/lib/lp/oci/interfaces/ociregistrycredentials.py |
488 | @@ -39,7 +39,7 @@ class OCIRegistryCredentialsAlreadyExist(Exception): |
489 | """ |
490 | |
491 | def __init__(self): |
492 | - super(OCIRegistryCredentialsAlreadyExist, self).__init__( |
493 | + super().__init__( |
494 | "Credentials already exist with the same URL, username, and " |
495 | "region.") |
496 | |
497 | diff --git a/lib/lp/oci/model/ocirecipe.py b/lib/lp/oci/model/ocirecipe.py |
498 | index 274092d..73edd1a 100644 |
499 | --- a/lib/lp/oci/model/ocirecipe.py |
500 | +++ b/lib/lp/oci/model/ocirecipe.py |
501 | @@ -16,7 +16,6 @@ __all__ = [ |
502 | |
503 | from lazr.lifecycle.event import ObjectCreatedEvent |
504 | import pytz |
505 | -import six |
506 | from storm.databases.postgres import JSON |
507 | from storm.expr import ( |
508 | And, |
509 | @@ -246,7 +245,7 @@ class OCIRecipe(Storm, WebhookTargetMixin): |
510 | image_name=None, information_type=InformationType.PUBLIC): |
511 | if not getFeatureFlag(OCI_RECIPE_ALLOW_CREATE): |
512 | raise OCIRecipeFeatureDisabled() |
513 | - super(OCIRecipe, self).__init__() |
514 | + super().__init__() |
515 | self._information_type = information_type |
516 | self.oci_project = oci_project |
517 | self.name = name |
518 | @@ -311,8 +310,7 @@ class OCIRecipe(Storm, WebhookTargetMixin): |
519 | @build_args.setter |
520 | def build_args(self, value): |
521 | assert value is None or isinstance(value, dict) |
522 | - self._build_args = {k: six.text_type(v) |
523 | - for k, v in (value or {}).items()} |
524 | + self._build_args = {k: str(v) for k, v in (value or {}).items()} |
525 | |
526 | def _reconcileAccess(self): |
527 | """Reconcile the OCI recipe's sharing information. |
528 | diff --git a/lib/lp/oci/model/ocirecipebuild.py b/lib/lp/oci/model/ocirecipebuild.py |
529 | index 0172697..fc4e3e2 100644 |
530 | --- a/lib/lp/oci/model/ocirecipebuild.py |
531 | +++ b/lib/lp/oci/model/ocirecipebuild.py |
532 | @@ -104,7 +104,7 @@ class OCIFile(StormBase): |
533 | |
534 | def __init__(self, build, library_file, layer_file_digest=None): |
535 | """Construct a `OCIFile`.""" |
536 | - super(OCIFile, self).__init__() |
537 | + super().__init__() |
538 | self.build = build |
539 | self.library_file = library_file |
540 | self.layer_file_digest = layer_file_digest |
541 | @@ -409,7 +409,7 @@ class OCIRecipeBuild(PackageBuildMixin, StormBase): |
542 | """See `IBuildFarmJob`.""" |
543 | edited_fields = set() |
544 | with notify_modified(self, edited_fields) as previous_obj: |
545 | - super(OCIRecipeBuild, self).updateStatus( |
546 | + super().updateStatus( |
547 | status, builder=builder, slave_status=slave_status, |
548 | date_started=date_started, date_finished=date_finished, |
549 | force_invalid_transition=force_invalid_transition) |
550 | diff --git a/lib/lp/oci/model/ocirecipebuildbehaviour.py b/lib/lp/oci/model/ocirecipebuildbehaviour.py |
551 | index 46c8569..0532204 100644 |
552 | --- a/lib/lp/oci/model/ocirecipebuildbehaviour.py |
553 | +++ b/lib/lp/oci/model/ocirecipebuildbehaviour.py |
554 | @@ -126,8 +126,7 @@ class OCIRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
555 | Return the extra arguments required by the slave for the given build. |
556 | """ |
557 | build = self.build |
558 | - args = yield super(OCIRecipeBuildBehaviour, self).extraBuildArgs( |
559 | - logger=logger) |
560 | + args = yield super().extraBuildArgs(logger=logger) |
561 | yield self.addProxyArgs(args, build.recipe.allow_internet) |
562 | # XXX twom 2020-02-17 This may need to be more complex, and involve |
563 | # distribution name. |
564 | @@ -186,7 +185,7 @@ class OCIRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
565 | self._ensureFilePath(name, file_path, upload_path) |
566 | yield self._slave.getFile(file_hash, file_path) |
567 | |
568 | - with open(file_path, 'r') as file_fp: |
569 | + with open(file_path) as file_fp: |
570 | return json.load(file_fp) |
571 | |
572 | def _extractLayerFiles(self, upload_path, section, config, digests, files): |
573 | diff --git a/lib/lp/oci/model/ocirecipebuildjob.py b/lib/lp/oci/model/ocirecipebuildjob.py |
574 | index 1d3143b..4d7f098 100644 |
575 | --- a/lib/lp/oci/model/ocirecipebuildjob.py |
576 | +++ b/lib/lp/oci/model/ocirecipebuildjob.py |
577 | @@ -95,7 +95,7 @@ class OCIRecipeBuildJob(StormBase): |
578 | :param json_data: The type-specific variables, as a JSON-compatible |
579 | dict. |
580 | """ |
581 | - super(OCIRecipeBuildJob, self).__init__() |
582 | + super().__init__() |
583 | self.job = Job(**job_args) |
584 | self.build = build |
585 | self.job_type = job_type |
586 | @@ -156,7 +156,7 @@ class OCIRecipeBuildJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass): |
587 | |
588 | def getOopsVars(self): |
589 | """See `IRunnableJob`.""" |
590 | - oops_vars = super(OCIRecipeBuildJobDerived, self).getOopsVars() |
591 | + oops_vars = super().getOopsVars() |
592 | oops_vars.extend([ |
593 | ('job_type', self.context.job_type.title), |
594 | ('build_id', self.context.build.id), |
595 | @@ -232,7 +232,7 @@ class OCIRegistryUploadJob(OCIRecipeBuildJobDerived): |
596 | *args, **kwargs): |
597 | edited_fields = set() |
598 | with notify_modified(self.build, edited_fields) as before_modification: |
599 | - getattr(super(OCIRegistryUploadJob, self), method_name)( |
600 | + getattr(super(), method_name)( |
601 | *args, manage_transaction=manage_transaction, **kwargs) |
602 | upload_status = self.build.registry_upload_status |
603 | if upload_status != before_modification.registry_upload_status: |
604 | diff --git a/lib/lp/oci/model/ocirecipejob.py b/lib/lp/oci/model/ocirecipejob.py |
605 | index 33f3429..4ba7d5e 100644 |
606 | --- a/lib/lp/oci/model/ocirecipejob.py |
607 | +++ b/lib/lp/oci/model/ocirecipejob.py |
608 | @@ -96,7 +96,7 @@ class OCIRecipeJob(StormBase): |
609 | :param metadata: The type-specific variables, as a JSON-compatible |
610 | dict. |
611 | """ |
612 | - super(OCIRecipeJob, self).__init__() |
613 | + super().__init__() |
614 | self.job = Job(**job_args) |
615 | self.recipe = recipe |
616 | self.job_type = job_type |
617 | @@ -145,7 +145,7 @@ class OCIRecipeJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass): |
618 | |
619 | def getOopsVars(self): |
620 | """See `IRunnableJob`.""" |
621 | - oops_vars = super(OCIRecipeJobDerived, self).getOopsVars() |
622 | + oops_vars = super().getOopsVars() |
623 | oops_vars.extend([ |
624 | ("job_id", self.context.job.id), |
625 | ("job_type", self.context.job_type.title), |
626 | diff --git a/lib/lp/oci/model/ocirecipesubscription.py b/lib/lp/oci/model/ocirecipesubscription.py |
627 | index 970c66c..4de765e 100644 |
628 | --- a/lib/lp/oci/model/ocirecipesubscription.py |
629 | +++ b/lib/lp/oci/model/ocirecipesubscription.py |
630 | @@ -44,7 +44,7 @@ class OCIRecipeSubscription(StormBase): |
631 | subscribed_by = Reference(subscribed_by_id, "Person.id") |
632 | |
633 | def __init__(self, recipe, person, subscribed_by): |
634 | - super(OCIRecipeSubscription, self).__init__() |
635 | + super().__init__() |
636 | self.recipe = recipe |
637 | self.person = person |
638 | self.subscribed_by = subscribed_by |
639 | diff --git a/lib/lp/oci/model/ociregistryclient.py b/lib/lp/oci/model/ociregistryclient.py |
640 | index 198a4b2..30a99ad 100644 |
641 | --- a/lib/lp/oci/model/ociregistryclient.py |
642 | +++ b/lib/lp/oci/model/ociregistryclient.py |
643 | @@ -617,7 +617,7 @@ class OCIRegistryClient: |
644 | |
645 | class OCIRegistryAuthenticationError(Exception): |
646 | def __init__(self, msg, http_error=None): |
647 | - super(OCIRegistryAuthenticationError, self).__init__(msg) |
648 | + super().__init__(msg) |
649 | self.http_error = http_error |
650 | |
651 | |
652 | @@ -696,7 +696,7 @@ class BearerTokenRegistryClient(RegistryHTTPClient): |
653 | """ |
654 | |
655 | def __init__(self, push_rule): |
656 | - super(BearerTokenRegistryClient, self).__init__(push_rule) |
657 | + super().__init__(push_rule) |
658 | self.auth_token = None |
659 | |
660 | def parseAuthInstructions(self, request): |
661 | @@ -721,7 +721,7 @@ class BearerTokenRegistryClient(RegistryHTTPClient): |
662 | "Auth instructions didn't include realm to get the token: %s" |
663 | % values) |
664 | # We should use the basic auth version for this request. |
665 | - response = super(BearerTokenRegistryClient, self).request( |
666 | + response = super().request( |
667 | url, params=values, method="GET", auth=self.credentials) |
668 | response.raise_for_status() |
669 | response_data = response.json() |
670 | diff --git a/lib/lp/oci/tests/helpers.py b/lib/lp/oci/tests/helpers.py |
671 | index c3b7b4b..336b078 100644 |
672 | --- a/lib/lp/oci/tests/helpers.py |
673 | +++ b/lib/lp/oci/tests/helpers.py |
674 | @@ -49,7 +49,7 @@ class MatchesOCIRegistryCredentials(MatchesAll): |
675 | """ |
676 | |
677 | def __init__(self, main_matcher, credentials_matcher): |
678 | - super(MatchesOCIRegistryCredentials, self).__init__( |
679 | + super().__init__( |
680 | main_matcher, |
681 | AfterPreprocessing( |
682 | lambda matchee: removeSecurityProxy(matchee).getCredentials(), |
683 | diff --git a/lib/lp/oci/tests/test_ocipushrule.py b/lib/lp/oci/tests/test_ocipushrule.py |
684 | index 52fee49..043c6b9 100644 |
685 | --- a/lib/lp/oci/tests/test_ocipushrule.py |
686 | +++ b/lib/lp/oci/tests/test_ocipushrule.py |
687 | @@ -27,7 +27,7 @@ class TestOCIPushRule(OCIConfigHelperMixin, TestCaseWithFactory): |
688 | layer = LaunchpadZopelessLayer |
689 | |
690 | def setUp(self): |
691 | - super(TestOCIPushRule, self).setUp() |
692 | + super().setUp() |
693 | self.setConfig() |
694 | |
695 | def test_implements_interface(self): |
696 | @@ -75,7 +75,7 @@ class TestOCIPushRuleSet(OCIConfigHelperMixin, TestCaseWithFactory): |
697 | layer = LaunchpadZopelessLayer |
698 | |
699 | def setUp(self): |
700 | - super(TestOCIPushRuleSet, self).setUp() |
701 | + super().setUp() |
702 | self.setConfig() |
703 | |
704 | def test_implements_interface(self): |
705 | diff --git a/lib/lp/oci/tests/test_ocirecipe.py b/lib/lp/oci/tests/test_ocirecipe.py |
706 | index 6bab89e..b3b4475 100644 |
707 | --- a/lib/lp/oci/tests/test_ocirecipe.py |
708 | +++ b/lib/lp/oci/tests/test_ocirecipe.py |
709 | @@ -7,8 +7,6 @@ from datetime import datetime |
710 | import json |
711 | |
712 | from fixtures import FakeLogger |
713 | -import six |
714 | -from six import string_types |
715 | from storm.exceptions import LostObjectError |
716 | from storm.store import Store |
717 | from testtools import ExpectedException |
718 | @@ -113,7 +111,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): |
719 | layer = DatabaseFunctionalLayer |
720 | |
721 | def setUp(self): |
722 | - super(TestOCIRecipe, self).setUp() |
723 | + super().setUp() |
724 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
725 | |
726 | def test_implements_interface(self): |
727 | @@ -759,7 +757,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): |
728 | # It should be sorted by owner's name first, then recipe name. |
729 | self.assertEqual( |
730 | [recipe3, recipe1, recipe2], |
731 | - list(oci_project.searchRecipes(u"a"))) |
732 | + list(oci_project.searchRecipes("a"))) |
733 | |
734 | def test_build_args_dict(self): |
735 | args = {"MY_VERSION": "1.0.3", "ANOTHER_VERSION": "2.9.88"} |
736 | @@ -784,7 +782,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): |
737 | # Makes sure we only store one level of key=pair, flattening to |
738 | # string every value. |
739 | args = { |
740 | - "VAR1": {six.ensure_str("something"): [1, 2, 3]}, |
741 | + "VAR1": {"something": [1, 2, 3]}, |
742 | "VAR2": 123, |
743 | "VAR3": "A string", |
744 | } |
745 | @@ -873,7 +871,7 @@ class TestOCIRecipeAccessControl(TestCaseWithFactory, OCIConfigHelperMixin): |
746 | layer = DatabaseFunctionalLayer |
747 | |
748 | def setUp(self): |
749 | - super(TestOCIRecipeAccessControl, self).setUp() |
750 | + super().setUp() |
751 | self.setConfig() |
752 | |
753 | def test_change_oci_project_pillar_reconciles_access(self): |
754 | @@ -1042,8 +1040,7 @@ class TestOCIRecipeProcessors(TestCaseWithFactory): |
755 | layer = DatabaseFunctionalLayer |
756 | |
757 | def setUp(self): |
758 | - super(TestOCIRecipeProcessors, self).setUp( |
759 | - user="foo.bar@canonical.com") |
760 | + super().setUp(user="foo.bar@canonical.com") |
761 | self.default_procs = [ |
762 | getUtility(IProcessorSet).getByName("386"), |
763 | getUtility(IProcessorSet).getByName("amd64")] |
764 | @@ -1192,7 +1189,7 @@ class TestOCIRecipeSet(TestCaseWithFactory): |
765 | layer = DatabaseFunctionalLayer |
766 | |
767 | def setUp(self): |
768 | - super(TestOCIRecipeSet, self).setUp() |
769 | + super().setUp() |
770 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
771 | |
772 | def test_implements_interface(self): |
773 | @@ -1373,7 +1370,7 @@ class TestOCIRecipeWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
774 | layer = DatabaseFunctionalLayer |
775 | |
776 | def setUp(self): |
777 | - super(TestOCIRecipeWebservice, self).setUp() |
778 | + super().setUp() |
779 | self.person = self.factory.makePerson( |
780 | displayname="Test Person") |
781 | self.webservice = webservice_for_person( |
782 | @@ -1384,7 +1381,7 @@ class TestOCIRecipeWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
783 | def getAbsoluteURL(self, target): |
784 | """Get the webservice absolute URL of the given object or relative |
785 | path.""" |
786 | - if not isinstance(target, string_types): |
787 | + if not isinstance(target, str): |
788 | target = api_url(target) |
789 | return self.webservice.getAbsoluteUrl(target) |
790 | |
791 | @@ -1688,7 +1685,7 @@ class TestOCIRecipeAsyncWebservice(TestCaseWithFactory): |
792 | layer = LaunchpadFunctionalLayer |
793 | |
794 | def setUp(self): |
795 | - super(TestOCIRecipeAsyncWebservice, self).setUp() |
796 | + super().setUp() |
797 | self.person = self.factory.makePerson( |
798 | displayname="Test Person") |
799 | self.webservice = webservice_for_person( |
800 | @@ -1764,8 +1761,8 @@ class TestOCIRecipeAsyncWebservice(TestCaseWithFactory): |
801 | "recipe_link": Equals(abs_url(oci_recipe)), |
802 | "requester_link": Equals(abs_url(self.person)), |
803 | "buildstate": Equals("Needs building"), |
804 | - "eta": IsInstance(string_types, type(None)), |
805 | - "date": IsInstance(string_types, type(None)), |
806 | + "eta": IsInstance(str, type(None)), |
807 | + "date": IsInstance(str, type(None)), |
808 | "estimate": IsInstance(bool), |
809 | "distro_arch_series_link": Equals(abs_url(arch_series)), |
810 | "registry_upload_status": Equals("Unscheduled"), |
811 | diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py |
812 | index c86169e..1ec8718 100644 |
813 | --- a/lib/lp/oci/tests/test_ocirecipebuild.py |
814 | +++ b/lib/lp/oci/tests/test_ocirecipebuild.py |
815 | @@ -11,7 +11,6 @@ from datetime import ( |
816 | from fixtures import FakeLogger |
817 | from pymacaroons import Macaroon |
818 | import pytz |
819 | -import six |
820 | from six.moves.urllib.request import urlopen |
821 | from testtools.matchers import ( |
822 | ContainsDict, |
823 | @@ -93,7 +92,7 @@ class TestOCIFileSet(TestCaseWithFactory): |
824 | layer = LaunchpadZopelessLayer |
825 | |
826 | def setUp(self): |
827 | - super(TestOCIFileSet, self).setUp() |
828 | + super().setUp() |
829 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
830 | |
831 | def test_implements_interface(self): |
832 | @@ -119,7 +118,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): |
833 | layer = LaunchpadZopelessLayer |
834 | |
835 | def setUp(self): |
836 | - super(TestOCIRecipeBuild, self).setUp() |
837 | + super().setUp() |
838 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
839 | self.build = self.factory.makeOCIRecipeBuild() |
840 | |
841 | @@ -160,7 +159,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): |
842 | |
843 | def test_getLayerFileByDigest(self): |
844 | files = [self.factory.makeOCIFile( |
845 | - build=self.build, layer_file_digest=six.text_type(x)) |
846 | + build=self.build, layer_file_digest=str(x)) |
847 | for x in range(3)] |
848 | result, _, _ = self.build.getLayerFileByDigest( |
849 | files[0].layer_file_digest) |
850 | @@ -168,7 +167,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): |
851 | |
852 | def test_getLayerFileByDigest_missing(self): |
853 | [self.factory.makeOCIFile( |
854 | - build=self.build, layer_file_digest=six.text_type(x)) |
855 | + build=self.build, layer_file_digest=str(x)) |
856 | for x in range(3)] |
857 | self.assertRaises( |
858 | NotFoundError, |
859 | @@ -609,7 +608,7 @@ class TestOCIRecipeBuildSet(TestCaseWithFactory): |
860 | layer = DatabaseFunctionalLayer |
861 | |
862 | def setUp(self): |
863 | - super(TestOCIRecipeBuildSet, self).setUp() |
864 | + super().setUp() |
865 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
866 | |
867 | def test_implements_interface(self): |
868 | @@ -707,7 +706,7 @@ class TestOCIRecipeBuildWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
869 | layer = LaunchpadFunctionalLayer |
870 | |
871 | def setUp(self): |
872 | - super(TestOCIRecipeBuildWebservice, self).setUp() |
873 | + super().setUp() |
874 | self.setConfig() |
875 | self.person = self.factory.makePerson() |
876 | self.webservice = webservice_for_person( |
877 | @@ -855,7 +854,7 @@ class TestOCIRecipeBuildMacaroonIssuer( |
878 | layer = LaunchpadZopelessLayer |
879 | |
880 | def setUp(self): |
881 | - super(TestOCIRecipeBuildMacaroonIssuer, self).setUp() |
882 | + super().setUp() |
883 | self.setConfig() |
884 | self.pushConfig( |
885 | "launchpad", internal_macaroon_secret_key="some-secret") |
886 | diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py |
887 | index 5109dfe..0961a2b 100644 |
888 | --- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py |
889 | +++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py |
890 | @@ -140,7 +140,7 @@ class TestOCIBuildBehaviour(TestCaseWithFactory): |
891 | layer = LaunchpadZopelessLayer |
892 | |
893 | def setUp(self): |
894 | - super(TestOCIBuildBehaviour, self).setUp() |
895 | + super().setUp() |
896 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
897 | |
898 | def test_provides_interface(self): |
899 | @@ -164,7 +164,7 @@ class TestAsyncOCIRecipeBuildBehaviour( |
900 | |
901 | @defer.inlineCallbacks |
902 | def setUp(self): |
903 | - super(TestAsyncOCIRecipeBuildBehaviour, self).setUp() |
904 | + super().setUp() |
905 | build_username = 'OCIBUILD-1' |
906 | self.token = {'secret': uuid.uuid4().hex, |
907 | 'username': build_username, |
908 | @@ -696,7 +696,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin, |
909 | self.slave.valid_files[hash] = path |
910 | |
911 | def setUp(self): |
912 | - super(TestHandleStatusForOCIRecipeBuild, self).setUp() |
913 | + super().setUp() |
914 | self.useFixture(fixtures.FakeLogger()) |
915 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
916 | self.build = self.makeBuild() |
917 | @@ -766,7 +766,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin, |
918 | 'layer_2.tar.gz': 'layer_2_hash' |
919 | } |
920 | self.factory.makeOCIFile( |
921 | - build=self.build, layer_file_digest=u'digest_1', |
922 | + build=self.build, layer_file_digest='digest_1', |
923 | content=b"retrieved from librarian") |
924 | |
925 | def assertResultCount(self, count, result): |
926 | @@ -809,7 +809,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin, |
927 | def test_handleStatus_OK_reuse_from_other_build(self): |
928 | """We should be able to reuse a layer file from a separate build.""" |
929 | oci_file = self.factory.makeOCIFile( |
930 | - layer_file_digest=u'digest_2', |
931 | + layer_file_digest='digest_2', |
932 | content=b"layer 2 retrieved from librarian") |
933 | |
934 | now = datetime.now(pytz.UTC) |
935 | @@ -971,4 +971,4 @@ class TestGetUploadMethodsForOCIRecipeBuild( |
936 | """IPackageBuild.getUpload-related methods work with OCI recipe builds.""" |
937 | def setUp(self): |
938 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
939 | - super(TestGetUploadMethodsForOCIRecipeBuild, self).setUp() |
940 | + super().setUp() |
941 | diff --git a/lib/lp/oci/tests/test_ocirecipebuildjob.py b/lib/lp/oci/tests/test_ocirecipebuildjob.py |
942 | index 742b3ec..2bece4a 100644 |
943 | --- a/lib/lp/oci/tests/test_ocirecipebuildjob.py |
944 | +++ b/lib/lp/oci/tests/test_ocirecipebuildjob.py |
945 | @@ -99,7 +99,7 @@ class TestOCIRecipeBuildJob(TestCaseWithFactory): |
946 | layer = DatabaseFunctionalLayer |
947 | |
948 | def setUp(self): |
949 | - super(TestOCIRecipeBuildJob, self).setUp() |
950 | + super().setUp() |
951 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
952 | |
953 | def test_provides_interface(self): |
954 | @@ -130,7 +130,7 @@ class TestOCIRecipeBuildJobDerived(TestCaseWithFactory): |
955 | layer = DatabaseFunctionalLayer |
956 | |
957 | def setUp(self): |
958 | - super(TestOCIRecipeBuildJobDerived, self).setUp() |
959 | + super().setUp() |
960 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
961 | |
962 | def test_repr(self): |
963 | @@ -151,8 +151,7 @@ class TestOCIRecipeBuildJobDerived(TestCaseWithFactory): |
964 | def __getattribute__(self, item): |
965 | if item == 'build': |
966 | raise AttributeError("Somethng is wrong with build") |
967 | - return super( |
968 | - ErrorOCIRecipeBuildJobDerived, self).__getattribute__(item) |
969 | + return super().__getattribute__(item) |
970 | oci_build = self.factory.makeOCIRecipeBuild() |
971 | job = OCIRecipeBuildJob( |
972 | oci_build, OCIRecipeBuildJobType.REGISTRY_UPLOAD, {}) |
973 | @@ -204,7 +203,7 @@ class TestOCIRegistryUploadJob(TestCaseWithFactory, MultiArchRecipeMixin, |
974 | layer = LaunchpadZopelessLayer |
975 | |
976 | def setUp(self): |
977 | - super(TestOCIRegistryUploadJob, self).setUp() |
978 | + super().setUp() |
979 | self.useFixture(FeatureFixture({ |
980 | 'webhooks.new.enabled': 'true', |
981 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: 'on', |
982 | @@ -556,7 +555,7 @@ class TestOCIRegistryUploadJobViaCelery(TestCaseWithFactory, |
983 | layer = CelerySlowJobLayer |
984 | |
985 | def setUp(self): |
986 | - super(TestOCIRegistryUploadJobViaCelery, self).setUp() |
987 | + super().setUp() |
988 | self.useFixture(FeatureFixture({ |
989 | 'webhooks.new.enabled': 'true', |
990 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: 'on', |
991 | diff --git a/lib/lp/oci/tests/test_ocirecipejob.py b/lib/lp/oci/tests/test_ocirecipejob.py |
992 | index 2a37120..ef0400f 100644 |
993 | --- a/lib/lp/oci/tests/test_ocirecipejob.py |
994 | +++ b/lib/lp/oci/tests/test_ocirecipejob.py |
995 | @@ -29,7 +29,7 @@ class TestOCIRecipeRequestBuildsJob(TestCaseWithFactory): |
996 | layer = DatabaseFunctionalLayer |
997 | |
998 | def setUp(self): |
999 | - super(TestOCIRecipeRequestBuildsJob, self).setUp() |
1000 | + super().setUp() |
1001 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
1002 | |
1003 | def getDistroArchSeries(self, distroseries, proc_name="386", |
1004 | diff --git a/lib/lp/oci/tests/test_ociregistryclient.py b/lib/lp/oci/tests/test_ociregistryclient.py |
1005 | index b6e84fc..22e8cfa 100644 |
1006 | --- a/lib/lp/oci/tests/test_ociregistryclient.py |
1007 | +++ b/lib/lp/oci/tests/test_ociregistryclient.py |
1008 | @@ -99,7 +99,7 @@ class TestOCIRegistryClient(OCIConfigHelperMixin, SpyProxyCallsMixin, |
1009 | retry_count = 0 |
1010 | |
1011 | def setUp(self): |
1012 | - super(TestOCIRegistryClient, self).setUp() |
1013 | + super().setUp() |
1014 | self.setConfig() |
1015 | self.setupProxySpy() |
1016 | self.manifest = [{ |
1017 | @@ -1174,7 +1174,7 @@ class TestRegistryHTTPClient(OCIConfigHelperMixin, SpyProxyCallsMixin, |
1018 | layer = DatabaseFunctionalLayer |
1019 | |
1020 | def setUp(self): |
1021 | - super(TestRegistryHTTPClient, self).setUp() |
1022 | + super().setUp() |
1023 | self.setConfig() |
1024 | self.setupProxySpy() |
1025 | |
1026 | @@ -1314,8 +1314,8 @@ class TestRegistryHTTPClient(OCIConfigHelperMixin, SpyProxyCallsMixin, |
1027 | boto.client.call_args) |
1028 | config = boto.client.call_args[-1]['config'] |
1029 | self.assertEqual({ |
1030 | - u'http': u'http://proxy.example.com:123', |
1031 | - u'https': u'http://proxy.example.com:123'}, config.proxies) |
1032 | + 'http': 'http://proxy.example.com:123', |
1033 | + 'https': 'http://proxy.example.com:123'}, config.proxies) |
1034 | |
1035 | @responses.activate |
1036 | def test_aws_malformed_url_region(self): |
1037 | @@ -1336,7 +1336,7 @@ class TestBearerTokenRegistryClient(OCIConfigHelperMixin, |
1038 | layer = DatabaseFunctionalLayer |
1039 | |
1040 | def setUp(self): |
1041 | - super(TestBearerTokenRegistryClient, self).setUp() |
1042 | + super().setUp() |
1043 | self.setConfig() |
1044 | self.setupProxySpy() |
1045 | |
1046 | @@ -1510,7 +1510,7 @@ class TestAWSAuthenticator(OCIConfigHelperMixin, TestCaseWithFactory): |
1047 | layer = DatabaseFunctionalLayer |
1048 | |
1049 | def setUp(self): |
1050 | - super(TestAWSAuthenticator, self).setUp() |
1051 | + super().setUp() |
1052 | self.setConfig() |
1053 | |
1054 | def test_get_region_from_credential(self): |
1055 | diff --git a/lib/lp/oci/tests/test_ociregistrycredentials.py b/lib/lp/oci/tests/test_ociregistrycredentials.py |
1056 | index 1680091..66f51af 100644 |
1057 | --- a/lib/lp/oci/tests/test_ociregistrycredentials.py |
1058 | +++ b/lib/lp/oci/tests/test_ociregistrycredentials.py |
1059 | @@ -35,7 +35,7 @@ class TestOCIRegistryCredentials(OCIConfigHelperMixin, TestCaseWithFactory): |
1060 | layer = LaunchpadZopelessLayer |
1061 | |
1062 | def setUp(self): |
1063 | - super(TestOCIRegistryCredentials, self).setUp() |
1064 | + super().setUp() |
1065 | self.setConfig() |
1066 | |
1067 | def test_implements_interface(self): |
1068 | @@ -139,7 +139,7 @@ class TestOCIRegistryCredentialsSet(OCIConfigHelperMixin, TestCaseWithFactory): |
1069 | layer = LaunchpadZopelessLayer |
1070 | |
1071 | def setUp(self): |
1072 | - super(TestOCIRegistryCredentialsSet, self).setUp() |
1073 | + super().setUp() |
1074 | self.setConfig() |
1075 | |
1076 | def test_implements_interface(self): |
Self-approving (mechanical).