Merge ~jugmac00/launchpad:improve-readability-of-distribution.rst into launchpad:master

Proposed by Jürgen Gmach
Status: Merged
Approved by: Jürgen Gmach
Approved revision: 49620c0571a41549276cee94b820881e03bb9abe
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~jugmac00/launchpad:improve-readability-of-distribution.rst
Merge into: launchpad:master
Diff against target: 269 lines (+41/-41)
1 file modified
lib/lp/registry/doc/distribution.rst (+41/-41)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+429694@code.launchpad.net

Commit message

Improve readability of `distribution.rst`

Description of the change

- explain abbreviation
- use double quotes in doctests

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/registry/doc/distribution.rst b/lib/lp/registry/doc/distribution.rst
2index e21f674..b57b1ed 100644
3--- a/lib/lp/registry/doc/distribution.rst
4+++ b/lib/lp/registry/doc/distribution.rst
5@@ -44,15 +44,15 @@ can be used to look up distributions by their aliases too.
6 gentoo
7
8 # Need to login as an LP admin to set a project's aliases.
9- >>> login('foo.bar@canonical.com')
10- >>> gentoo.setAliases(['jackass'])
11+ >>> login("foo.bar@canonical.com")
12+ >>> gentoo.setAliases(["jackass"])
13 >>> for alias in gentoo.aliases:
14 ... print(alias)
15 jackass
16 >>> login(ANONYMOUS)
17- >>> print(distroset['jackass'].name)
18+ >>> print(distroset["jackass"].name)
19 gentoo
20- >>> print(distroset.getByName('jackass').name)
21+ >>> print(distroset.getByName("jackass").name)
22 gentoo
23
24 Let's make sure a distribution object properly implements its interfaces.
25@@ -87,7 +87,7 @@ have a SourcePackageName object for it.
26 >>> from lp.soyuz.model.sourcepackagerelease import (
27 ... SourcePackageRelease)
28 >>> sourcepackagerelease = SourcePackageRelease.selectOneBy(
29- ... sourcepackagenameID=evo.id, version='1.0')
30+ ... sourcepackagenameID=evo.id, version="1.0")
31 >>> print(sourcepackagerelease.name)
32 evolution
33
34@@ -181,9 +181,9 @@ Searching for DistributionSourcePackages
35 ........................................
36
37 The distribution also allows you to look for source packages that match
38-a certain string through the magic of fti. For instance:
39+a certain string through the magic of full text indexing (fti). For instance:
40
41- >>> packages = ubuntu.searchSourcePackageCaches(u"mozilla")
42+ >>> packages = ubuntu.searchSourcePackageCaches("mozilla")
43 >>> for distro_source_package_cache, source_name, rank in packages:
44 ... print("%-17s rank:%s" % (
45 ... distro_source_package_cache.name,
46@@ -193,10 +193,10 @@ a certain string through the magic of fti. For instance:
47 The search also matches on exact package names which fti doesn't like,
48 and even on substrings:
49
50- >>> packages = ubuntu.searchSourcePackageCaches(u"linux-source-2.6.15")
51+ >>> packages = ubuntu.searchSourcePackageCaches("linux-source-2.6.15")
52 >>> print(packages.count())
53 1
54- >>> packages = ubuntu.searchSourcePackageCaches(u'a')
55+ >>> packages = ubuntu.searchSourcePackageCaches("a")
56 >>> for distro_source_package_cache, source_name, rank in packages:
57 ... print("%s: %-17s rank:%s" % (
58 ... distro_source_package_cache.__class__.__name__,
59@@ -211,7 +211,7 @@ and even on substrings:
60 The searchSourcePackages() method just returns a decorated version
61 of the results from searchSourcePackageCaches():
62
63- >>> packages = ubuntu.searchSourcePackages(u'a')
64+ >>> packages = ubuntu.searchSourcePackages("a")
65 >>> for dsp in packages:
66 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
67 DistributionSourcePackage: alsa-utils
68@@ -225,13 +225,13 @@ it just passes on to searchSourcePackageCaches(), and it restricts
69 the results based on whether the source package has an entry
70 in the Packaging table linking it to an upstream project.
71
72- >>> packages = ubuntu.searchSourcePackages(u'a', has_packaging=True)
73+ >>> packages = ubuntu.searchSourcePackages("a", has_packaging=True)
74 >>> for dsp in packages:
75 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
76 DistributionSourcePackage: alsa-utils
77 DistributionSourcePackage: mozilla-firefox
78 DistributionSourcePackage: netapplet
79- >>> packages = ubuntu.searchSourcePackages(u'a', has_packaging=False)
80+ >>> packages = ubuntu.searchSourcePackages("a", has_packaging=False)
81 >>> for dsp in packages:
82 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
83 DistributionSourcePackage: commercialpackage
84@@ -243,7 +243,7 @@ results based on whether the source package has an entry in the
85 SourcePackagePublishingHistory table for the given distroseries.
86
87 >>> packages = ubuntu.searchSourcePackages(
88- ... u'a', publishing_distroseries=ubuntu.currentseries)
89+ ... "a", publishing_distroseries=ubuntu.currentseries)
90 >>> for dsp in packages:
91 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
92 DistributionSourcePackage: alsa-utils
93@@ -262,7 +262,7 @@ Searching for an exact match on a valid binary name returns the
94 expected results:
95
96 >>> results = ubuntu.searchBinaryPackages(
97- ... u"mozilla-firefox", exact_match=True)
98+ ... "mozilla-firefox", exact_match=True)
99 >>> for result in results:
100 ... print(result.name)
101 mozilla-firefox
102@@ -270,13 +270,13 @@ expected results:
103 An exact match search with no matches on any package name returns
104 an empty result set:
105
106- >>> results = ubuntu.searchBinaryPackages(u"mozilla", exact_match=True)
107+ >>> results = ubuntu.searchBinaryPackages("mozilla", exact_match=True)
108 >>> results.count()
109 0
110
111 Loosening to substring matches gives another result:
112
113- >>> results = ubuntu.searchBinaryPackages(u"mozilla", exact_match=False)
114+ >>> results = ubuntu.searchBinaryPackages("mozilla", exact_match=False)
115 >>> print(results[0])
116 <...DistributionSourcePackageCache instance ...
117
118@@ -290,7 +290,7 @@ Loosening to substring matches gives another result:
119 The results of searchBinaryPackages() are simply ordered alphabetically
120 for the moment until we have a better FTI rank to order with.
121
122- >>> results = ubuntu.searchBinaryPackages(u"m")
123+ >>> results = ubuntu.searchBinaryPackages("m")
124 >>> for result in results:
125 ... print(result.name)
126 mozilla-firefox
127@@ -307,14 +307,14 @@ we need some way to decompose that into the distroseries and the pocket.
128 Distribution can do that for us.
129
130 If we ask for a totally unknown distroseries, we raise NotFoundError
131- >>> ubuntu.getDistroSeriesAndPocket('unknown')
132+ >>> ubuntu.getDistroSeriesAndPocket("unknown")
133 Traceback (most recent call last):
134 ...
135 lp.app.errors.NotFoundError: ...'unknown'
136
137 If we ask for a plain distroseries, it should come back with the RELEASE
138 pocket as the pocket.
139- >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary')
140+ >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary")
141 >>> print(dr.name)
142 hoary
143 >>> print(pocket.name)
144@@ -322,14 +322,14 @@ pocket as the pocket.
145
146 If we ask for a security pocket in a known distroseries it should come out
147 on the other side.
148- >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary-security')
149+ >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary-security")
150 >>> print(dr.name)
151 hoary
152 >>> print(pocket.name)
153 SECURITY
154
155 Find the backports pocket, too:
156- >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary-backports')
157+ >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary-backports")
158 >>> print(dr.name)
159 hoary
160 >>> print(pocket.name)
161@@ -337,7 +337,7 @@ Find the backports pocket, too:
162
163 If we ask for a valid distroseries which doesn't have a given pocket it should
164 raise NotFoundError for us
165- >>> ubuntu.getDistroSeriesAndPocket('hoary-bullshit')
166+ >>> ubuntu.getDistroSeriesAndPocket("hoary-bullshit")
167 Traceback (most recent call last):
168 ...
169 lp.app.errors.NotFoundError: ...'hoary-bullshit'
170@@ -444,7 +444,7 @@ Gentoo only uses Malone
171 Launchpad admins and the distro owner can set these fields.
172
173 >>> from lp.app.enums import ServiceUsage
174- >>> login('mark@example.com')
175+ >>> login("mark@example.com")
176 >>> debian = getUtility(ILaunchpadCelebrities).debian
177 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
178 >>> print(debian.blueprints_usage.name)
179@@ -465,7 +465,7 @@ Launchpad admins and the distro owner can set these fields.
180
181 But others can't.
182
183- >>> login('no-priv@canonical.com')
184+ >>> login("no-priv@canonical.com")
185 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
186 Traceback (most recent call last):
187 zope.security.interfaces.Unauthorized:
188@@ -549,23 +549,23 @@ And if we ask just for specs, we get the incomplete ones.
189
190 We can filter for specifications that contain specific text:
191
192- >>> for spec in kubuntu.specifications(None, filter=[u'package']):
193+ >>> for spec in kubuntu.specifications(None, filter=["package"]):
194 ... print(spec.name)
195 revu
196
197 We can get only valid specs (those that are not obsolete or superseded):
198
199 >>> from lp.blueprints.enums import SpecificationDefinitionStatus
200- >>> login('mark@example.com')
201+ >>> login("mark@example.com")
202 >>> for spec in kubuntu.specifications(None):
203 ... # Do this here, otherwise, the change will be flush before
204 ... # updateLifecycleStatus() acts and an IntegrityError will be
205 ... # raised.
206 ... owner = spec.owner
207- ... if spec.name in ['cluster-installation', 'revu']:
208+ ... if spec.name in ["cluster-installation", "revu"]:
209 ... spec.definition_status = (
210 ... SpecificationDefinitionStatus.OBSOLETE)
211- ... if spec.name in ['krunch-desktop-plan']:
212+ ... if spec.name in ["krunch-desktop-plan"]:
213 ... spec.definition_status = (
214 ... SpecificationDefinitionStatus.SUPERSEDED)
215 ... shim = spec.updateLifecycleStatus(owner)
216@@ -586,26 +586,26 @@ series of a distribution.
217 3.1
218 3.1-rc1
219
220- >>> woody = debian['woody']
221+ >>> woody = debian["woody"]
222
223 Milestones for distros can only be created by distro owners or admins.
224
225- >>> login('no-priv@canonical.com')
226+ >>> login("no-priv@canonical.com")
227 >>> woody.newMilestone(
228- ... name='impossible', dateexpected=datetime(2028, 10, 1))
229+ ... name="impossible", dateexpected=datetime(2028, 10, 1))
230 Traceback (most recent call last):
231 ...
232 zope.security.interfaces.Unauthorized:
233 (<DistroSeries ...'woody'>, 'newMilestone', 'launchpad.Edit')
234- >>> login('mark@example.com')
235+ >>> login("mark@example.com")
236 >>> debian_milestone = woody.newMilestone(
237- ... name='woody-rc1', dateexpected=datetime(2028, 10, 1))
238+ ... name="woody-rc1", dateexpected=datetime(2028, 10, 1))
239
240 They're ordered by dateexpected.
241
242 >>> for milestone in debian.milestones:
243- ... print('%s: %s' % (
244- ... milestone.name, milestone.dateexpected.strftime('%Y-%m-%d')))
245+ ... print("%s: %s" % (
246+ ... milestone.name, milestone.dateexpected.strftime("%Y-%m-%d")))
247 3.1: 2056-05-16
248 3.1-rc1: 2056-02-16
249 woody-rc1: 2028-10-01
250@@ -635,13 +635,13 @@ A distribution archive (primary, partner, debug or copy) can be retrieved
251 by name using IDistribution.getArchive.
252
253 >>> def display_archive(archive):
254- ... print('%s %s %s' % (
255+ ... print("%s %s %s" % (
256 ... archive.distribution.name, archive.owner.name, archive.name))
257- >>> display_archive(ubuntu.getArchive('primary'))
258+ >>> display_archive(ubuntu.getArchive("primary"))
259 ubuntu ubuntu-team primary
260- >>> display_archive(ubuntu.getArchive('partner'))
261+ >>> display_archive(ubuntu.getArchive("partner"))
262 ubuntu ubuntu-team partner
263- >>> display_archive(debian.getArchive('primary'))
264+ >>> display_archive(debian.getArchive("primary"))
265 debian mark primary
266- >>> ubuntu.getArchive('ppa')
267- >>> debian.getArchive('partner')
268+ >>> ubuntu.getArchive("ppa")
269+ >>> debian.getArchive("partner")

Subscribers

People subscribed via source and target branches

to status/vote changes: