Merge lp:~cjwatson/storm/docstring-syntax into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 557
Proposed branch: lp:~cjwatson/storm/docstring-syntax
Merge into: lp:storm
Prerequisite: lp:~cjwatson/storm/sphinx-doc
Diff against target: 366 lines (+58/-47)
10 files modified
storm/cache.py (+8/-8)
storm/database.py (+21/-10)
storm/info.py (+1/-1)
storm/references.py (+2/-2)
storm/store.py (+12/-12)
storm/testing.py (+1/-1)
storm/tracer.py (+4/-4)
storm/tz.py (+2/-2)
storm/variables.py (+1/-1)
storm/wsgi.py (+6/-6)
To merge this branch: bzr merge lp:~cjwatson/storm/docstring-syntax
Reviewer Review Type Date Requested Status
Kristian Glass (community) Approve
Ioana Lasc (community) Approve
Storm Developers Pending
Review via email: mp+384534@code.launchpad.net

Commit message

Improve various docstrings, mainly fixing reST/epytext syntax.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storm/cache.py'
2--- storm/cache.py 2019-08-11 09:48:05 +0000
3+++ storm/cache.py 2020-05-26 10:38:54 +0000
4@@ -11,7 +11,7 @@
5 This prevents recently used objects from being deallocated by Python
6 even if the user isn't holding any strong references to it. It does
7 that by holding strong references to the objects referenced by the
8- last C{N} C{obj_info}s added to it (where C{N} is the cache size).
9+ last C{N} C{obj_info}\ s added to it (where C{N} is the cache size).
10 """
11
12 def __init__(self, size=1000):
13@@ -54,7 +54,7 @@
14 def set_size(self, size):
15 """Set the maximum number of objects that may be held in this cache.
16
17- If the size is reduced, older C{obj_info}s may be dropped from
18+ If the size is reduced, older C{obj_info}\ s may be dropped from
19 the cache to respect the new size.
20 """
21 if size == 0:
22@@ -66,7 +66,7 @@
23 self._size = size
24
25 def get_cached(self):
26- """Return an ordered list of the currently cached C{obj_info}s.
27+ """Return an ordered list of the currently cached C{obj_info}\ s.
28
29 The most recently added objects come first in the list.
30 """
31@@ -103,7 +103,7 @@
32 self._old_cache = {}
33
34 def clear(self):
35- """See `storm.store.Cache.clear`.
36+ """See L{Cache.clear}.
37
38 Clears both the primary and the secondary caches.
39 """
40@@ -125,20 +125,20 @@
41 self._new_cache.clear()
42
43 def add(self, obj_info):
44- """See `storm.store.Cache.add`."""
45+ """See L{Cache.add}."""
46 if self._size != 0 and obj_info not in self._new_cache:
47 if len(self._new_cache) >= self._size:
48 self._bump_generation()
49 self._new_cache[obj_info] = obj_info.get_obj()
50
51 def remove(self, obj_info):
52- """See `storm.store.Cache.remove`."""
53+ """See L{Cache.remove}."""
54 in_new_cache = self._new_cache.pop(obj_info, None) is not None
55 in_old_cache = self._old_cache.pop(obj_info, None) is not None
56 return in_new_cache or in_old_cache
57
58 def set_size(self, size):
59- """See `storm.store.Cache.set_size`.
60+ """See L{Cache.set_size}.
61
62 After calling this, the cache may still contain more than `size`
63 objects, but no more than twice that number.
64@@ -152,7 +152,7 @@
65 self._old_cache.clear()
66
67 def get_cached(self):
68- """See `storm.store.Cache.get_cached`.
69+ """See L{Cache.get_cached}.
70
71 The result is a loosely-ordered list. Any object in the primary
72 generation comes before any object that is only in the secondary
73
74=== modified file 'storm/database.py'
75--- storm/database.py 2019-09-27 19:22:54 +0000
76+++ storm/database.py 2020-05-26 10:38:54 +0000
77@@ -377,7 +377,7 @@
78 self._check_disconnect(trace, "connection_commit", self, xid)
79
80 def recover(self):
81- """Return a list of L{Xid}s representing pending transactions."""
82+ """Return a list of L{Xid}\ s representing pending transactions."""
83 self._ensure_connected()
84 raw_xids = self._check_disconnect(self._raw_connection.tpc_recover)
85 return [Xid(raw_xid[0], raw_xid[1], raw_xid[2])
86@@ -422,8 +422,9 @@
87 It is acceptable to override this method in subclasses, but it
88 is not intended to be used externally.
89
90- This delegates conversion to any L{Variable}s in the parameter
91- list, and passes through all other values untouched.
92+ This delegates conversion to any
93+ L{Variable <storm.variable.Variable>}\ s in the parameter list, and
94+ passes through all other values untouched.
95 """
96 for param in params:
97 if isinstance(param, Variable):
98@@ -671,13 +672,23 @@
99 """Create a database instance.
100
101 @param uri: An URI instance, or a string describing the URI. Some examples:
102- - "sqlite:" An in memory sqlite database.
103- - "sqlite:example.db" A SQLite database called example.db
104- - "postgres:test" The database 'test' from the local postgres server.
105- - "postgres://user:password@host/test" The database test on machine host
106- with supplied user credentials, using postgres.
107- - "anything:..." Where 'anything' has previously been registered
108- with L{register_scheme}.
109+
110+ "sqlite:"
111+ An in memory sqlite database.
112+
113+ "sqlite:example.db"
114+ A SQLite database called example.db
115+
116+ "postgres:test"
117+ The database 'test' from the local postgres server.
118+
119+ "postgres://user:password@host/test"
120+ The database test on machine host with supplied user credentials,
121+ using postgres.
122+
123+ "anything:..."
124+ Where 'anything' has previously been registered with
125+ L{register_scheme}.
126 """
127 if isinstance(uri, six.string_types):
128 uri = URI(uri)
129
130=== modified file 'storm/info.py'
131--- storm/info.py 2019-09-17 09:35:10 +0000
132+++ storm/info.py 2020-05-26 10:38:54 +0000
133@@ -59,7 +59,7 @@
134
135
136 class ClassInfo(dict):
137- """Persistent storm-related information of a class.
138+ """Persistent Storm-related information of a class.
139
140 The following attributes are defined:
141
142
143=== modified file 'storm/references.py'
144--- storm/references.py 2020-03-18 16:50:12 +0000
145+++ storm/references.py 2020-05-26 10:38:54 +0000
146@@ -408,8 +408,8 @@
147 bar = Reference(bar_id, Bar.id)
148 bar_title = Proxy(bar, Bar.title)
149
150- For most uses, Foo.bar_title should behave as if it were
151- a native property of Foo.
152+ For most uses, C{Foo.bar_title} should behave as if it were
153+ a native property of C{Foo}.
154 """
155
156 class RemoteProp(object):
157
158=== modified file 'storm/store.py'
159--- storm/store.py 2020-04-25 16:02:54 +0000
160+++ storm/store.py 2020-05-26 10:38:54 +0000
161@@ -105,7 +105,7 @@
162 def execute(self, statement, params=None, noresult=False):
163 """Execute a basic query.
164
165- This is just like L{storm.database.Database.execute}, except
166+ This is just like L{storm.database.Connection.execute}, except
167 that a flush is performed first.
168 """
169 if self._implicit_flush_block_count == 0:
170@@ -119,16 +119,16 @@
171 def begin(self, xid):
172 """Start a new two-phase transaction.
173
174- @param xid: A L{Xid} instance holding identification data for the
175- new transaction.
176+ @param xid: A L{Xid <storm.xid.Xid>} instance holding identification
177+ data for the new transaction.
178 """
179 self._connection.begin(xid)
180
181 def prepare(self):
182 """Prepare a two-phase transaction for the final commit.
183
184- @note: It must be call inside a two-phase transaction started
185- with begin().
186+ @note: It must be called inside a two-phase transaction started
187+ with L{begin}.
188 """
189 self._connection.prepare()
190
191@@ -627,7 +627,7 @@
192 """Fill missing values in variables of the given obj_info.
193
194 This method will verify which values are unset in obj_info,
195- and set them to AutoReload, or if it's part of the primary
196+ and set them to L{AutoReload}, or if it's part of the primary
197 key, query the database for the actual values.
198
199 @param obj_info: ObjectInfo to have its values filled.
200@@ -889,7 +889,7 @@
201
202 This method is hooked into the obj_info to resolve variables
203 set to lazy values when they're accessed. It will first flush
204- the store, and then set all variables set to AutoReload to
205+ the store, and then set all variables set to L{AutoReload} to
206 their database values.
207 """
208 if lazy_value is not AutoReload and not isinstance(lazy_value, Expr):
209@@ -1083,7 +1083,7 @@
210 """Return a single item from the result set.
211
212 @return: An arbitrary object or C{None} if one isn't available.
213- @seealso: one(), first(), and last().
214+ @see: L{one}, L{first}, and L{last}.
215 """
216 select = self._get_select()
217 select.limit = 1
218@@ -1112,7 +1112,7 @@
219
220 @raises UnorderedError: Raised if the result set isn't ordered.
221 @return: The first object or C{None} if one isn't available.
222- @seealso: last(), one(), and any().
223+ @see: L{last}, L{one}, and L{any}.
224 """
225 if self._order_by is Undef:
226 raise UnorderedError("Can't use first() on unordered result set")
227@@ -1124,7 +1124,7 @@
228 @raises FeatureError: Raised if the result set has a C{LIMIT} set.
229 @raises UnorderedError: Raised if the result set isn't ordered.
230 @return: The last object or C{None} if one isn't available.
231- @seealso: first(), one(), and any().
232+ @see: L{first}, L{one}, and L{any}.
233 """
234 if self._order_by is Undef:
235 raise UnorderedError("Can't use last() on unordered result set")
236@@ -1154,7 +1154,7 @@
237 @raises NotOneError: Raised if the result set contains more than one
238 item.
239 @return: The object or C{None} if one isn't available.
240- @seealso: first(), one(), and any().
241+ @see: L{first}, L{last}, and L{any}.
242 """
243 select = self._get_select()
244 # limit could be 1 due to slicing, for instance.
245@@ -1860,7 +1860,7 @@
246
247 class block_access(object):
248 """
249- Context manager blocks database access by one or more L{Store}s in the
250+ Context manager blocks database access by one or more L{Store}\ s in the
251 managed scope.
252 """
253
254
255=== modified file 'storm/testing.py'
256--- storm/testing.py 2019-06-05 11:41:07 +0000
257+++ storm/testing.py 2020-05-26 10:38:54 +0000
258@@ -8,7 +8,7 @@
259 class CaptureTracer(BaseStatementTracer, Fixture):
260 """Trace SQL statements appending them to a C{list}.
261
262- Example:
263+ Example::
264
265 with CaptureTracer() as tracer:
266 # Run queries
267
268=== modified file 'storm/tracer.py'
269--- storm/tracer.py 2019-08-11 16:57:24 +0000
270+++ storm/tracer.py 2020-05-26 10:38:54 +0000
271@@ -94,7 +94,7 @@
272
273 def connection_raw_execute_error(self, connection, raw_cursor,
274 statement, params, error):
275- """Raise TimeoutError if the given error was a timeout issue.
276+ """Raise L{TimeoutError} if the given error was a timeout issue.
277
278 Must be specialized in the backend.
279 """
280@@ -102,7 +102,7 @@
281 "implemented" % self.__class__.__name__)
282
283 def connection_commit(self, connection, xid=None):
284- """Reset Connection._timeout_tracer_remaining_time.
285+ """Reset C{Connection._timeout_tracer_remaining_time}.
286
287 @param connection: The L{Connection} to the database.
288 @param xid: Optionally the L{Xid} of a previously prepared
289@@ -111,7 +111,7 @@
290 self._reset_timeout_tracer_remaining_time(connection)
291
292 def connection_rollback(self, connection, xid=None):
293- """Reset Connection._timeout_tracer_remaining_time.
294+ """Reset C{Connection._timeout_tracer_remaining_time}.
295
296 @param connection: The L{Connection} to the database.
297 @param xid: Optionally the L{Xid} of a previously prepared
298@@ -197,7 +197,7 @@
299 """Storm tracer class to insert executed statements into a L{Timeline}.
300
301 For more information on timelines see the module at
302- http://pypi.python.org/pypi/timeline.
303+ U{https://pypi.org/project/timeline/}.
304
305 The timeline to use is obtained by calling the timeline_factory supplied to
306 the constructor. This simple function takes no parameters and returns a
307
308=== modified file 'storm/tz.py'
309--- storm/tz.py 2019-09-17 09:35:10 +0000
310+++ storm/tz.py 2020-05-26 10:38:54 +0000
311@@ -1,6 +1,6 @@
312+# Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net>
313+
314 """
315-Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net>
316-
317 This module offers extensions to the standard python 2.3+
318 datetime module.
319 """
320
321=== modified file 'storm/variables.py'
322--- storm/variables.py 2020-02-10 15:30:23 +0000
323+++ storm/variables.py 2020-05-26 10:38:54 +0000
324@@ -133,7 +133,7 @@
325 @type column: L{storm.expr.Column}
326 @param column: The column that this variable represents. It's
327 used for reporting better error messages.
328- @type event: L{EventSystem}
329+ @type event: L{storm.event.EventSystem}
330 @param event: The event system to broadcast messages with. If
331 not specified, then no events will be broadcast.
332 """
333
334=== modified file 'storm/wsgi.py'
335--- storm/wsgi.py 2019-06-05 11:41:07 +0000
336+++ storm/wsgi.py 2020-05-26 10:38:54 +0000
337@@ -29,23 +29,23 @@
338 __all__ = ['make_app']
339
340 def make_app(app):
341- """Capture the per-request timeline object needed for storm tracing.
342+ """Capture the per-request timeline object needed for Storm tracing.
343
344- To use firstly make your app and then wrap it with this make_app::
345+ To use firstly make your app and then wrap it with this C{make_app}::
346
347 >>> app, find_timeline = make_app(app)
348
349- Then wrap the returned app with the timeline app (or anything that sets
350- environ['timeline.timeline'])::
351+ Then wrap the returned app with the C{timeline} app (or anything that
352+ sets C{environ['timeline.timeline']})::
353
354 >>> app = timeline.wsgi.make_app(app)
355
356- Finally install a timeline tracer to capture storm queries::
357+ Finally install a timeline tracer to capture Storm queries::
358
359 >>> install_tracer(TimelineTracer(find_timeline))
360
361 @return: A wrapped WSGI app and a timeline factory function for use with
362- TimelineTracer.
363+ L{TimelineTracer <storm.tracer.TimelineTracer>}.
364 """
365 timeline_map = threading.local()
366 def wrapper(environ, start_response):

Subscribers

People subscribed via source and target branches

to status/vote changes: