Merge lp:~cjwatson/launchpad/no-xrange into lp:launchpad
- no-xrange
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18549 |
Proposed branch: | lp:~cjwatson/launchpad/no-xrange |
Merge into: | lp:launchpad |
Prerequisite: | lp:~cjwatson/launchpad/range-iterator |
Diff against target: |
1524 lines (+161/-162) 59 files modified
lib/lp/archivepublisher/tests/test_dominator.py (+8/-8) lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+3/-3) lib/lp/bugs/browser/tests/test_bugcomment.py (+4/-4) lib/lp/bugs/model/tests/test_bug.py (+6/-6) lib/lp/bugs/scripts/checkwatches/core.py (+2/-2) lib/lp/bugs/scripts/tests/test_bugnotification.py (+2/-2) lib/lp/bugs/tests/test_bugnotification.py (+2/-2) lib/lp/buildmaster/browser/tests/test_builder_views.py (+2/-2) lib/lp/code/browser/tests/test_branchmergeproposallisting.py (+3/-3) lib/lp/code/doc/branch-notifications.txt (+2/-2) lib/lp/code/model/tests/test_revisioncache.py (+2/-2) lib/lp/hardwaredb/scripts/hwdbsubmissions.py (+2/-2) lib/lp/registry/browser/tests/test_commercialsubscription.py (+2/-2) lib/lp/registry/browser/tests/test_distroseries.py (+3/-3) lib/lp/registry/browser/tests/test_person_contact.py (+2/-2) lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py (+3/-3) lib/lp/registry/tests/test_distroseriesdifference.py (+5/-5) lib/lp/registry/tests/test_distroseriesdifferencecomment.py (+2/-2) lib/lp/registry/tests/test_milestone.py (+2/-2) lib/lp/registry/tests/test_milestonetag.py (+3/-3) lib/lp/registry/tests/test_notification.py (+3/-3) lib/lp/registry/tests/test_teammembership.py (+2/-2) lib/lp/scripts/tests/test_garbo.py (+2/-2) lib/lp/services/doc/orderingcheck.txt (+1/-1) lib/lp/services/helpers.py (+3/-3) lib/lp/services/log/logger.py (+2/-2) lib/lp/services/tests/test_command_spawner.py (+2/-2) lib/lp/services/tests/test_helpers.py (+3/-3) lib/lp/services/webapp/tests/test_error.py (+2/-2) lib/lp/soyuz/adapters/tests/test_overrides.py (+6/-6) lib/lp/soyuz/scripts/tests/test_copypackage.py (+2/-2) lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py (+4/-4) lib/lp/soyuz/tests/test_binarypackagebuild.py (+2/-2) lib/lp/soyuz/tests/test_distroseriesdifferencejob.py (+2/-2) lib/lp/soyuz/tests/test_packagecopyjob.py (+5/-5) lib/lp/soyuz/tests/test_packageset.py (+2/-2) lib/lp/testing/factory.py (+2/-2) lib/lp/testing/fixture.py (+2/-2) lib/lp/testing/tests/test_fakemethod.py (+2/-2) lib/lp/translations/browser/tests/test_persontranslationview.py (+2/-2) lib/lp/translations/browser/tests/test_translationimportqueueentry.py (+2/-2) lib/lp/translations/browser/tests/test_translationmessage_view.py (+2/-2) lib/lp/translations/browser/translationmessage.py (+1/-1) lib/lp/translations/model/pofile.py (+5/-5) lib/lp/translations/model/potmsgset.py (+2/-2) lib/lp/translations/model/translationmessage.py (+6/-6) lib/lp/translations/scripts/fix_plural_forms.py (+2/-2) lib/lp/translations/stories/standalone/xx-translations-to-review.txt (+1/-1) lib/lp/translations/tests/test_autoapproval.py (+5/-5) lib/lp/translations/tests/test_potmsgset.py (+2/-2) lib/lp/translations/tests/test_translationimportqueue.py (+2/-2) lib/lp/translations/tests/test_translationmessage.py (+2/-2) lib/lp/translations/tests/test_translationpolicy.py (+2/-3) lib/lp/translations/tests/test_translationtemplatesbuild.py (+2/-2) lib/lp/translations/utilities/gettext_po_parser.py (+2/-2) lib/lp/translations/utilities/kde_po_exporter.py (+2/-2) lib/lp/translations/utilities/pluralforms.py (+2/-2) lib/lp/translations/utilities/translation_import.py (+6/-6) lib/lp/translations/utilities/translationmerger.py (+2/-2) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/no-xrange |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+337044@code.launchpad.net |
Commit message
Replace xrange with range, since xrange doesn't exist in Python 3.
Description of the change
Long, but doesn't really seem worth splitting up as it's almost all just s/xrange/range/g. The only complication is that there are a couple of places that really do want an iterator rather than a list, and range returns a list in Python 2, so in those cases I went for iter(range(...)) which works in both versions of the language.
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) : | # |
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/archivepublisher/tests/test_dominator.py' |
2 | --- lib/lp/archivepublisher/tests/test_dominator.py 2014-10-31 10:34:51 +0000 |
3 | +++ lib/lp/archivepublisher/tests/test_dominator.py 2018-02-02 10:39:33 +0000 |
4 | @@ -1,4 +1,4 @@ |
5 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
6 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
7 | # GNU Affero General Public License version 3 (see the file LICENSE). |
8 | |
9 | """Tests for domination.py.""" |
10 | @@ -526,7 +526,7 @@ |
11 | self.factory.makeSourcePackagePublishingHistory( |
12 | sourcepackagerelease=spr, distroseries=distroseries, |
13 | pocket=pocket) |
14 | - for counter in xrange(len(ages))] |
15 | + for counter in range(len(ages))] |
16 | alter_creation_dates(spphs, ages) |
17 | |
18 | self.assertEqual( |
19 | @@ -550,7 +550,7 @@ |
20 | distroseries=distroseries, pocket=pocket, |
21 | sourcepackagerelease=self.factory.makeSourcePackageRelease( |
22 | version=version)) |
23 | - for counter in xrange(len(ages))] |
24 | + for counter in range(len(ages))] |
25 | alter_creation_dates(spphs, ages) |
26 | |
27 | self.assertEqual( |
28 | @@ -666,7 +666,7 @@ |
29 | archive=series.main_archive, distroseries=series, |
30 | pocket=pocket, status=PackagePublishingStatus.PUBLISHED, |
31 | sourcepackagerelease=spr) |
32 | - for counter in xrange(3)] |
33 | + for counter in range(3)] |
34 | alter_creation_dates(pubs, [ |
35 | datetime.timedelta(3), |
36 | datetime.timedelta(2), |
37 | @@ -688,7 +688,7 @@ |
38 | def test_dominatePackage_is_efficient(self): |
39 | # dominatePackage avoids issuing too many queries. |
40 | generalization = GeneralizedPublication(True) |
41 | - versions = ["1.%s" % revision for revision in xrange(5)] |
42 | + versions = ["1.%s" % revision for revision in range(5)] |
43 | pubs = make_spphs_for_versions(self.factory, versions) |
44 | with StormStatementRecorder() as recorder: |
45 | self.makeDominator(pubs).dominatePackage( |
46 | @@ -709,7 +709,7 @@ |
47 | package = self.factory.makeSourcePackageName() |
48 | pocket = PackagePublishingPocket.RELEASE |
49 | |
50 | - versions = ["1.%d" % number for number in xrange(4)] |
51 | + versions = ["1.%d" % number for number in range(4)] |
52 | |
53 | # We have one package releases for each version. |
54 | relevant_releases = dict( |
55 | @@ -737,7 +737,7 @@ |
56 | for version in jumble(versions)) |
57 | |
58 | ages = jumble( |
59 | - [datetime.timedelta(age) for age in xrange(len(versions))]) |
60 | + [datetime.timedelta(age) for age in range(len(versions))]) |
61 | |
62 | # Actually the "oldest to newest" order on the publications only |
63 | # applies to their creation dates. Their creation orders are |
64 | @@ -887,7 +887,7 @@ |
65 | self.factory.makeSourcePackagePublishingHistory( |
66 | distroseries=series, sourcepackagerelease=spr, pocket=pocket, |
67 | status=PackagePublishingStatus.PUBLISHED) |
68 | - for counter in xrange(2)] |
69 | + for counter in range(2)] |
70 | dominator = self.makeDominator(spphs) |
71 | self.assertContentEqual( |
72 | [(spr.sourcepackagename.name, len(spphs))], |
73 | |
74 | === modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py' |
75 | --- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2016-12-05 22:16:25 +0000 |
76 | +++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2018-02-02 10:39:33 +0000 |
77 | @@ -1,4 +1,4 @@ |
78 | -# Copyright 2011-2016 Canonical Ltd. This software is licensed under the |
79 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
80 | # GNU Affero General Public License version 3 (see the file LICENSE). |
81 | |
82 | """Test publish-ftpmaster cron script.""" |
83 | @@ -441,7 +441,7 @@ |
84 | self.factory.makeSourcePackagePublishingHistory( |
85 | distroseries=self.factory.makeDistroSeries( |
86 | distribution=distro)) |
87 | - for counter in xrange(2)] |
88 | + for counter in range(2)] |
89 | |
90 | script = self.makeScript(distro) |
91 | script.setUp() |
92 | @@ -472,7 +472,7 @@ |
93 | distroseries=self.factory.makeDistroSeries( |
94 | distribution=distro), |
95 | pocket=PackagePublishingPocket.SECURITY) |
96 | - for counter in xrange(2)] |
97 | + for counter in range(2)] |
98 | |
99 | script = self.makeScript(distro) |
100 | script.setUp() |
101 | |
102 | === modified file 'lib/lp/bugs/browser/tests/test_bugcomment.py' |
103 | --- lib/lp/bugs/browser/tests/test_bugcomment.py 2015-09-14 13:11:30 +0000 |
104 | +++ lib/lp/bugs/browser/tests/test_bugcomment.py 2018-02-02 10:39:33 +0000 |
105 | @@ -1,4 +1,4 @@ |
106 | -# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
107 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
108 | # GNU Affero General Public License version 3 (see the file LICENSE). |
109 | |
110 | """Tests for the bugcomment module.""" |
111 | @@ -108,7 +108,7 @@ |
112 | # have any common actors, no grouping is possible. |
113 | comments = [ |
114 | BugCommentStub(*next(self.time_index)) |
115 | - for number in xrange(5)] |
116 | + for number in range(5)] |
117 | self.assertEqual( |
118 | comments, self.group(comments=comments, activities=[])) |
119 | |
120 | @@ -117,7 +117,7 @@ |
121 | # have any common actors, no grouping is possible. |
122 | activities = [ |
123 | BugActivityStub(next(self.time_index)[0]) |
124 | - for number in xrange(5)] |
125 | + for number in range(5)] |
126 | self.assertEqual( |
127 | [[activity] for activity in activities], self.group( |
128 | comments=[], activities=activities)) |
129 | @@ -175,7 +175,7 @@ |
130 | actor = PersonStub() |
131 | activities = [ |
132 | BugActivityStub(next(self.time_index)[0], owner=actor) |
133 | - for count in xrange(8)] |
134 | + for count in range(8)] |
135 | grouped = self.group(comments=[], activities=activities) |
136 | self.assertEqual(2, len(grouped)) |
137 | self.assertEqual(activities[:5], grouped[0]) |
138 | |
139 | === modified file 'lib/lp/bugs/model/tests/test_bug.py' |
140 | --- lib/lp/bugs/model/tests/test_bug.py 2016-06-24 23:35:24 +0000 |
141 | +++ lib/lp/bugs/model/tests/test_bug.py 2018-02-02 10:39:33 +0000 |
142 | @@ -1,4 +1,4 @@ |
143 | -# Copyright 2010-2016 Canonical Ltd. This software is licensed under the |
144 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
145 | # GNU Affero General Public License version 3 (see the file LICENSE). |
146 | |
147 | __metaclass__ = type |
148 | @@ -202,7 +202,7 @@ |
149 | def test_get_direct_subscribers_query_count(self): |
150 | bug = self.factory.makeBug() |
151 | # Make lots of subscribers. |
152 | - for i in xrange(10): |
153 | + for i in range(10): |
154 | subscriber = self.factory.makePerson() |
155 | with person_logged_in(subscriber): |
156 | bug.subscribe(subscriber, subscriber) |
157 | @@ -216,10 +216,10 @@ |
158 | bug = self.factory.makeBug() |
159 | # Make lots of duplicate bugs. |
160 | previous_dup = None |
161 | - for i in xrange(10): |
162 | + for i in range(10): |
163 | dup = self.factory.makeBug() |
164 | # Make lots of subscribers. |
165 | - for j in xrange(10): |
166 | + for j in range(10): |
167 | subscriber = self.factory.makePerson() |
168 | with person_logged_in(subscriber): |
169 | dup.subscribe(subscriber, subscriber) |
170 | @@ -246,7 +246,7 @@ |
171 | return self._get_notifications(BugNotificationStatus.DEFERRED) |
172 | |
173 | def _add_subscribers(self, bug, number): |
174 | - for i in xrange(number): |
175 | + for i in range(number): |
176 | subscriber = self.factory.makePerson() |
177 | with person_logged_in(subscriber): |
178 | bug.subscribe(subscriber, subscriber) |
179 | @@ -259,7 +259,7 @@ |
180 | self.store = Store.of(bug) |
181 | duplicates = [] |
182 | # Make a few duplicate bugs. |
183 | - for i in xrange(3): |
184 | + for i in range(3): |
185 | duplicates.append(self.factory.makeBug(title="bug-%d" % (i + 1))) |
186 | |
187 | # Pending messages exist for the bug creation. |
188 | |
189 | === modified file 'lib/lp/bugs/scripts/checkwatches/core.py' |
190 | --- lib/lp/bugs/scripts/checkwatches/core.py 2015-10-15 14:09:50 +0000 |
191 | +++ lib/lp/bugs/scripts/checkwatches/core.py 2018-02-02 10:39:33 +0000 |
192 | @@ -1,4 +1,4 @@ |
193 | -# Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
194 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
195 | # GNU Affero General Public License version 3 (see the file LICENSE). |
196 | |
197 | """Classes and logic for the checkwatches cronscript.""" |
198 | @@ -529,7 +529,7 @@ |
199 | # run out of bugs to ask about or we have batch_size |
200 | # bugs to check. |
201 | remote_old_ids_to_check = [] |
202 | - for index in xrange(0, len(remote_old_ids), batch_size): |
203 | + for index in range(0, len(remote_old_ids), batch_size): |
204 | remote_old_ids_to_check.extend( |
205 | remotesystem.getModifiedRemoteBugs( |
206 | remote_old_ids[index:index + batch_size], |
207 | |
208 | === modified file 'lib/lp/bugs/scripts/tests/test_bugnotification.py' |
209 | --- lib/lp/bugs/scripts/tests/test_bugnotification.py 2018-01-02 16:10:26 +0000 |
210 | +++ lib/lp/bugs/scripts/tests/test_bugnotification.py 2018-02-02 10:39:33 +0000 |
211 | @@ -1,4 +1,4 @@ |
212 | -# Copyright 2009-2015 Canonical Ltd. This software is licensed under the |
213 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
214 | # GNU Affero General Public License version 3 (see the file LICENSE). |
215 | """Tests for construction bug notification emails for sending.""" |
216 | |
217 | @@ -1305,7 +1305,7 @@ |
218 | # Create some deferred notifications and show that processing them |
219 | # puts then in the state where they are ready to send. |
220 | num = 5 |
221 | - for i in xrange(num): |
222 | + for i in range(num): |
223 | self._make_deferred_notification() |
224 | deferred = self.notification_set.getDeferredNotifications() |
225 | self.assertEqual(num, deferred.count()) |
226 | |
227 | === modified file 'lib/lp/bugs/tests/test_bugnotification.py' |
228 | --- lib/lp/bugs/tests/test_bugnotification.py 2012-09-07 02:00:31 +0000 |
229 | +++ lib/lp/bugs/tests/test_bugnotification.py 2018-02-02 10:39:33 +0000 |
230 | @@ -1,4 +1,4 @@ |
231 | -# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
232 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
233 | # GNU Affero General Public License version 3 (see the file LICENSE). |
234 | |
235 | """Tests related to bug notifications.""" |
236 | @@ -499,7 +499,7 @@ |
237 | |
238 | def test_many_deferred_notification(self): |
239 | num = 5 |
240 | - for i in xrange(num): |
241 | + for i in range(num): |
242 | self._make_deferred_notification() |
243 | results = self.bns.getDeferredNotifications() |
244 | self.assertEqual(num, results.count()) |
245 | |
246 | === modified file 'lib/lp/buildmaster/browser/tests/test_builder_views.py' |
247 | --- lib/lp/buildmaster/browser/tests/test_builder_views.py 2015-10-21 09:37:08 +0000 |
248 | +++ lib/lp/buildmaster/browser/tests/test_builder_views.py 2018-02-02 10:39:33 +0000 |
249 | @@ -1,4 +1,4 @@ |
250 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
251 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
252 | # GNU Affero General Public License version 3 (see the file LICENSE). |
253 | |
254 | __metaclass__ = type |
255 | @@ -56,7 +56,7 @@ |
256 | |
257 | def createBuilds(self): |
258 | builds = [] |
259 | - for i in xrange(2): |
260 | + for i in range(2): |
261 | builds.append(self.createBinaryPackageBuild()) |
262 | builds.append(self.createTranslationTemplateBuild()) |
263 | builds.append(self.createSourcePackageRecipeBuild()) |
264 | |
265 | === modified file 'lib/lp/code/browser/tests/test_branchmergeproposallisting.py' |
266 | --- lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2017-10-04 01:16:22 +0000 |
267 | +++ lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2018-02-02 10:39:33 +0000 |
268 | @@ -1,4 +1,4 @@ |
269 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
270 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
271 | # GNU Affero General Public License version 3 (see the file LICENSE). |
272 | |
273 | """Unit tests for BranchMergeProposal listing views.""" |
274 | @@ -915,7 +915,7 @@ |
275 | # view and a recorder of the queries generated by this page |
276 | # rendering. |
277 | user = self.factory.makePerson() |
278 | - for i in xrange(number_of_bmps): |
279 | + for i in range(number_of_bmps): |
280 | # Create one of the two types of BMP which will be displayed |
281 | # on a person's +activereviews page: |
282 | # - A BMP for which the person is the reviewer. |
283 | @@ -956,7 +956,7 @@ |
284 | # view and a recorder of the queries generated by this page |
285 | # rendering. |
286 | product = self.factory.makeProduct() |
287 | - for i in xrange(number_of_bmps): |
288 | + for i in range(number_of_bmps): |
289 | self.createProductBMP(product=product) |
290 | login_person(product.owner) |
291 | flush_database_caches() |
292 | |
293 | === modified file 'lib/lp/code/doc/branch-notifications.txt' |
294 | --- lib/lp/code/doc/branch-notifications.txt 2016-01-26 15:47:37 +0000 |
295 | +++ lib/lp/code/doc/branch-notifications.txt 2018-02-02 10:39:33 +0000 |
296 | @@ -209,7 +209,7 @@ |
297 | |
298 | We need to create some sufficiently large diffs to compare against. |
299 | |
300 | - >>> diff = '\n'.join([str(value) for value in xrange(6000)]) |
301 | + >>> diff = '\n'.join([str(value) for value in range(6000)]) |
302 | >>> message = 'Test message.\n' |
303 | |
304 | Send the revision notifications. |
305 | @@ -287,7 +287,7 @@ |
306 | |
307 | And just to be sure, lets create one with 800 lines. |
308 | |
309 | - >>> diff = '\n'.join([str(value) for value in xrange(800)]) |
310 | + >>> diff = '\n'.join([str(value) for value in range(800)]) |
311 | >>> BranchMailer.forRevision( |
312 | ... branch, 'no-reply@canonical.com', message, diff, |
313 | ... None, revno=1234).sendAll() |
314 | |
315 | === modified file 'lib/lp/code/model/tests/test_revisioncache.py' |
316 | --- lib/lp/code/model/tests/test_revisioncache.py 2017-10-04 01:53:48 +0000 |
317 | +++ lib/lp/code/model/tests/test_revisioncache.py 2018-02-02 10:39:33 +0000 |
318 | @@ -1,4 +1,4 @@ |
319 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
320 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
321 | # GNU Affero General Public License version 3 (see the file LICENSE). |
322 | |
323 | """Tests relating to the revision cache.""" |
324 | @@ -357,7 +357,7 @@ |
325 | # If there are multiple revisions with the same revision author text, |
326 | # but not linked to a Launchpad person, then that revision_text is |
327 | # counted as one author. |
328 | - for counter in xrange(4): |
329 | + for counter in range(4): |
330 | self.makeCachedRevision(revision=self.factory.makeRevision( |
331 | author="Foo <foo@example.com>")) |
332 | revision_cache = getUtility(IRevisionCache) |
333 | |
334 | === modified file 'lib/lp/hardwaredb/scripts/hwdbsubmissions.py' |
335 | --- lib/lp/hardwaredb/scripts/hwdbsubmissions.py 2015-09-28 17:38:45 +0000 |
336 | +++ lib/lp/hardwaredb/scripts/hwdbsubmissions.py 2018-02-02 10:39:33 +0000 |
337 | @@ -1,4 +1,4 @@ |
338 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
339 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
340 | # GNU Affero General Public License version 3 (see the file LICENSE). |
341 | |
342 | """Parse Hardware Database submissions. |
343 | @@ -1103,7 +1103,7 @@ |
344 | """ |
345 | udi_device_map = {} |
346 | duplicates = [] |
347 | - for index in xrange(len(devices)): |
348 | + for index in range(len(devices)): |
349 | device = devices[index] |
350 | udi = device['udi'] |
351 | if udi in udi_device_map: |
352 | |
353 | === modified file 'lib/lp/registry/browser/tests/test_commercialsubscription.py' |
354 | --- lib/lp/registry/browser/tests/test_commercialsubscription.py 2012-12-07 15:48:29 +0000 |
355 | +++ lib/lp/registry/browser/tests/test_commercialsubscription.py 2018-02-02 10:39:33 +0000 |
356 | @@ -1,4 +1,4 @@ |
357 | -# Copyright 2012 Canonical Ltd. This software is licensed under the |
358 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
359 | # GNU Affero General Public License version 3 (see the file LICENSE). |
360 | |
361 | """Test views that manage commercial subscriptions.""" |
362 | @@ -31,7 +31,7 @@ |
363 | voucher_proxy = TestSalesforceVoucherProxy() |
364 | self.registerUtility(voucher_proxy, ISalesforceVoucherProxy) |
365 | vouchers = [] |
366 | - for n in xrange(number): |
367 | + for n in range(number): |
368 | vouchers.append(voucher_proxy.grantVoucher(user, user, user, 12)) |
369 | return vouchers |
370 | |
371 | |
372 | === modified file 'lib/lp/registry/browser/tests/test_distroseries.py' |
373 | --- lib/lp/registry/browser/tests/test_distroseries.py 2018-01-02 16:10:26 +0000 |
374 | +++ lib/lp/registry/browser/tests/test_distroseries.py 2018-02-02 10:39:33 +0000 |
375 | @@ -1,4 +1,4 @@ |
376 | -# Copyright 2011-2013 Canonical Ltd. This software is licensed under the |
377 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
378 | # GNU Affero General Public License version 3 (see the file LICENSE). |
379 | |
380 | """Tests for `lp.registry.browser.distroseries`.""" |
381 | @@ -913,7 +913,7 @@ |
382 | login_person(self.simple_user) |
383 | |
384 | def add_differences(num): |
385 | - for index in xrange(num): |
386 | + for index in range(num): |
387 | version = self.factory.getUniqueInteger() |
388 | versions = { |
389 | 'base': u'1.%d' % version, |
390 | @@ -1514,7 +1514,7 @@ |
391 | self.assertThat(recorder1, HasQueryCount(LessThan(12))) |
392 | |
393 | # The query count does not increase with the number of upgrades. |
394 | - for index in xrange(3): |
395 | + for index in range(3): |
396 | self.makePackageUpgrade(derived_series=derived_series) |
397 | flush_database_caches() |
398 | with StormStatementRecorder() as recorder2: |
399 | |
400 | === modified file 'lib/lp/registry/browser/tests/test_person_contact.py' |
401 | --- lib/lp/registry/browser/tests/test_person_contact.py 2012-11-29 16:17:01 +0000 |
402 | +++ lib/lp/registry/browser/tests/test_person_contact.py 2018-02-02 10:39:33 +0000 |
403 | @@ -1,4 +1,4 @@ |
404 | -# Copyright 2012 Canonical Ltd. This software is licensed under the |
405 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
406 | # GNU Affero General Public License version 3 (see the file LICENSE). |
407 | """Test views and helpers related to the contact person feature.""" |
408 | |
409 | @@ -256,7 +256,7 @@ |
410 | sender = self.factory.makePerson(email='me@eg.dom') |
411 | old_message = self.factory.makeSignedMessage(email_address='me@eg.dom') |
412 | authorization = IDirectEmailAuthorization(sender) |
413 | - for action in xrange(authorization.message_quota): |
414 | + for action in range(authorization.message_quota): |
415 | authorization.record(old_message) |
416 | return sender |
417 | |
418 | |
419 | === modified file 'lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py' |
420 | --- lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py 2018-02-02 10:39:33 +0000 |
421 | +++ lib/lp/registry/scripts/tests/test_populate_distroseriesdiff.py 2018-02-02 10:39:33 +0000 |
422 | @@ -186,7 +186,7 @@ |
423 | spr = self.factory.makeSourcePackageRelease(distroseries=distroseries) |
424 | spphs = [ |
425 | self.makeSPPH(distroseries=distroseries, sourcepackagerelease=spr) |
426 | - for counter in xrange(5)] |
427 | + for counter in range(5)] |
428 | query = compose_sql_find_latest_source_package_releases(distroseries) |
429 | self.assertContentEqual( |
430 | [self.getExpectedResultFor(spphs[-1])], |
431 | @@ -198,7 +198,7 @@ |
432 | sprs = [ |
433 | self.factory.makeSourcePackageRelease( |
434 | sourcepackagename=spn, distroseries=distroseries) |
435 | - for counter in xrange(5)] |
436 | + for counter in range(5)] |
437 | spphs = [ |
438 | self.makeSPPH(distroseries=distroseries, sourcepackagerelease=spr) |
439 | for spr in reversed(sprs)] |
440 | @@ -568,7 +568,7 @@ |
441 | |
442 | def test_finds_all_distroseries(self): |
443 | spphs = [] |
444 | - for counter in xrange(2): |
445 | + for counter in range(2): |
446 | dsp = self.makeDerivedDistroSeries() |
447 | spphs.append(self.makeSPPH(dsp.derived_series)) |
448 | script = self.makeScript(['--all']) |
449 | |
450 | === modified file 'lib/lp/registry/tests/test_distroseriesdifference.py' |
451 | --- lib/lp/registry/tests/test_distroseriesdifference.py 2018-01-02 16:10:26 +0000 |
452 | +++ lib/lp/registry/tests/test_distroseriesdifference.py 2018-02-02 10:39:33 +0000 |
453 | @@ -1,4 +1,4 @@ |
454 | -# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
455 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
456 | # GNU Affero General Public License version 3 (see the file LICENSE). |
457 | |
458 | """Model tests for the DistroSeriesDifference class.""" |
459 | @@ -1133,7 +1133,7 @@ |
460 | names = [ |
461 | self.factory.makeDistroSeriesDifference( |
462 | series).source_package_name.name |
463 | - for counter in xrange(10)] |
464 | + for counter in range(10)] |
465 | |
466 | results = getUtility( |
467 | IDistroSeriesDifferenceSource).getForDistroSeries(series) |
468 | @@ -1147,7 +1147,7 @@ |
469 | derived_series = self.factory.makeDistroSeries() |
470 | dsps = [ |
471 | self.factory.makeDistroSeriesParent(derived_series=derived_series) |
472 | - for counter in xrange(2)] |
473 | + for counter in range(2)] |
474 | dsds = [ |
475 | self.factory.makeDistroSeriesDifference( |
476 | parent_series=dsp.parent_series, |
477 | @@ -1174,7 +1174,7 @@ |
478 | dsd = self.factory.makeDistroSeriesDifference() |
479 | packagesets = [ |
480 | self.factory.makePackageset(distroseries=dsd.derived_series) |
481 | - for counter in xrange(2)] |
482 | + for counter in range(2)] |
483 | Store.of(dsd).add(PackagesetSources( |
484 | packageset=packagesets[0], |
485 | sourcepackagename=dsd.source_package_name)) |
486 | @@ -1308,7 +1308,7 @@ |
487 | dsp = self.factory.makeDistroSeriesParent() |
488 | dsds = set( |
489 | self.factory.makeDistroSeriesDifference( |
490 | - derived_series=dsp.derived_series) for index in xrange(5)) |
491 | + derived_series=dsp.derived_series) for index in range(5)) |
492 | expected_comments = set() |
493 | for dsd in dsds: |
494 | # Add a couple of comments. |
495 | |
496 | === modified file 'lib/lp/registry/tests/test_distroseriesdifferencecomment.py' |
497 | --- lib/lp/registry/tests/test_distroseriesdifferencecomment.py 2012-12-26 01:32:19 +0000 |
498 | +++ lib/lp/registry/tests/test_distroseriesdifferencecomment.py 2018-02-02 10:39:33 +0000 |
499 | @@ -1,4 +1,4 @@ |
500 | -# Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
501 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
502 | # GNU Affero General Public License version 3 (see the file LICENSE). |
503 | |
504 | """Model tests for the DistroSeriesDifferenceComment class.""" |
505 | @@ -151,7 +151,7 @@ |
506 | series = self.factory.makeDistroSeries() |
507 | dsds = randomize_list([ |
508 | self.factory.makeDistroSeriesDifference(derived_series=series) |
509 | - for counter in xrange(5)]) |
510 | + for counter in range(5)]) |
511 | comments = [ |
512 | self.factory.makeDistroSeriesDifferenceComment(dsd) |
513 | for dsd in dsds] |
514 | |
515 | === modified file 'lib/lp/registry/tests/test_milestone.py' |
516 | --- lib/lp/registry/tests/test_milestone.py 2015-01-29 14:14:01 +0000 |
517 | +++ lib/lp/registry/tests/test_milestone.py 2018-02-02 10:39:33 +0000 |
518 | @@ -1,4 +1,4 @@ |
519 | -# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
520 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
521 | # GNU Affero General Public License version 3 (see the file LICENSE). |
522 | |
523 | """Milestone related test helper.""" |
524 | @@ -469,7 +469,7 @@ |
525 | def _create_items(self, num, factory, **kwargs): |
526 | items = [] |
527 | with person_logged_in(self.owner): |
528 | - for n in xrange(num): |
529 | + for n in range(num): |
530 | items.append(factory(**kwargs)) |
531 | return items |
532 | |
533 | |
534 | === modified file 'lib/lp/registry/tests/test_milestonetag.py' |
535 | --- lib/lp/registry/tests/test_milestonetag.py 2018-01-02 16:10:26 +0000 |
536 | +++ lib/lp/registry/tests/test_milestonetag.py 2018-02-02 10:39:33 +0000 |
537 | @@ -1,4 +1,4 @@ |
538 | -# Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
539 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
540 | # GNU Affero General Public License version 3 (see the file LICENSE). |
541 | |
542 | """Milestone related test helper.""" |
543 | @@ -113,7 +113,7 @@ |
544 | def _create_bugtasks(self, num, milestone=None): |
545 | bugtasks = [] |
546 | with person_logged_in(self.owner): |
547 | - for n in xrange(num): |
548 | + for n in range(num): |
549 | bugtask = self.factory.makeBugTask( |
550 | target=self.product, |
551 | owner=self.owner) |
552 | @@ -125,7 +125,7 @@ |
553 | def _create_specifications(self, num, milestone=None): |
554 | specifications = [] |
555 | with person_logged_in(self.owner): |
556 | - for n in xrange(num): |
557 | + for n in range(num): |
558 | specification = self.factory.makeSpecification( |
559 | product=self.product, |
560 | owner=self.owner, |
561 | |
562 | === modified file 'lib/lp/registry/tests/test_notification.py' |
563 | --- lib/lp/registry/tests/test_notification.py 2015-09-11 12:20:23 +0000 |
564 | +++ lib/lp/registry/tests/test_notification.py 2018-02-02 10:39:33 +0000 |
565 | @@ -1,4 +1,4 @@ |
566 | -# Copyright 2012-2015 Canonical Ltd. This software is licensed under the |
567 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
568 | # GNU Affero General Public License version 3 (see the file LICENSE). |
569 | |
570 | """Test notification classes and functions.""" |
571 | @@ -59,7 +59,7 @@ |
572 | recipients_set = NotificationRecipientSet() |
573 | old_message = self.factory.makeSignedMessage(email_address='me@eg.dom') |
574 | authorization = IDirectEmailAuthorization(user) |
575 | - for action in xrange(authorization.message_quota): |
576 | + for action in range(authorization.message_quota): |
577 | authorization.record(old_message) |
578 | self.assertRaises( |
579 | QuotaReachedError, send_direct_contact_email, |
580 | @@ -73,7 +73,7 @@ |
581 | recipients_set = NotificationRecipientSet() |
582 | old_message = self.factory.makeSignedMessage(email_address='me@eg.dom') |
583 | authorization = IDirectEmailAuthorization(user) |
584 | - for action in xrange(authorization.message_quota - 1): |
585 | + for action in range(authorization.message_quota - 1): |
586 | authorization.record(old_message) |
587 | pop_notifications() |
588 | send_direct_contact_email( |
589 | |
590 | === modified file 'lib/lp/registry/tests/test_teammembership.py' |
591 | --- lib/lp/registry/tests/test_teammembership.py 2018-01-02 16:10:26 +0000 |
592 | +++ lib/lp/registry/tests/test_teammembership.py 2018-02-02 10:39:33 +0000 |
593 | @@ -1,4 +1,4 @@ |
594 | -# Copyright 2009-2015 Canonical Ltd. This software is licensed under the |
595 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
596 | # GNU Affero General Public License version 3 (see the file LICENSE). |
597 | |
598 | __metaclass__ = type |
599 | @@ -1320,7 +1320,7 @@ |
600 | """ |
601 | # Create a deeply nested team and member structure. |
602 | team = self.factory.makeTeam() |
603 | - for num in xrange(10): |
604 | + for num in range(10): |
605 | another_team = self.factory.makeTeam() |
606 | another_person = self.factory.makePerson() |
607 | with person_logged_in(team.teamowner): |
608 | |
609 | === modified file 'lib/lp/scripts/tests/test_garbo.py' |
610 | --- lib/lp/scripts/tests/test_garbo.py 2018-01-02 10:54:31 +0000 |
611 | +++ lib/lp/scripts/tests/test_garbo.py 2018-02-02 10:39:33 +0000 |
612 | @@ -1,4 +1,4 @@ |
613 | -# Copyright 2009-2016 Canonical Ltd. This software is licensed under the |
614 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
615 | # GNU Affero General Public License version 3 (see the file LICENSE). |
616 | |
617 | """Test the database garbage collector.""" |
618 | @@ -1189,7 +1189,7 @@ |
619 | # between calls. |
620 | switch_dbuser('testadmin') |
621 | potmsgset_pofile = {} |
622 | - for n in xrange(4): |
623 | + for n in range(4): |
624 | pofile = self.factory.makePOFile() |
625 | translation_message = self.factory.makeCurrentTranslationMessage( |
626 | pofile=pofile) |
627 | |
628 | === modified file 'lib/lp/services/doc/orderingcheck.txt' |
629 | --- lib/lp/services/doc/orderingcheck.txt 2011-12-20 20:40:15 +0000 |
630 | +++ lib/lp/services/doc/orderingcheck.txt 2018-02-02 10:39:33 +0000 |
631 | @@ -19,7 +19,7 @@ |
632 | |
633 | >>> checker = OrderingCheck(key=sort_key) |
634 | |
635 | - >>> for number in xrange(3): |
636 | + >>> for number in range(3): |
637 | ... checker.check(number) |
638 | |
639 | |
640 | |
641 | === modified file 'lib/lp/services/helpers.py' |
642 | --- lib/lp/services/helpers.py 2016-03-17 14:47:14 +0000 |
643 | +++ lib/lp/services/helpers.py 2018-02-02 10:39:33 +0000 |
644 | @@ -1,4 +1,4 @@ |
645 | -# Copyright 2009-2014 Canonical Ltd. This software is licensed under the |
646 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
647 | # GNU Affero General Public License version 3 (see the file LICENSE). |
648 | |
649 | """Various functions and classes that are useful across different parts of |
650 | @@ -146,12 +146,12 @@ |
651 | |
652 | It works on iterable also which don't support the extended slice protocol. |
653 | |
654 | - >>> xrange(5)[:1] #doctest: +ELLIPSIS |
655 | + >>> iter(range(5))[:1] #doctest: +ELLIPSIS |
656 | Traceback (most recent call last): |
657 | ... |
658 | TypeError: ... |
659 | |
660 | - >>> shortlist(xrange(10), 5, hardlimit=8) #doctest: +ELLIPSIS |
661 | + >>> shortlist(iter(range(10)), 5, hardlimit=8) #doctest: +ELLIPSIS |
662 | Traceback (most recent call last): |
663 | ... |
664 | ShortListTooBigError: ... |
665 | |
666 | === modified file 'lib/lp/services/log/logger.py' |
667 | --- lib/lp/services/log/logger.py 2017-10-05 12:46:52 +0000 |
668 | +++ lib/lp/services/log/logger.py 2018-02-02 10:39:33 +0000 |
669 | @@ -1,4 +1,4 @@ |
670 | -# Copyright 2010-2017 Canonical Ltd. This software is licensed under the |
671 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
672 | # GNU Affero General Public License version 3 (see the file LICENSE). |
673 | |
674 | """Loggers.""" |
675 | @@ -22,7 +22,7 @@ |
676 | |
677 | LEVEL_PREFIXES = dict( |
678 | (debug_level, "DEBUG%d" % (1 + debug_level - loglevels.DEBUG)) |
679 | - for debug_level in xrange(loglevels.DEBUG9, loglevels.DEBUG)) |
680 | + for debug_level in range(loglevels.DEBUG9, loglevels.DEBUG)) |
681 | |
682 | LEVEL_PREFIXES.update({ |
683 | loglevels.DEBUG: 'DEBUG', |
684 | |
685 | === modified file 'lib/lp/services/tests/test_command_spawner.py' |
686 | --- lib/lp/services/tests/test_command_spawner.py 2012-04-16 23:02:44 +0000 |
687 | +++ lib/lp/services/tests/test_command_spawner.py 2018-02-02 10:39:33 +0000 |
688 | @@ -1,4 +1,4 @@ |
689 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
690 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
691 | # GNU Affero General Public License version 3 (see the file LICENSE). |
692 | |
693 | """Tests for `CommandSpawner`.""" |
694 | @@ -287,7 +287,7 @@ |
695 | |
696 | processes = 10 |
697 | seconds = 0.2 |
698 | - for counter in xrange(processes): |
699 | + for counter in range(processes): |
700 | spawner.start(["/bin/sleep", str(seconds)]) |
701 | |
702 | before = datetime.now(utc) |
703 | |
704 | === modified file 'lib/lp/services/tests/test_helpers.py' |
705 | --- lib/lp/services/tests/test_helpers.py 2014-01-30 09:58:18 +0000 |
706 | +++ lib/lp/services/tests/test_helpers.py 2018-02-02 10:39:33 +0000 |
707 | @@ -1,4 +1,4 @@ |
708 | -# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
709 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
710 | # GNU Affero General Public License version 3 (see the file LICENSE). |
711 | |
712 | from doctest import DocTestSuite |
713 | @@ -104,7 +104,7 @@ |
714 | UserWarning: shortlist() should not... |
715 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
716 | |
717 | - >>> shortlist(xrange(10), longest_expected=5) #doctest: +ELLIPSIS |
718 | + >>> shortlist(iter(range(10)), longest_expected=5) #doctest: +ELLIPSIS |
719 | UserWarning: shortlist() should not... |
720 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
721 | |
722 | @@ -145,7 +145,7 @@ |
723 | >>> english_list('12345') |
724 | '1, 2, 3, 4, and 5' |
725 | |
726 | - >>> english_list(str(i) for i in xrange(5)) |
727 | + >>> english_list(str(i) for i in range(5)) |
728 | '0, 1, 2, 3, and 4' |
729 | |
730 | It does not convert non-string elements: |
731 | |
732 | === modified file 'lib/lp/services/webapp/tests/test_error.py' |
733 | --- lib/lp/services/webapp/tests/test_error.py 2018-01-02 16:10:26 +0000 |
734 | +++ lib/lp/services/webapp/tests/test_error.py 2018-02-02 10:39:33 +0000 |
735 | @@ -1,4 +1,4 @@ |
736 | -# Copyright 2011-2017 Canonical Ltd. This software is licensed under the |
737 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
738 | # GNU Affero General Public License version 3 (see the file LICENSE). |
739 | |
740 | """Test error views.""" |
741 | @@ -104,7 +104,7 @@ |
742 | Return the file-like object returned by *urllib2.urlopen(url)*. |
743 | Raise a TimeoutException if the connection can not be established. |
744 | """ |
745 | - for i in xrange(retries): |
746 | + for i in range(retries): |
747 | try: |
748 | return urllib2.urlopen(url) |
749 | except urllib2.HTTPError as e: |
750 | |
751 | === modified file 'lib/lp/soyuz/adapters/tests/test_overrides.py' |
752 | --- lib/lp/soyuz/adapters/tests/test_overrides.py 2014-07-29 06:11:19 +0000 |
753 | +++ lib/lp/soyuz/adapters/tests/test_overrides.py 2018-02-02 10:39:33 +0000 |
754 | @@ -1,4 +1,4 @@ |
755 | -# Copyright 2011-2013 Canonical Ltd. This software is licensed under the |
756 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
757 | # GNU Affero General Public License version 3 (see the file LICENSE). |
758 | |
759 | """Test generic override policy classes.""" |
760 | @@ -144,7 +144,7 @@ |
761 | spns = [] |
762 | distroseries = self.factory.makeDistroSeries() |
763 | pocket = self.factory.getAnyPocket() |
764 | - for i in xrange(10): |
765 | + for i in range(10): |
766 | spph = self.factory.makeSourcePackagePublishingHistory( |
767 | distroseries=distroseries, archive=distroseries.main_archive, |
768 | pocket=pocket) |
769 | @@ -354,7 +354,7 @@ |
770 | distroseries = distroarchseries.distroseries |
771 | distroseries.nominatedarchindep = distroarchseries |
772 | pocket = self.factory.getAnyPocket() |
773 | - for i in xrange(10): |
774 | + for i in range(10): |
775 | bpph = self.factory.makeBinaryPackagePublishingHistory( |
776 | distroarchseries=distroarchseries, |
777 | archive=distroseries.main_archive, pocket=pocket) |
778 | @@ -519,7 +519,7 @@ |
779 | expected = {spns[0]: SourceOverride(component=universe, new=True)} |
780 | distroseries = self.factory.makeDistroSeries() |
781 | pocket = self.factory.getAnyPocket() |
782 | - for i in xrange(8): |
783 | + for i in range(8): |
784 | spph = self.factory.makeSourcePackagePublishingHistory( |
785 | distroseries=distroseries, archive=distroseries.main_archive, |
786 | pocket=pocket) |
787 | @@ -549,7 +549,7 @@ |
788 | bpn = self.factory.makeBinaryPackageName() |
789 | bpns = [] |
790 | expected = {} |
791 | - for i in xrange(3): |
792 | + for i in range(3): |
793 | distroarchseries = self.factory.makeDistroArchSeries( |
794 | distroseries=distroseries) |
795 | bpb = self.factory.makeBinaryPackageBuild( |
796 | @@ -566,7 +566,7 @@ |
797 | component=bpph.component, section=bpph.section, |
798 | priority=bpph.priority, new=False, |
799 | version=bpph.binarypackagerelease.version)) |
800 | - for i in xrange(2): |
801 | + for i in range(2): |
802 | distroarchseries = self.factory.makeDistroArchSeries( |
803 | distroseries=distroseries) |
804 | bpns.append((bpn, distroarchseries.architecturetag)) |
805 | |
806 | === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' |
807 | --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2017-06-03 16:40:44 +0000 |
808 | +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2018-02-02 10:39:33 +0000 |
809 | @@ -1,4 +1,4 @@ |
810 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
811 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
812 | # GNU Affero General Public License version 3 (see the file LICENSE). |
813 | |
814 | __metaclass__ = type |
815 | @@ -456,7 +456,7 @@ |
816 | |
817 | def _setupSources(self, nb_of_sources): |
818 | sources = [] |
819 | - for i in xrange(nb_of_sources): |
820 | + for i in range(nb_of_sources): |
821 | source = self.test_publisher.getPubSource( |
822 | version=u'%d' % self.factory.getUniqueInteger(), |
823 | sourcename=u'name-%d' % self.factory.getUniqueInteger()) |
824 | |
825 | === modified file 'lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py' |
826 | --- lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py 2016-05-26 14:53:06 +0000 |
827 | +++ lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py 2018-02-02 10:39:33 +0000 |
828 | @@ -1,4 +1,4 @@ |
829 | -# Copyright 2011-2016 Canonical Ltd. This software is licensed under the |
830 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
831 | # GNU Affero General Public License version 3 (see the file LICENSE). |
832 | |
833 | """Test copying of custom package uploads for a new `DistroSeries`.""" |
834 | @@ -212,7 +212,7 @@ |
835 | # XXX JeroenVermeulen 2011-08-17, bug=827967: Should compare by |
836 | # Debian version string, not id. |
837 | source_series = self.factory.makeDistroSeries() |
838 | - for counter in xrange(5): |
839 | + for counter in range(5): |
840 | self.makeUpload(source_series) |
841 | copier = CustomUploadsCopier(FakeDistroSeries()) |
842 | candidate_ids = [ |
843 | @@ -273,7 +273,7 @@ |
844 | uploads = [ |
845 | self.makeUpload( |
846 | source_series, version='1.0.%d' % counter, arch='ppc') |
847 | - for counter in xrange(3)] |
848 | + for counter in range(3)] |
849 | |
850 | copier = CustomUploadsCopier(FakeDistroSeries()) |
851 | self.assertContentEqual( |
852 | @@ -286,7 +286,7 @@ |
853 | source_series = self.factory.makeDistroSeries() |
854 | uploads = [ |
855 | self.makeUpload(source_series, arch='i386') |
856 | - for counter in xrange(2)] |
857 | + for counter in range(2)] |
858 | copier = CustomUploadsCopier(FakeDistroSeries()) |
859 | self.assertContentEqual( |
860 | uploads[-1:], copier.getLatestUploads(source_series).values()) |
861 | |
862 | === modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py' |
863 | --- lib/lp/soyuz/tests/test_binarypackagebuild.py 2016-01-06 12:24:47 +0000 |
864 | +++ lib/lp/soyuz/tests/test_binarypackagebuild.py 2018-02-02 10:39:33 +0000 |
865 | @@ -1,4 +1,4 @@ |
866 | -# Copyright 2009-2016 Canonical Ltd. This software is licensed under the |
867 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
868 | # GNU Affero General Public License version 3 (see the file LICENSE). |
869 | |
870 | """Test Build features.""" |
871 | @@ -423,7 +423,7 @@ |
872 | sprb.build_farm_job)) |
873 | |
874 | def test_getByBuildFarmJobs_works(self): |
875 | - bpbs = [self.factory.makeBinaryPackageBuild() for i in xrange(10)] |
876 | + bpbs = [self.factory.makeBinaryPackageBuild() for i in range(10)] |
877 | self.assertContentEqual( |
878 | bpbs, |
879 | getUtility(IBinaryPackageBuildSet).getByBuildFarmJobs( |
880 | |
881 | === modified file 'lib/lp/soyuz/tests/test_distroseriesdifferencejob.py' |
882 | --- lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2018-02-02 10:39:33 +0000 |
883 | +++ lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2018-02-02 10:39:33 +0000 |
884 | @@ -155,7 +155,7 @@ |
885 | |
886 | def createSPPHs(self, derived_series, nb_spph=10): |
887 | res_spph = [] |
888 | - for i in xrange(nb_spph): |
889 | + for i in range(nb_spph): |
890 | packagename = self.factory.makeSourcePackageName() |
891 | spph = self.factory.makeSourcePackagePublishingHistory( |
892 | sourcepackagename=packagename, |
893 | @@ -379,7 +379,7 @@ |
894 | spn = self.factory.makeSourcePackageName() |
895 | series = [ |
896 | self.factory.makeDistroSeries(derived_distro) |
897 | - for counter in xrange(2)] |
898 | + for counter in range(2)] |
899 | dsps = [ |
900 | self.factory.makeDistroSeriesParent(derived_series=distroseries) |
901 | for distroseries in series] |
902 | |
903 | === modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py' |
904 | --- lib/lp/soyuz/tests/test_packagecopyjob.py 2016-10-17 09:15:51 +0000 |
905 | +++ lib/lp/soyuz/tests/test_packagecopyjob.py 2018-02-02 10:39:33 +0000 |
906 | @@ -1,4 +1,4 @@ |
907 | -# Copyright 2010-2016 Canonical Ltd. This software is licensed under the |
908 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
909 | # GNU Affero General Public License version 3 (see the file LICENSE). |
910 | |
911 | """Tests for sync package jobs.""" |
912 | @@ -305,7 +305,7 @@ |
913 | # getActiveJobs returns the oldest available job first. |
914 | dsd = self.factory.makeDistroSeriesDifference() |
915 | target_archive = dsd.derived_series.main_archive |
916 | - jobs = [self.makeJob(dsd) for counter in xrange(2)] |
917 | + jobs = [self.makeJob(dsd) for counter in range(2)] |
918 | source = getUtility(IPlainPackageCopyJobSource) |
919 | self.assertEqual(jobs[0], source.getActiveJobs(target_archive)[0]) |
920 | |
921 | @@ -677,7 +677,7 @@ |
922 | dsds = [ |
923 | self.factory.makeDistroSeriesDifference( |
924 | derived_series=derived_series) |
925 | - for counter in xrange(2)] |
926 | + for counter in range(2)] |
927 | jobs = map(self.makeJob, dsds) |
928 | job_source = getUtility(IPlainPackageCopyJobSource) |
929 | self.assertEqual( |
930 | @@ -688,7 +688,7 @@ |
931 | # If there are multiple jobs for one package, |
932 | # getPendingJobsPerPackage picks the oldest. |
933 | dsd = self.factory.makeDistroSeriesDifference() |
934 | - jobs = [self.makeJob(dsd) for counter in xrange(2)] |
935 | + jobs = [self.makeJob(dsd) for counter in range(2)] |
936 | job_source = getUtility(IPlainPackageCopyJobSource) |
937 | self.assertEqual( |
938 | {dsd.source_package_name.name: jobs[0]}, |
939 | @@ -710,7 +710,7 @@ |
940 | job_source = getUtility(IPlainPackageCopyJobSource) |
941 | target1_jobs = [ |
942 | self.makePPAJob(target_archive=target1) |
943 | - for counter in xrange(2)] |
944 | + for counter in range(2)] |
945 | self.makePPAJob(target2) |
946 | |
947 | pending_jobs = list(job_source.getIncompleteJobsForArchive(target1)) |
948 | |
949 | === modified file 'lib/lp/soyuz/tests/test_packageset.py' |
950 | --- lib/lp/soyuz/tests/test_packageset.py 2018-01-02 10:54:31 +0000 |
951 | +++ lib/lp/soyuz/tests/test_packageset.py 2018-02-02 10:39:33 +0000 |
952 | @@ -1,4 +1,4 @@ |
953 | -# Copyright 2009-2014 Canonical Ltd. This software is licensed under the |
954 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
955 | # GNU Affero General Public License version 3 (see the file LICENSE). |
956 | |
957 | """Test Packageset features.""" |
958 | @@ -112,7 +112,7 @@ |
959 | # IPackagesetSet.getBySeries() will return those package sets |
960 | # associated with the given distroseries. |
961 | package_sets_for_current_ubuntu = [ |
962 | - self.factory.makePackageset() for counter in xrange(2)] |
963 | + self.factory.makePackageset() for counter in range(2)] |
964 | self.factory.makePackageset( |
965 | distroseries=self.makeExperimentalSeries()) |
966 | self.assertContentEqual( |
967 | |
968 | === modified file 'lib/lp/testing/factory.py' |
969 | --- lib/lp/testing/factory.py 2017-04-25 11:36:10 +0000 |
970 | +++ lib/lp/testing/factory.py 2018-02-02 10:39:33 +0000 |
971 | @@ -2,7 +2,7 @@ |
972 | # NOTE: The first line above must stay first; do not move the copyright |
973 | # notice to the top. See http://www.python.org/dev/peps/pep-0263/. |
974 | # |
975 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
976 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
977 | # GNU Affero General Public License version 3 (see the file LICENSE). |
978 | |
979 | """Testing infrastructure for the Launchpad application. |
980 | @@ -1108,7 +1108,7 @@ |
981 | |
982 | def makeStackedOnBranchChain(self, depth=5, **kwargs): |
983 | branch = None |
984 | - for i in xrange(depth): |
985 | + for i in range(depth): |
986 | branch = self.makeAnyBranch(stacked_on=branch, **kwargs) |
987 | return branch |
988 | |
989 | |
990 | === modified file 'lib/lp/testing/fixture.py' |
991 | --- lib/lp/testing/fixture.py 2017-09-02 13:29:14 +0000 |
992 | +++ lib/lp/testing/fixture.py 2018-02-02 10:39:33 +0000 |
993 | @@ -1,4 +1,4 @@ |
994 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
995 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
996 | # GNU Affero General Public License version 3 (see the file LICENSE). |
997 | |
998 | """Launchpad test fixtures that have no better home.""" |
999 | @@ -137,7 +137,7 @@ |
1000 | """Start PGBouncer, waiting for it to accept connections if neccesary. |
1001 | """ |
1002 | super(PGBouncerFixture, self).start() |
1003 | - for i in xrange(retries): |
1004 | + for i in range(retries): |
1005 | try: |
1006 | socket.create_connection((self.host, self.port)) |
1007 | except socket.error: |
1008 | |
1009 | === modified file 'lib/lp/testing/tests/test_fakemethod.py' |
1010 | --- lib/lp/testing/tests/test_fakemethod.py 2011-08-12 11:37:08 +0000 |
1011 | +++ lib/lp/testing/tests/test_fakemethod.py 2018-02-02 10:39:33 +0000 |
1012 | @@ -1,4 +1,4 @@ |
1013 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
1014 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1015 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1016 | |
1017 | from unittest import TestCase |
1018 | @@ -67,7 +67,7 @@ |
1019 | def test_countCalls(self): |
1020 | # A FakeMethod counts the number of times it's been invoked. |
1021 | func = FakeMethod() |
1022 | - for count in xrange(3): |
1023 | + for count in range(3): |
1024 | self.assertEqual(count, func.call_count) |
1025 | func() |
1026 | self.assertEqual(count + 1, func.call_count) |
1027 | |
1028 | === modified file 'lib/lp/translations/browser/tests/test_persontranslationview.py' |
1029 | --- lib/lp/translations/browser/tests/test_persontranslationview.py 2014-06-10 11:25:51 +0000 |
1030 | +++ lib/lp/translations/browser/tests/test_persontranslationview.py 2018-02-02 10:39:33 +0000 |
1031 | @@ -1,4 +1,4 @@ |
1032 | -# Copyright 2009-2014 Canonical Ltd. This software is licensed under the |
1033 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1034 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1035 | |
1036 | __metaclass__ = type |
1037 | @@ -57,7 +57,7 @@ |
1038 | pofiles = [] |
1039 | if languages is not None: |
1040 | potemplate = self.factory.makePOTemplate() |
1041 | - for counter in xrange(count): |
1042 | + for counter in range(count): |
1043 | if languages is None: |
1044 | pofile = self.factory.makePOFile(language=self.language) |
1045 | else: |
1046 | |
1047 | === modified file 'lib/lp/translations/browser/tests/test_translationimportqueueentry.py' |
1048 | --- lib/lp/translations/browser/tests/test_translationimportqueueentry.py 2016-09-12 17:41:21 +0000 |
1049 | +++ lib/lp/translations/browser/tests/test_translationimportqueueentry.py 2018-02-02 10:39:33 +0000 |
1050 | @@ -1,4 +1,4 @@ |
1051 | -# Copyright 2010-2016 Canonical Ltd. This software is licensed under the |
1052 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1053 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1054 | |
1055 | """Unit tests for translation import queue views.""" |
1056 | @@ -137,7 +137,7 @@ |
1057 | # Many translatable series. The list is cut short; there's an |
1058 | # ellipsis to indicate this. |
1059 | series_count = len(product.translatable_series) |
1060 | - for counter in xrange(series_count, view.max_series_to_display + 1): |
1061 | + for counter in range(series_count, view.max_series_to_display + 1): |
1062 | extra_series = self.factory.makeProductSeries(product=product) |
1063 | self.factory.makePOTemplate(productseries=extra_series) |
1064 | series_text = view.product_translatable_series |
1065 | |
1066 | === modified file 'lib/lp/translations/browser/tests/test_translationmessage_view.py' |
1067 | --- lib/lp/translations/browser/tests/test_translationmessage_view.py 2018-02-02 10:39:33 +0000 |
1068 | +++ lib/lp/translations/browser/tests/test_translationmessage_view.py 2018-02-02 10:39:33 +0000 |
1069 | @@ -315,7 +315,7 @@ |
1070 | base_field_name = 'msgset_%d_%s_translation_' % ( |
1071 | message.potmsgset.id, pofile.language.code) |
1072 | # Add the expected plural forms fields. |
1073 | - for plural_form in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1074 | + for plural_form in range(TranslationConstants.MAX_PLURAL_FORMS): |
1075 | field_name = '%s%d_new' % (base_field_name, plural_form) |
1076 | form[field_name] = u'snarf' |
1077 | url = '/%s/%s/%s/+translate' % ( |
1078 | @@ -397,7 +397,7 @@ |
1079 | self.assertFalse(contains_translations({})) |
1080 | |
1081 | def test_contains_translations_finds_any_translations(self): |
1082 | - for plural_form in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1083 | + for plural_form in range(TranslationConstants.MAX_PLURAL_FORMS): |
1084 | self.assertTrue( |
1085 | contains_translations({plural_form: self.getUniqueString()})) |
1086 | |
1087 | |
1088 | === modified file 'lib/lp/translations/browser/translationmessage.py' |
1089 | --- lib/lp/translations/browser/translationmessage.py 2018-02-02 10:39:33 +0000 |
1090 | +++ lib/lp/translations/browser/translationmessage.py 2018-02-02 10:39:33 +0000 |
1091 | @@ -741,7 +741,7 @@ |
1092 | # Extract the translations from the form, and store them in |
1093 | # self.form_posted_translations. We try plural forms in turn, |
1094 | # starting at 0. |
1095 | - for pluralform in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1096 | + for pluralform in range(TranslationConstants.MAX_PLURAL_FORMS): |
1097 | msgset_ID_LANGCODE_translation_PLURALFORM_new = '%s%d_new' % ( |
1098 | msgset_ID_LANGCODE_translation_, pluralform) |
1099 | if msgset_ID_LANGCODE_translation_PLURALFORM_new not in form: |
1100 | |
1101 | === modified file 'lib/lp/translations/model/pofile.py' |
1102 | --- lib/lp/translations/model/pofile.py 2016-01-26 15:47:37 +0000 |
1103 | +++ lib/lp/translations/model/pofile.py 2018-02-02 10:39:33 +0000 |
1104 | @@ -1,4 +1,4 @@ |
1105 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
1106 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1107 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1108 | |
1109 | """`SQLObject` implementation of `IPOFile` interface.""" |
1110 | @@ -624,7 +624,7 @@ |
1111 | clauses = self._getStormClausesForPOFileMessages() |
1112 | msgstr_clause = Or(*( |
1113 | getattr(TranslationMessage, 'msgstr%d' % form) != None |
1114 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS))) |
1115 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS))) |
1116 | clauses.extend([ |
1117 | TranslationTemplateItem.potmsgsetID == POTMsgSet.id, |
1118 | Not(getattr(TranslationMessage, flag_name)), |
1119 | @@ -853,7 +853,7 @@ |
1120 | self.potemplate).flag_name |
1121 | suggestion_nonempty = "COALESCE(%s) IS NOT NULL" % ', '.join([ |
1122 | 'Suggestion.msgstr%d' % form |
1123 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)]) |
1124 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)]) |
1125 | params = { |
1126 | 'language': quote(self.language), |
1127 | 'potemplate': quote(self.potemplate), |
1128 | @@ -1198,7 +1198,7 @@ |
1129 | TranslationMessage.language = %(language)s |
1130 | """ % params |
1131 | |
1132 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1133 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS): |
1134 | alias = "potranslation%d" % form |
1135 | field = "TranslationMessage.msgstr%d" % form |
1136 | query += "LEFT JOIN POTranslation AS %s ON %s.id = %s\n" % ( |
1137 | @@ -1729,7 +1729,7 @@ |
1138 | |
1139 | forms = list(enumerate([ |
1140 | getattr(row, "translation%d" % form) |
1141 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)])) |
1142 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)])) |
1143 | max_forms = pofile.plural_forms |
1144 | for (pluralform, translation) in forms[:max_forms]: |
1145 | if translation is not None: |
1146 | |
1147 | === modified file 'lib/lp/translations/model/potmsgset.py' |
1148 | --- lib/lp/translations/model/potmsgset.py 2018-02-02 10:39:33 +0000 |
1149 | +++ lib/lp/translations/model/potmsgset.py 2018-02-02 10:39:33 +0000 |
1150 | @@ -426,7 +426,7 @@ |
1151 | # distinct translations per form. |
1152 | msgstrs = ', '.join([ |
1153 | 'COALESCE(msgstr%d, -1)' % form |
1154 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)]) |
1155 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)]) |
1156 | ids_query_params = { |
1157 | 'msgstrs': msgstrs, |
1158 | 'where': '(' + ' OR '.join(lang_used) + ')', |
1159 | @@ -518,7 +518,7 @@ |
1160 | """Find all POTranslation records for passed `translations`.""" |
1161 | potranslations = {} |
1162 | # Set all POTranslations we can have (up to MAX_PLURAL_FORMS) |
1163 | - for pluralform in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1164 | + for pluralform in range(TranslationConstants.MAX_PLURAL_FORMS): |
1165 | translation = translations.get(pluralform) |
1166 | if translation is not None: |
1167 | # Find or create a POTranslation for the specified text |
1168 | |
1169 | === modified file 'lib/lp/translations/model/translationmessage.py' |
1170 | --- lib/lp/translations/model/translationmessage.py 2015-07-08 16:05:11 +0000 |
1171 | +++ lib/lp/translations/model/translationmessage.py 2018-02-02 10:39:33 +0000 |
1172 | @@ -1,4 +1,4 @@ |
1173 | -# Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1174 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1175 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1176 | |
1177 | __metaclass__ = type |
1178 | @@ -73,7 +73,7 @@ |
1179 | """ |
1180 | return separator.join([ |
1181 | fragment % {'form': form} |
1182 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)]) |
1183 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)]) |
1184 | |
1185 | |
1186 | def make_plurals_sql_fragment(fragment, separator="AND"): |
1187 | @@ -169,7 +169,7 @@ |
1188 | self.date_reviewed = None |
1189 | self.reviewer = None |
1190 | |
1191 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1192 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS): |
1193 | setattr(self, 'msgstr%d' % form, None) |
1194 | |
1195 | self.comment = None |
1196 | @@ -307,7 +307,7 @@ |
1197 | """See `ITranslationMessage`.""" |
1198 | return [ |
1199 | getattr(self, 'msgstr%d' % form) |
1200 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)] |
1201 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)] |
1202 | |
1203 | @cachedproperty |
1204 | def translations(self): |
1205 | @@ -498,7 +498,7 @@ |
1206 | store = Store.of(self) |
1207 | |
1208 | forms_match = (TranslationMessage.msgstr0ID == self.msgstr0ID) |
1209 | - for form in xrange(1, TranslationConstants.MAX_PLURAL_FORMS): |
1210 | + for form in range(1, TranslationConstants.MAX_PLURAL_FORMS): |
1211 | form_name = 'msgstr%d' % form |
1212 | form_value = getattr(self, 'msgstr%dID' % form) |
1213 | forms_match = And( |
1214 | @@ -571,7 +571,7 @@ |
1215 | load_related( |
1216 | POTranslation, tms, |
1217 | ['msgstr%dID' % form |
1218 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)]) |
1219 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)]) |
1220 | if need_potmsgset: |
1221 | load_related(POTMsgSet, tms, ['potmsgsetID']) |
1222 | if need_people: |
1223 | |
1224 | === modified file 'lib/lp/translations/scripts/fix_plural_forms.py' |
1225 | --- lib/lp/translations/scripts/fix_plural_forms.py 2015-10-14 16:23:18 +0000 |
1226 | +++ lib/lp/translations/scripts/fix_plural_forms.py 2018-02-02 10:39:33 +0000 |
1227 | @@ -1,4 +1,4 @@ |
1228 | -# Copyright 2009 Canonical Ltd. This software is licensed under the |
1229 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1230 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1231 | |
1232 | """Functions for fixing mismatched plural form translations.""" |
1233 | @@ -58,7 +58,7 @@ |
1234 | logger.debug("\tFixing translations for '%s'" % ( |
1235 | message.potmsgset.singular_text)) |
1236 | |
1237 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1238 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS): |
1239 | new_form = plural_forms_mapping[form] |
1240 | assert new_form < TranslationConstants.MAX_PLURAL_FORMS, ( |
1241 | "Translation with plural form %d in plurals mapping." % |
1242 | |
1243 | === modified file 'lib/lp/translations/stories/standalone/xx-translations-to-review.txt' |
1244 | --- lib/lp/translations/stories/standalone/xx-translations-to-review.txt 2017-10-21 18:14:14 +0000 |
1245 | +++ lib/lp/translations/stories/standalone/xx-translations-to-review.txt 2018-02-02 10:39:33 +0000 |
1246 | @@ -136,7 +136,7 @@ |
1247 | at 10 entries. |
1248 | |
1249 | >>> login(ANONYMOUS) |
1250 | - >>> for count in xrange(9): |
1251 | + >>> for count in range(9): |
1252 | ... pofile = add_unreviewed_pofile(translationgroup) |
1253 | ... work_on(user, pofile) |
1254 | >>> logout() |
1255 | |
1256 | === modified file 'lib/lp/translations/tests/test_autoapproval.py' |
1257 | --- lib/lp/translations/tests/test_autoapproval.py 2018-01-02 10:54:31 +0000 |
1258 | +++ lib/lp/translations/tests/test_autoapproval.py 2018-02-02 10:39:33 +0000 |
1259 | @@ -1,4 +1,4 @@ |
1260 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
1261 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1262 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1263 | |
1264 | """Unit tests for translation import queue auto-approval. |
1265 | @@ -485,7 +485,7 @@ |
1266 | series = self.factory.makeProductSeries() |
1267 | templates = [ |
1268 | self.factory.makePOTemplate(productseries=series) |
1269 | - for counter in xrange(2)] |
1270 | + for counter in range(2)] |
1271 | entry = self.factory.makeTranslationImportQueueEntry( |
1272 | productseries=series) |
1273 | self.assertEqual( |
1274 | @@ -501,7 +501,7 @@ |
1275 | self.factory.makePOTemplate( |
1276 | translation_domain=domain, |
1277 | productseries=self.factory.makeProductSeries()) |
1278 | - for counter in xrange(2)] |
1279 | + for counter in range(2)] |
1280 | entry = self.factory.makeTranslationImportQueueEntry( |
1281 | productseries=templates[0].productseries) |
1282 | self.assertEqual( |
1283 | @@ -518,7 +518,7 @@ |
1284 | self.factory.makePOTemplate( |
1285 | translation_domain=domain, distroseries=distroseries, |
1286 | sourcepackagename=self.factory.makeSourcePackageName()) |
1287 | - for counter in xrange(2)] |
1288 | + for counter in range(2)] |
1289 | entry = self.factory.makeTranslationImportQueueEntry( |
1290 | distroseries=distroseries, |
1291 | sourcepackagename=templates[1].sourcepackagename) |
1292 | @@ -557,7 +557,7 @@ |
1293 | templates = [ |
1294 | self.factory.makePOTemplate( |
1295 | translation_domain=domain, productseries=series) |
1296 | - for counter in xrange(2)] |
1297 | + for counter in range(2)] |
1298 | entry = self.factory.makeTranslationImportQueueEntry( |
1299 | productseries=series) |
1300 | |
1301 | |
1302 | === modified file 'lib/lp/translations/tests/test_potmsgset.py' |
1303 | --- lib/lp/translations/tests/test_potmsgset.py 2018-01-02 16:10:26 +0000 |
1304 | +++ lib/lp/translations/tests/test_potmsgset.py 2018-02-02 10:39:33 +0000 |
1305 | @@ -1,4 +1,4 @@ |
1306 | -# Copyright 2009-2013 Canonical Ltd. This software is licensed under the |
1307 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1308 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1309 | |
1310 | __metaclass__ = type |
1311 | @@ -1461,7 +1461,7 @@ |
1312 | """Produce a POTranslations dict of random translations.""" |
1313 | return dict( |
1314 | (form, self.factory.getUniqueString()) |
1315 | - for form in xrange(forms)) |
1316 | + for form in range(forms)) |
1317 | |
1318 | def test_baseline(self): |
1319 | # setCurrentTranslation sets the current translation |
1320 | |
1321 | === modified file 'lib/lp/translations/tests/test_translationimportqueue.py' |
1322 | --- lib/lp/translations/tests/test_translationimportqueue.py 2018-01-02 16:10:26 +0000 |
1323 | +++ lib/lp/translations/tests/test_translationimportqueue.py 2018-02-02 10:39:33 +0000 |
1324 | @@ -1,4 +1,4 @@ |
1325 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
1326 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1327 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1328 | |
1329 | __metaclass__ = type |
1330 | @@ -474,7 +474,7 @@ |
1331 | templates = [ |
1332 | self.factory.makePOTemplate( |
1333 | productseries=series, translation_domain=domain) |
1334 | - for counter in xrange(3)] |
1335 | + for counter in range(3)] |
1336 | entry = removeSecurityProxy( |
1337 | self.factory.makeTranslationImportQueueEntry()) |
1338 | |
1339 | |
1340 | === modified file 'lib/lp/translations/tests/test_translationmessage.py' |
1341 | --- lib/lp/translations/tests/test_translationmessage.py 2018-01-02 16:10:26 +0000 |
1342 | +++ lib/lp/translations/tests/test_translationmessage.py 2018-02-02 10:39:33 +0000 |
1343 | @@ -1,4 +1,4 @@ |
1344 | -# Copyright 2009-2014 Canonical Ltd. This software is licensed under the |
1345 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1346 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1347 | |
1348 | """Unit tests for `TranslationMessage`.""" |
1349 | @@ -849,7 +849,7 @@ |
1350 | |
1351 | self.translation_strings = [ |
1352 | 'foe%d' % form |
1353 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)] |
1354 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)] |
1355 | |
1356 | self.message = self.factory.makeCurrentTranslationMessage( |
1357 | pofile=self.pofile, potmsgset=self.potmsgset, |
1358 | |
1359 | === modified file 'lib/lp/translations/tests/test_translationpolicy.py' |
1360 | --- lib/lp/translations/tests/test_translationpolicy.py 2015-07-08 16:05:11 +0000 |
1361 | +++ lib/lp/translations/tests/test_translationpolicy.py 2018-02-02 10:39:33 +0000 |
1362 | @@ -1,4 +1,4 @@ |
1363 | -# Copyright 2010-2014 Canonical Ltd. This software is licensed under the |
1364 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1365 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1366 | |
1367 | """Test `TranslationPolicyMixin`.""" |
1368 | @@ -48,8 +48,7 @@ |
1369 | |
1370 | def _makeTranslationGroups(self, count): |
1371 | """Return a list of `count` freshly minted `TranslationGroup`s.""" |
1372 | - return [ |
1373 | - self.factory.makeTranslationGroup() for number in xrange(count)] |
1374 | + return [self.factory.makeTranslationGroup() for number in range(count)] |
1375 | |
1376 | def _makeTranslator(self, language, for_policy=None): |
1377 | """Create a translator for a policy object. |
1378 | |
1379 | === modified file 'lib/lp/translations/tests/test_translationtemplatesbuild.py' |
1380 | --- lib/lp/translations/tests/test_translationtemplatesbuild.py 2018-01-02 16:10:26 +0000 |
1381 | +++ lib/lp/translations/tests/test_translationtemplatesbuild.py 2018-02-02 10:39:33 +0000 |
1382 | @@ -1,4 +1,4 @@ |
1383 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
1384 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1385 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1386 | |
1387 | """`TranslationTemplatesBuild` tests.""" |
1388 | @@ -233,7 +233,7 @@ |
1389 | source = getUtility(ITranslationTemplatesBuildSource) |
1390 | build_farm_jobs = [] |
1391 | builds = [] |
1392 | - for i in xrange(10): |
1393 | + for i in range(10): |
1394 | branch = self.factory.makeBranch() |
1395 | build = source.create(branch) |
1396 | builds.append(build) |
1397 | |
1398 | === modified file 'lib/lp/translations/utilities/gettext_po_parser.py' |
1399 | --- lib/lp/translations/utilities/gettext_po_parser.py 2016-09-14 11:13:06 +0000 |
1400 | +++ lib/lp/translations/utilities/gettext_po_parser.py 2018-02-02 10:39:33 +0000 |
1401 | @@ -1,4 +1,4 @@ |
1402 | -# Copyright 2009-2016 Canonical Ltd. This software is licensed under the |
1403 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1404 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1405 | |
1406 | # Originally based on code from msgfmt.py (available from python source |
1407 | @@ -662,7 +662,7 @@ |
1408 | # Octal escape. |
1409 | position += 2 |
1410 | # Up to two more octal digits. |
1411 | - for i in xrange(2): |
1412 | + for i in range(2): |
1413 | if string[position].isdigit(): |
1414 | position += 1 |
1415 | else: |
1416 | |
1417 | === modified file 'lib/lp/translations/utilities/kde_po_exporter.py' |
1418 | --- lib/lp/translations/utilities/kde_po_exporter.py 2015-07-08 16:05:11 +0000 |
1419 | +++ lib/lp/translations/utilities/kde_po_exporter.py 2018-02-02 10:39:33 +0000 |
1420 | @@ -1,4 +1,4 @@ |
1421 | -# Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
1422 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1423 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1424 | |
1425 | """Export module for KDE legacy .po file format. |
1426 | @@ -57,7 +57,7 @@ |
1427 | elif translation_message.msgid_plural is not None: |
1428 | # Also, let's handle legacy KDE plural forms. |
1429 | translations = translation_message.translations |
1430 | - for pluralform_index in xrange(len(translations)): |
1431 | + for pluralform_index in range(len(translations)): |
1432 | if translations[pluralform_index] is None: |
1433 | translations[pluralform_index] = '' |
1434 | translation_message._translations = ["\n".join(translations)] |
1435 | |
1436 | === modified file 'lib/lp/translations/utilities/pluralforms.py' |
1437 | --- lib/lp/translations/utilities/pluralforms.py 2018-02-02 10:39:33 +0000 |
1438 | +++ lib/lp/translations/utilities/pluralforms.py 2018-02-02 10:39:33 +0000 |
1439 | @@ -27,7 +27,7 @@ |
1440 | # Maximum number of examples per plural form. |
1441 | MAX_EXAMPLES = 6 |
1442 | |
1443 | - for number in xrange(200): |
1444 | + for number in range(200): |
1445 | try: |
1446 | form = function(number) |
1447 | except ZeroDivisionError: |
1448 | @@ -82,7 +82,7 @@ |
1449 | |
1450 | def make_plurals_identity_map(): |
1451 | """Return a dict mapping each plural form number onto itself.""" |
1452 | - return dict(enumerate(xrange(TranslationConstants.MAX_PLURAL_FORMS))) |
1453 | + return dict(enumerate(range(TranslationConstants.MAX_PLURAL_FORMS))) |
1454 | |
1455 | |
1456 | def plural_form_mapper(first_expression, second_expression): |
1457 | |
1458 | === modified file 'lib/lp/translations/utilities/translation_import.py' |
1459 | --- lib/lp/translations/utilities/translation_import.py 2015-09-28 17:38:45 +0000 |
1460 | +++ lib/lp/translations/utilities/translation_import.py 2018-02-02 10:39:33 +0000 |
1461 | @@ -1,4 +1,4 @@ |
1462 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
1463 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1464 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1465 | |
1466 | __metaclass__ = type |
1467 | @@ -99,14 +99,14 @@ |
1468 | return False |
1469 | length_overlap = min( |
1470 | len(existing_msg.translations), len(new_msg.translations)) |
1471 | - for pluralform_index in xrange(length_overlap): |
1472 | + for pluralform_index in range(length_overlap): |
1473 | # Plural forms that both messages have. Translations for each |
1474 | # must match. |
1475 | existing_text = existing_msg.translations[pluralform_index] |
1476 | new_text = new_msg.translations[pluralform_index] |
1477 | if existing_text != new_text: |
1478 | return False |
1479 | - for pluralform_index in xrange(length_overlap, len(new_msg.translations)): |
1480 | + for pluralform_index in range(length_overlap, len(new_msg.translations)): |
1481 | # Plural forms that exist in new_translations but not in |
1482 | # existing_translations. That's okay, as long as all of them are |
1483 | # None. |
1484 | @@ -144,11 +144,11 @@ |
1485 | msgstr_joins = [ |
1486 | "LEFT OUTER JOIN POTranslation AS pt%d " |
1487 | "ON pt%d.id = TranslationMessage.msgstr%d" % (form, form, form) |
1488 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)] |
1489 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)] |
1490 | |
1491 | translations = [ |
1492 | "pt%d.translation AS translation%d" % (form, form) |
1493 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)] |
1494 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)] |
1495 | |
1496 | substitutions = { |
1497 | 'translation_columns': ', '.join(translations), |
1498 | @@ -233,7 +233,7 @@ |
1499 | message.msgid_singular = msgid |
1500 | message.msgid_plural = msgid_plural |
1501 | |
1502 | - for plural in xrange(TranslationConstants.MAX_PLURAL_FORMS): |
1503 | + for plural in range(TranslationConstants.MAX_PLURAL_FORMS): |
1504 | msgstr = msgstrs.get(plural, None) |
1505 | if (msgstr is not None and |
1506 | ((len(message.translations) > plural and |
1507 | |
1508 | === modified file 'lib/lp/translations/utilities/translationmerger.py' |
1509 | --- lib/lp/translations/utilities/translationmerger.py 2014-08-27 02:03:34 +0000 |
1510 | +++ lib/lp/translations/utilities/translationmerger.py 2018-02-02 10:39:33 +0000 |
1511 | @@ -1,4 +1,4 @@ |
1512 | -# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
1513 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1514 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1515 | |
1516 | __metaclass__ = type |
1517 | @@ -600,7 +600,7 @@ |
1518 | tm = removeSecurityProxy(tm) |
1519 | msgstr_ids = tuple([ |
1520 | getattr(tm, 'msgstr%dID' % form) |
1521 | - for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)]) |
1522 | + for form in range(TranslationConstants.MAX_PLURAL_FORMS)]) |
1523 | |
1524 | return (tm.potemplateID, tm.languageID) + msgstr_ids |
1525 |