Merge ~cjwatson/launchpad:pyupgrade-py3-blueprints into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-blueprints
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 13dd22f798bdf4b564c387456e989127fde80195 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:pyupgrade-py3-blueprints |
Merge into: | launchpad:master |
Diff against target: |
665 lines (+73/-75) 27 files modified
.pre-commit-config.yaml (+8/-1) lib/lp/blueprints/browser/person_upcomingwork.py (+3/-3) lib/lp/blueprints/browser/specification.py (+23/-23) lib/lp/blueprints/browser/specificationbranch.py (+2/-2) lib/lp/blueprints/browser/specificationgoal.py (+1/-3) lib/lp/blueprints/browser/specificationtarget.py (+1/-1) lib/lp/blueprints/browser/sprint.py (+2/-2) lib/lp/blueprints/browser/sprintattendance.py (+1/-3) lib/lp/blueprints/browser/tests/test_breadcrumbs.py (+2/-2) lib/lp/blueprints/browser/tests/test_hasspecifications.py (+1/-1) lib/lp/blueprints/browser/tests/test_person_upcomingwork.py (+4/-4) lib/lp/blueprints/browser/tests/test_specification.py (+1/-1) lib/lp/blueprints/browser/tests/test_specificationtarget.py (+4/-5) lib/lp/blueprints/browser/tests/test_views.py (+1/-1) lib/lp/blueprints/errors.py (+1/-1) lib/lp/blueprints/interfaces/specification.py (+2/-2) lib/lp/blueprints/interfaces/specificationmessage.py (+3/-3) lib/lp/blueprints/model/specification.py (+3/-6) lib/lp/blueprints/model/specificationbranch.py (+1/-1) lib/lp/blueprints/model/specificationsearch.py (+1/-2) lib/lp/blueprints/model/specificationsubscription.py (+1/-1) lib/lp/blueprints/model/sprint.py (+1/-1) lib/lp/blueprints/model/sprintspecification.py (+1/-1) lib/lp/blueprints/model/tests/test_specification.py (+1/-1) lib/lp/blueprints/model/tests/test_sprint.py (+1/-1) lib/lp/blueprints/tests/test_specification.py (+2/-2) lib/lp/blueprints/tests/test_webservice.py (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+412898@code.launchpad.net |
Commit message
lp.blueprints: 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/.pre-commit-config.yaml b/.pre-commit-config.yaml |
2 | index 17e1dff..8eaaf20 100644 |
3 | --- a/.pre-commit-config.yaml |
4 | +++ b/.pre-commit-config.yaml |
5 | @@ -38,7 +38,14 @@ repos: |
6 | alias: pyupgrade-py3 |
7 | name: pyupgrade (--py3-plus) |
8 | args: [--keep-percent-format, --py3-plus] |
9 | - files: ^lib/lp/(answers|app|archivepublisher|archiveuploader)/ |
10 | + files: | |
11 | + (?x)^lib/lp/( |
12 | + answers |
13 | + |app |
14 | + |archivepublisher |
15 | + |archiveuploader |
16 | + |blueprints |
17 | + )/ |
18 | - repo: https://github.com/PyCQA/isort |
19 | rev: 5.9.2 |
20 | hooks: |
21 | diff --git a/lib/lp/blueprints/browser/person_upcomingwork.py b/lib/lp/blueprints/browser/person_upcomingwork.py |
22 | index 37b0030..e4b24bb 100644 |
23 | --- a/lib/lp/blueprints/browser/person_upcomingwork.py |
24 | +++ b/lib/lp/blueprints/browser/person_upcomingwork.py |
25 | @@ -33,7 +33,7 @@ class PersonUpcomingWorkView(LaunchpadView): |
26 | DAYS = 180 |
27 | |
28 | def initialize(self): |
29 | - super(PersonUpcomingWorkView, self).initialize() |
30 | + super().initialize() |
31 | self.workitem_counts = {} |
32 | self.bugtask_counts = {} |
33 | self.milestones_per_date = {} |
34 | @@ -79,7 +79,7 @@ class PersonUpcomingWorkView(LaunchpadView): |
35 | return sorted(result.items(), key=itemgetter(0)) |
36 | |
37 | |
38 | -class WorkItemContainer(object): |
39 | +class WorkItemContainer: |
40 | """A container of work items, assigned to a person (or a team's |
41 | participatns), whose milestone is due on a certain date. |
42 | """ |
43 | @@ -140,7 +140,7 @@ class SpecWorkItemContainer(WorkItemContainer): |
44 | """A container of SpecificationWorkItems wrapped with GenericWorkItem.""" |
45 | |
46 | def __init__(self, spec): |
47 | - super(SpecWorkItemContainer, self).__init__() |
48 | + super().__init__() |
49 | self.spec = spec |
50 | self.priority = spec.priority |
51 | self.target = spec.target |
52 | diff --git a/lib/lp/blueprints/browser/specification.py b/lib/lp/blueprints/browser/specification.py |
53 | index 2f89e1e..a4b9cf8 100644 |
54 | --- a/lib/lp/blueprints/browser/specification.py |
55 | +++ b/lib/lp/blueprints/browser/specification.py |
56 | @@ -221,7 +221,7 @@ class NewSpecificationView(LaunchpadFormView): |
57 | def initialize(self): |
58 | cache = IJSONRequestCache(self.request) |
59 | json_dump_information_types(cache, self.info_types) |
60 | - super(NewSpecificationView, self).initialize() |
61 | + super().initialize() |
62 | |
63 | @action(_('Register Blueprint'), name='register') |
64 | def register(self, action, data): |
65 | @@ -300,7 +300,7 @@ class NewSpecificationView(LaunchpadFormView): |
66 | |
67 | def validate(self, data): |
68 | """See `LaunchpadFormView`.`""" |
69 | - super(NewSpecificationView, self).validate(data) |
70 | + super().validate(data) |
71 | information_type = data.get('information_type', None) |
72 | if information_type is None: |
73 | # We rely on the model to set the correct default value. |
74 | @@ -324,7 +324,7 @@ class NewSpecificationView(LaunchpadFormView): |
75 | self.setFieldError('information_type', error) |
76 | |
77 | def setUpWidgets(self): |
78 | - super(NewSpecificationView, self).setUpWidgets() |
79 | + super().setUpWidgets() |
80 | widget = self.widgets['drafter'] |
81 | widget.setRenderedValue(self.user) |
82 | |
83 | @@ -378,7 +378,7 @@ class NewSpecificationFromDistroSeriesView(NewSpecificationFromSeriesView): |
84 | """A view for creating a specification from a distro series.""" |
85 | |
86 | def transform(self, data): |
87 | - super(NewSpecificationFromDistroSeriesView, self).transform(data) |
88 | + super().transform(data) |
89 | data['distribution'] = self.context.distribution |
90 | |
91 | |
92 | @@ -386,7 +386,7 @@ class NewSpecificationFromProductSeriesView(NewSpecificationFromSeriesView): |
93 | """A view for creating a specification from a product series.""" |
94 | |
95 | def transform(self, data): |
96 | - super(NewSpecificationFromProductSeriesView, self).transform(data) |
97 | + super().transform(data) |
98 | data['product'] = self.context.product |
99 | |
100 | |
101 | @@ -407,7 +407,7 @@ class NewSpecificationFromNonTargetView(NewSpecificationView): |
102 | |
103 | The name must be unique within the context of the chosen target. |
104 | """ |
105 | - super(NewSpecificationFromNonTargetView, self).validate(data) |
106 | + super().validate(data) |
107 | name = data.get('name') |
108 | target = data.get('target') |
109 | if name is not None and target is not None: |
110 | @@ -447,7 +447,7 @@ class NewSpecificationFromSprintView(NewSpecificationFromNonTargetView): |
111 | return self.append_info_type(fields) |
112 | |
113 | def transform(self, data): |
114 | - super(NewSpecificationFromSprintView, self).transform(data) |
115 | + super().transform(data) |
116 | data['sprint'] = self.context |
117 | |
118 | @property |
119 | @@ -660,7 +660,7 @@ class SpecificationView(SpecificationSimpleView): |
120 | return self.context.summary |
121 | |
122 | def initialize(self): |
123 | - super(SpecificationView, self).initialize() |
124 | + super().initialize() |
125 | # The review that the user requested on this spec, if any. |
126 | self.notices = [] |
127 | |
128 | @@ -1049,7 +1049,7 @@ class SpecificationSupersedingView(LaunchpadFormView): |
129 | |
130 | def validate(self, data): |
131 | """See `LaunchpadFormView`.`""" |
132 | - super(SpecificationSupersedingView, self).validate(data) |
133 | + super().validate(data) |
134 | if data['superseded_by']: |
135 | spec = getUtility(ISpecificationSet).getByName( |
136 | self.context.target, data['superseded_by']) |
137 | @@ -1264,7 +1264,7 @@ class SpecGraph: |
138 | L.append('%s -> %s' % ( |
139 | to_DOT_ID(from_node.name), to_DOT_ID(to_node.name))) |
140 | L.append('}') |
141 | - return u'\n'.join(L) |
142 | + return '\n'.join(L) |
143 | |
144 | |
145 | class SpecificationSprintAddView(LaunchpadFormView): |
146 | @@ -1342,7 +1342,7 @@ class SpecGraphNode: |
147 | # except the one that were currently on the page of. |
148 | attrnames.append('URL') |
149 | attrdict = {name: getattr(self, name) for name in attrnames} |
150 | - return u'%s\n%s' % (to_DOT_ID(self.name), dict_to_DOT_attrs(attrdict)) |
151 | + return '%s\n%s' % (to_DOT_ID(self.name), dict_to_DOT_attrs(attrdict)) |
152 | |
153 | |
154 | def dict_to_DOT_attrs(some_dict, indent=' '): |
155 | @@ -1354,7 +1354,7 @@ def dict_to_DOT_attrs(some_dict, indent=' '): |
156 | The attributes are sorted by dict key. |
157 | """ |
158 | if not some_dict: |
159 | - return u'' |
160 | + return '' |
161 | L = [] |
162 | L.append('[') |
163 | for key, value in sorted(some_dict.items()): |
164 | @@ -1363,7 +1363,7 @@ def dict_to_DOT_attrs(some_dict, indent=' '): |
165 | lastitem = L.pop() |
166 | L.append(lastitem[:-1]) |
167 | L.append(']') |
168 | - return u'\n'.join('%s%s' % (indent, line) for line in L) |
169 | + return '\n'.join('%s%s' % (indent, line) for line in L) |
170 | |
171 | |
172 | def to_DOT_ID(value): |
173 | @@ -1378,10 +1378,10 @@ def to_DOT_ID(value): |
174 | if isinstance(value, bytes): |
175 | unitext = six.ensure_text(value, encoding='ascii') |
176 | else: |
177 | - unitext = six.text_type(value) |
178 | - output = unitext.replace(u'"', u'\\"') |
179 | - output = output.replace(u'\n', u'\\n') |
180 | - return u'"%s"' % output |
181 | + unitext = str(value) |
182 | + output = unitext.replace('"', '\\"') |
183 | + output = output.replace('\n', '\\n') |
184 | + return '"%s"' % output |
185 | |
186 | |
187 | class ProblemRenderingGraph(Exception): |
188 | @@ -1481,14 +1481,14 @@ class SpecificationTreeImageTag(SpecificationTreeGraphView): |
189 | if isinstance(error, OSError): |
190 | # An OSError can be random. The image map may generate |
191 | # if the user reloads the page. |
192 | - extra_help = u' Reload the page to link the image.' |
193 | + extra_help = ' Reload the page to link the image.' |
194 | else: |
195 | - extra_help = u'' |
196 | + extra_help = '' |
197 | image_map = ( |
198 | - u'<p class="error message">' |
199 | - u'There was an error linking the dependency tree to its ' |
200 | - u'specs.' + extra_help + u'</p>') |
201 | - return (u'<img src="deptree.png" usemap="#deptree" />\n' + image_map) |
202 | + '<p class="error message">' |
203 | + 'There was an error linking the dependency tree to its ' |
204 | + 'specs.' + extra_help + '</p>') |
205 | + return ('<img src="deptree.png" usemap="#deptree" />\n' + image_map) |
206 | |
207 | |
208 | class SpecificationTreeDotOutput(SpecificationTreeGraphView): |
209 | diff --git a/lib/lp/blueprints/browser/specificationbranch.py b/lib/lp/blueprints/browser/specificationbranch.py |
210 | index 5894e56..2c58b74 100644 |
211 | --- a/lib/lp/blueprints/browser/specificationbranch.py |
212 | +++ b/lib/lp/blueprints/browser/specificationbranch.py |
213 | @@ -38,7 +38,7 @@ class SpecificationBranchURL: |
214 | |
215 | @property |
216 | def path(self): |
217 | - return u'+branch/%s' % self.branch.unique_name[1:] |
218 | + return '+branch/%s' % self.branch.unique_name[1:] |
219 | |
220 | |
221 | class SpecificationBranchStatusView(LaunchpadEditFormView): |
222 | @@ -50,7 +50,7 @@ class SpecificationBranchStatusView(LaunchpadEditFormView): |
223 | |
224 | def initialize(self): |
225 | self.specification = self.context.specification |
226 | - super(SpecificationBranchStatusView, self).initialize() |
227 | + super().initialize() |
228 | |
229 | @property |
230 | def next_url(self): |
231 | diff --git a/lib/lp/blueprints/browser/specificationgoal.py b/lib/lp/blueprints/browser/specificationgoal.py |
232 | index a7d6277..911e0f1 100644 |
233 | --- a/lib/lp/blueprints/browser/specificationgoal.py |
234 | +++ b/lib/lp/blueprints/browser/specificationgoal.py |
235 | @@ -7,8 +7,6 @@ __all__ = [ |
236 | 'GoalDecideView', |
237 | ] |
238 | |
239 | - |
240 | -import six |
241 | from zope.component import getUtility |
242 | |
243 | from lp.blueprints.browser.specificationtarget import HasSpecificationsView |
244 | @@ -78,7 +76,7 @@ class GoalDecideView(HasSpecificationsView, LaunchpadView): |
245 | action = 'Declined' |
246 | |
247 | selected_specs = form['specification'] |
248 | - if isinstance(selected_specs, six.text_type): |
249 | + if isinstance(selected_specs, str): |
250 | # only a single item was selected, but we want to deal with a |
251 | # list for the general case, so convert it to a list |
252 | selected_specs = [selected_specs] |
253 | diff --git a/lib/lp/blueprints/browser/specificationtarget.py b/lib/lp/blueprints/browser/specificationtarget.py |
254 | index e7dcbd3..0de51ca 100644 |
255 | --- a/lib/lp/blueprints/browser/specificationtarget.py |
256 | +++ b/lib/lp/blueprints/browser/specificationtarget.py |
257 | @@ -162,7 +162,7 @@ class HasSpecificationsView(LaunchpadView): |
258 | # mixed in by the browser:page zcml directive the template defined in |
259 | # the directive should be used. |
260 | if safe_hasattr(self, 'index'): |
261 | - return super(HasSpecificationsView, self).template |
262 | + return super().template |
263 | |
264 | # Sprints and Persons don't have a usage enum for blueprints, so we |
265 | # have to fallback to the default. |
266 | diff --git a/lib/lp/blueprints/browser/sprint.py b/lib/lp/blueprints/browser/sprint.py |
267 | index 3945820..84ac65e 100644 |
268 | --- a/lib/lp/blueprints/browser/sprint.py |
269 | +++ b/lib/lp/blueprints/browser/sprint.py |
270 | @@ -457,7 +457,7 @@ class SprintTopicSetView(HasSpecificationsView, LaunchpadView): |
271 | action = 'Declined' |
272 | |
273 | selected_specs = form['speclink'] |
274 | - if isinstance(selected_specs, six.text_type): |
275 | + if isinstance(selected_specs, str): |
276 | # only a single item was selected, but we want to deal with a |
277 | # list for the general case, so convert it to a list |
278 | selected_specs = [selected_specs] |
279 | @@ -534,7 +534,7 @@ class SprintMeetingExportView(LaunchpadView): |
280 | def render(self): |
281 | self.request.response.setHeader( |
282 | 'content-type', 'application/xml;charset=utf-8') |
283 | - body = super(SprintMeetingExportView, self).render() |
284 | + body = super().render() |
285 | return body.encode('utf-8') |
286 | |
287 | |
288 | diff --git a/lib/lp/blueprints/browser/sprintattendance.py b/lib/lp/blueprints/browser/sprintattendance.py |
289 | index 87ca4b5..a3ed9ba 100644 |
290 | --- a/lib/lp/blueprints/browser/sprintattendance.py |
291 | +++ b/lib/lp/blueprints/browser/sprintattendance.py |
292 | @@ -170,9 +170,7 @@ class SprintAttendanceRegisterView(BaseSprintAttendanceAddView): |
293 | |
294 | @property |
295 | def field_names(self): |
296 | - return ( |
297 | - ['attendee'] + |
298 | - super(SprintAttendanceRegisterView, self).field_names) |
299 | + return ['attendee'] + super().field_names |
300 | |
301 | @property |
302 | def initial_values(self): |
303 | diff --git a/lib/lp/blueprints/browser/tests/test_breadcrumbs.py b/lib/lp/blueprints/browser/tests/test_breadcrumbs.py |
304 | index 548ecf2..dc5c8e5 100644 |
305 | --- a/lib/lp/blueprints/browser/tests/test_breadcrumbs.py |
306 | +++ b/lib/lp/blueprints/browser/tests/test_breadcrumbs.py |
307 | @@ -10,7 +10,7 @@ class TestHasSpecificationsBreadcrumbOnBlueprintsFacet( |
308 | """Test Breadcrumbs for IHasSpecifications on the blueprints vhost.""" |
309 | |
310 | def setUp(self): |
311 | - super(TestHasSpecificationsBreadcrumbOnBlueprintsFacet, self).setUp() |
312 | + super().setUp() |
313 | self.person = self.factory.makePerson() |
314 | self.person_specs_url = canonical_url( |
315 | self.person, rootsite='blueprints') |
316 | @@ -38,7 +38,7 @@ class TestSpecificationBreadcrumb(BaseBreadcrumbTestCase): |
317 | """Test breadcrumbs for an `ISpecification`.""" |
318 | |
319 | def setUp(self): |
320 | - super(TestSpecificationBreadcrumb, self).setUp() |
321 | + super().setUp() |
322 | self.product = self.factory.makeProduct( |
323 | name='crumb-tester', displayname="Crumb Tester") |
324 | self.specification = self.factory.makeSpecification( |
325 | diff --git a/lib/lp/blueprints/browser/tests/test_hasspecifications.py b/lib/lp/blueprints/browser/tests/test_hasspecifications.py |
326 | index 0823061..6046cae 100644 |
327 | --- a/lib/lp/blueprints/browser/tests/test_hasspecifications.py |
328 | +++ b/lib/lp/blueprints/browser/tests/test_hasspecifications.py |
329 | @@ -14,7 +14,7 @@ class TestPersonSpecWorkloadView(TestCaseWithFactory): |
330 | layer = DatabaseFunctionalLayer |
331 | |
332 | def setUp(self): |
333 | - super(TestPersonSpecWorkloadView, self).setUp() |
334 | + super().setUp() |
335 | self.owner = self.factory.makePerson(name='blue') |
336 | login_person(self.owner) |
337 | self.team = self.factory.makeTeam(name='square', owner='blue') |
338 | diff --git a/lib/lp/blueprints/browser/tests/test_person_upcomingwork.py b/lib/lp/blueprints/browser/tests/test_person_upcomingwork.py |
339 | index 9c7d459..e867699 100644 |
340 | --- a/lib/lp/blueprints/browser/tests/test_person_upcomingwork.py |
341 | +++ b/lib/lp/blueprints/browser/tests/test_person_upcomingwork.py |
342 | @@ -36,7 +36,7 @@ class Test_getWorkItemsDueBefore(TestCaseWithFactory): |
343 | layer = DatabaseFunctionalLayer |
344 | |
345 | def setUp(self): |
346 | - super(Test_getWorkItemsDueBefore, self).setUp() |
347 | + super().setUp() |
348 | self.today = datetime.today().date() |
349 | current_milestone = self.factory.makeMilestone( |
350 | dateexpected=self.today) |
351 | @@ -171,7 +171,7 @@ class TestGenericWorkItem(TestCaseWithFactory): |
352 | layer = DatabaseFunctionalLayer |
353 | |
354 | def setUp(self): |
355 | - super(TestGenericWorkItem, self).setUp() |
356 | + super().setUp() |
357 | today = datetime.today().date() |
358 | self.milestone = self.factory.makeMilestone(dateexpected=today) |
359 | |
360 | @@ -236,7 +236,7 @@ class TestPersonUpcomingWork(BrowserTestCase): |
361 | layer = DatabaseFunctionalLayer |
362 | |
363 | def setUp(self): |
364 | - super(TestPersonUpcomingWork, self).setUp() |
365 | + super().setUp() |
366 | self.today = datetime.today().date() |
367 | self.tomorrow = self.today + timedelta(days=1) |
368 | self.today_milestone = self.factory.makeMilestone( |
369 | @@ -413,7 +413,7 @@ class TestPersonUpcomingWorkView(TestCaseWithFactory): |
370 | layer = DatabaseFunctionalLayer |
371 | |
372 | def setUp(self): |
373 | - super(TestPersonUpcomingWorkView, self).setUp() |
374 | + super().setUp() |
375 | self.today = datetime.today().date() |
376 | self.tomorrow = self.today + timedelta(days=1) |
377 | self.today_milestone = self.factory.makeMilestone( |
378 | diff --git a/lib/lp/blueprints/browser/tests/test_specification.py b/lib/lp/blueprints/browser/tests/test_specification.py |
379 | index 192f0c2..655c5d1 100644 |
380 | --- a/lib/lp/blueprints/browser/tests/test_specification.py |
381 | +++ b/lib/lp/blueprints/browser/tests/test_specification.py |
382 | @@ -507,7 +507,7 @@ class TestNewSpecificationInformationType(BrowserTestCase): |
383 | layer = DatabaseFunctionalLayer |
384 | |
385 | def setUp(self): |
386 | - super(TestNewSpecificationInformationType, self).setUp() |
387 | + super().setUp() |
388 | it_field = soupmatchers.Tag( |
389 | 'it-field', True, attrs=dict(name='field.information_type')) |
390 | self.match_it = soupmatchers.HTMLContains(it_field) |
391 | diff --git a/lib/lp/blueprints/browser/tests/test_specificationtarget.py b/lib/lp/blueprints/browser/tests/test_specificationtarget.py |
392 | index 3364f1b..b992b69 100644 |
393 | --- a/lib/lp/blueprints/browser/tests/test_specificationtarget.py |
394 | +++ b/lib/lp/blueprints/browser/tests/test_specificationtarget.py |
395 | @@ -2,7 +2,6 @@ |
396 | # GNU Affero General Public License version 3 (see the file LICENSE). |
397 | |
398 | from fixtures import FakeLogger |
399 | -import six |
400 | from zope.component import getUtility |
401 | from zope.security.proxy import removeSecurityProxy |
402 | |
403 | @@ -127,7 +126,7 @@ class TestAssignments(TestCaseWithFactory): |
404 | layer = DatabaseFunctionalLayer |
405 | |
406 | def setUp(self): |
407 | - super(TestAssignments, self).setUp() |
408 | + super().setUp() |
409 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
410 | # printed to stdout while browsing pages. |
411 | self.useFixture(FakeLogger()) |
412 | @@ -151,7 +150,7 @@ class TestHasSpecificationsTemplates(TestCaseWithFactory): |
413 | layer = DatabaseFunctionalLayer |
414 | |
415 | def setUp(self): |
416 | - super(TestHasSpecificationsTemplates, self).setUp() |
417 | + super().setUp() |
418 | self.user = self.factory.makePerson() |
419 | login_person(self.user) |
420 | |
421 | @@ -249,7 +248,7 @@ class TestSpecificationsRobots(TestCaseWithFactory): |
422 | layer = DatabaseFunctionalLayer |
423 | |
424 | def setUp(self): |
425 | - super(TestSpecificationsRobots, self).setUp() |
426 | + super().setUp() |
427 | self.product = self.factory.makeProduct() |
428 | self.naked_product = removeSecurityProxy(self.product) |
429 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
430 | @@ -306,7 +305,7 @@ class SpecificationSetViewTestCase(TestCaseWithFactory): |
431 | target_widget = view.widgets['scope'].target_widget |
432 | self.assertIsNot( |
433 | None, content.find(True, id=target_widget.show_widget_id)) |
434 | - text = six.text_type(content) |
435 | + text = str(content) |
436 | picker_vocab = 'DistributionOrProductOrProjectGroup' |
437 | self.assertIn(picker_vocab, text) |
438 | focus_script = "setFocusByName('field.search_text')" |
439 | diff --git a/lib/lp/blueprints/browser/tests/test_views.py b/lib/lp/blueprints/browser/tests/test_views.py |
440 | index 35a2159..4d993f6 100644 |
441 | --- a/lib/lp/blueprints/browser/tests/test_views.py |
442 | +++ b/lib/lp/blueprints/browser/tests/test_views.py |
443 | @@ -33,7 +33,7 @@ class TestAssignments(TestCaseWithFactory): |
444 | layer = DatabaseFunctionalLayer |
445 | |
446 | def setUp(self): |
447 | - super(TestAssignments, self).setUp() |
448 | + super().setUp() |
449 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
450 | # printed to stdout while browsing pages. |
451 | self.useFixture(FakeLogger()) |
452 | diff --git a/lib/lp/blueprints/errors.py b/lib/lp/blueprints/errors.py |
453 | index 6b0a4d8..2a0cfbc 100644 |
454 | --- a/lib/lp/blueprints/errors.py |
455 | +++ b/lib/lp/blueprints/errors.py |
456 | @@ -19,4 +19,4 @@ class TargetAlreadyHasSpecification(Exception): |
457 | def __init__(self, target, name): |
458 | msg = "There is already a blueprint named %s for %s." % ( |
459 | name, target.displayname) |
460 | - super(TargetAlreadyHasSpecification, self).__init__(msg) |
461 | + super().__init__(msg) |
462 | diff --git a/lib/lp/blueprints/interfaces/specification.py b/lib/lp/blueprints/interfaces/specification.py |
463 | index 739ece3..2279cad 100644 |
464 | --- a/lib/lp/blueprints/interfaces/specification.py |
465 | +++ b/lib/lp/blueprints/interfaces/specification.py |
466 | @@ -761,8 +761,8 @@ class ISpecificationSet(IHasSpecifications): |
467 | @operation_parameters( |
468 | target=Reference( |
469 | schema=ISpecificationTarget, required=True, |
470 | - title=(u"The product or distribution context of this " |
471 | - u"specification."))) |
472 | + title=("The product or distribution context of this " |
473 | + "specification."))) |
474 | @export_factory_operation( |
475 | ISpecification, ['name', 'title', 'specurl', 'summary', |
476 | 'definition_status', 'assignee', 'drafter', |
477 | diff --git a/lib/lp/blueprints/interfaces/specificationmessage.py b/lib/lp/blueprints/interfaces/specificationmessage.py |
478 | index 84196d3..0148f5d 100644 |
479 | --- a/lib/lp/blueprints/interfaces/specificationmessage.py |
480 | +++ b/lib/lp/blueprints/interfaces/specificationmessage.py |
481 | @@ -20,9 +20,9 @@ class ISpecificationMessage(Interface): |
482 | """A link between a specification and a message.""" |
483 | |
484 | specification = Reference(schema=ISpecification, |
485 | - title=u"The specification.") |
486 | - message = Reference(schema=IMessage, title=u"The message.") |
487 | - visible = Bool(title=u"Is this message visible?", required=False, |
488 | + title="The specification.") |
489 | + message = Reference(schema=IMessage, title="The message.") |
490 | + visible = Bool(title="Is this message visible?", required=False, |
491 | default=True) |
492 | |
493 | |
494 | diff --git a/lib/lp/blueprints/model/specification.py b/lib/lp/blueprints/model/specification.py |
495 | index 8d2e21c..43f60fc 100644 |
496 | --- a/lib/lp/blueprints/model/specification.py |
497 | +++ b/lib/lp/blueprints/model/specification.py |
498 | @@ -14,7 +14,6 @@ import operator |
499 | |
500 | from lazr.lifecycle.event import ObjectCreatedEvent |
501 | from lazr.lifecycle.objectdelta import ObjectDelta |
502 | -import six |
503 | from storm.locals import ( |
504 | Count, |
505 | Desc, |
506 | @@ -801,7 +800,7 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin): |
507 | from lp.bugs.model.bug import Bug |
508 | bug_ids = [ |
509 | int(id) for _, id in getUtility(IXRefSet).findFrom( |
510 | - (u'specification', six.text_type(self.id)), types=[u'bug'])] |
511 | + ('specification', str(self.id)), types=['bug'])] |
512 | return list(sorted( |
513 | bulk.load(Bug, bug_ids), key=operator.attrgetter('id'))) |
514 | |
515 | @@ -811,14 +810,12 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin): |
516 | props = {} |
517 | # XXX: Should set creator. |
518 | getUtility(IXRefSet).create( |
519 | - {(u'specification', six.text_type(self.id)): |
520 | - {(u'bug', six.text_type(bug.id)): props}}) |
521 | + {('specification', str(self.id)): {('bug', str(bug.id)): props}}) |
522 | |
523 | def deleteBugLink(self, bug): |
524 | """See BugLinkTargetMixin.""" |
525 | getUtility(IXRefSet).delete( |
526 | - {(u'specification', six.text_type(self.id)): |
527 | - [(u'bug', six.text_type(bug.id))]}) |
528 | + {('specification', str(self.id)): [('bug', str(bug.id))]}) |
529 | |
530 | # sprint linking |
531 | def linkSprint(self, sprint, user): |
532 | diff --git a/lib/lp/blueprints/model/specificationbranch.py b/lib/lp/blueprints/model/specificationbranch.py |
533 | index 9248256..462f291 100644 |
534 | --- a/lib/lp/blueprints/model/specificationbranch.py |
535 | +++ b/lib/lp/blueprints/model/specificationbranch.py |
536 | @@ -47,7 +47,7 @@ class SpecificationBranch(StormBase): |
537 | registrant = Reference(registrant_id, 'Person.id') |
538 | |
539 | def __init__(self, specification, branch, registrant): |
540 | - super(SpecificationBranch, self).__init__() |
541 | + super().__init__() |
542 | self.specification = specification |
543 | self.branch = branch |
544 | self.registrant = registrant |
545 | diff --git a/lib/lp/blueprints/model/specificationsearch.py b/lib/lp/blueprints/model/specificationsearch.py |
546 | index a8404ff..10ddbb4 100644 |
547 | --- a/lib/lp/blueprints/model/specificationsearch.py |
548 | +++ b/lib/lp/blueprints/model/specificationsearch.py |
549 | @@ -13,7 +13,6 @@ __all__ = [ |
550 | from collections import defaultdict |
551 | from functools import reduce |
552 | |
553 | -import six |
554 | from storm.expr import ( |
555 | And, |
556 | Coalesce, |
557 | @@ -264,7 +263,7 @@ def get_specification_filters(filter, goalstatus=True): |
558 | SpecificationDefinitionStatus.SUPERSEDED]))) |
559 | # Filter for specification text. |
560 | for constraint in filter: |
561 | - if isinstance(constraint, six.string_types): |
562 | + if isinstance(constraint, str): |
563 | # A string in the filter is a text search filter. |
564 | clauses.append(fti_search(Specification, constraint)) |
565 | return clauses |
566 | diff --git a/lib/lp/blueprints/model/specificationsubscription.py b/lib/lp/blueprints/model/specificationsubscription.py |
567 | index f6244e3..98e18bf 100644 |
568 | --- a/lib/lp/blueprints/model/specificationsubscription.py |
569 | +++ b/lib/lp/blueprints/model/specificationsubscription.py |
570 | @@ -36,7 +36,7 @@ class SpecificationSubscription(StormBase): |
571 | essential = Bool(allow_none=False, default=False) |
572 | |
573 | def __init__(self, specification, person, essential=False): |
574 | - super(SpecificationSubscription, self).__init__() |
575 | + super().__init__() |
576 | self.specification = specification |
577 | self.person = person |
578 | self.essential = essential |
579 | diff --git a/lib/lp/blueprints/model/sprint.py b/lib/lp/blueprints/model/sprint.py |
580 | index 32607bb..ac002db 100644 |
581 | --- a/lib/lp/blueprints/model/sprint.py |
582 | +++ b/lib/lp/blueprints/model/sprint.py |
583 | @@ -98,7 +98,7 @@ class Sprint(StormBase, HasDriversMixin, HasSpecificationsMixin): |
584 | def __init__(self, owner, name, title, time_zone, time_starts, time_ends, |
585 | summary, address=None, driver=None, home_page=None, |
586 | mugshot=None, logo=None, icon=None, is_physical=True): |
587 | - super(Sprint, self).__init__() |
588 | + super().__init__() |
589 | self.owner = owner |
590 | self.name = name |
591 | self.title = title |
592 | diff --git a/lib/lp/blueprints/model/sprintspecification.py b/lib/lp/blueprints/model/sprintspecification.py |
593 | index 9e4c9d6..1493e86 100644 |
594 | --- a/lib/lp/blueprints/model/sprintspecification.py |
595 | +++ b/lib/lp/blueprints/model/sprintspecification.py |
596 | @@ -51,7 +51,7 @@ class SprintSpecification(StormBase): |
597 | date_decided = DateTime(tzinfo=pytz.UTC, allow_none=True, default=None) |
598 | |
599 | def __init__(self, sprint, specification, registrant): |
600 | - super(SprintSpecification, self).__init__() |
601 | + super().__init__() |
602 | self.sprint = sprint |
603 | self.specification = specification |
604 | self.registrant = registrant |
605 | diff --git a/lib/lp/blueprints/model/tests/test_specification.py b/lib/lp/blueprints/model/tests/test_specification.py |
606 | index e0b94bd..5de7970 100644 |
607 | --- a/lib/lp/blueprints/model/tests/test_specification.py |
608 | +++ b/lib/lp/blueprints/model/tests/test_specification.py |
609 | @@ -301,7 +301,7 @@ class TestSpecificationWorkItems(TestCaseWithFactory): |
610 | layer = DatabaseFunctionalLayer |
611 | |
612 | def setUp(self): |
613 | - super(TestSpecificationWorkItems, self).setUp() |
614 | + super().setUp() |
615 | self.wi_header = self.factory.makeMilestone( |
616 | name='none-milestone-as-header') |
617 | |
618 | diff --git a/lib/lp/blueprints/model/tests/test_sprint.py b/lib/lp/blueprints/model/tests/test_sprint.py |
619 | index 1a75d75..4e6b483 100644 |
620 | --- a/lib/lp/blueprints/model/tests/test_sprint.py |
621 | +++ b/lib/lp/blueprints/model/tests/test_sprint.py |
622 | @@ -35,7 +35,7 @@ class TestSpecifications(TestCaseWithFactory): |
623 | layer = DatabaseFunctionalLayer |
624 | |
625 | def setUp(self): |
626 | - super(TestSpecifications, self).setUp() |
627 | + super().setUp() |
628 | self.date_decided = datetime.datetime.now(utc) |
629 | |
630 | def makeSpec(self, sprint=None, date_decided=0, date_created=0, |
631 | diff --git a/lib/lp/blueprints/tests/test_specification.py b/lib/lp/blueprints/tests/test_specification.py |
632 | index 68198a6..9d26a6f 100644 |
633 | --- a/lib/lp/blueprints/tests/test_specification.py |
634 | +++ b/lib/lp/blueprints/tests/test_specification.py |
635 | @@ -558,7 +558,7 @@ class TestSpecificationSet(TestCaseWithFactory): |
636 | layer = DatabaseFunctionalLayer |
637 | |
638 | def setUp(self): |
639 | - super(TestSpecificationSet, self).setUp() |
640 | + super().setUp() |
641 | self.specification_set = getUtility(ISpecificationSet) |
642 | self.new_names = NewSpecificationDefinitionStatus.items.mapping.keys() |
643 | |
644 | @@ -600,7 +600,7 @@ class TestSpecifications(TestCaseWithFactory): |
645 | layer = DatabaseFunctionalLayer |
646 | |
647 | def setUp(self): |
648 | - super(TestSpecifications, self).setUp() |
649 | + super().setUp() |
650 | self.date_created = datetime.now(pytz.utc) |
651 | |
652 | def makeSpec(self, product=None, date_created=0, title=None, |
653 | diff --git a/lib/lp/blueprints/tests/test_webservice.py b/lib/lp/blueprints/tests/test_webservice.py |
654 | index b0b7582..417f552 100644 |
655 | --- a/lib/lp/blueprints/tests/test_webservice.py |
656 | +++ b/lib/lp/blueprints/tests/test_webservice.py |
657 | @@ -591,7 +591,7 @@ class TestSpecificationGoalHandling(TestCaseWithFactory): |
658 | layer = DatabaseFunctionalLayer |
659 | |
660 | def setUp(self): |
661 | - super(TestSpecificationGoalHandling, self).setUp() |
662 | + super().setUp() |
663 | self.driver = self.factory.makePerson() |
664 | self.proposer = self.factory.makePerson() |
665 | self.product = self.factory.makeProduct(driver=self.driver) |
Self-approving (mechanical).