Skip to content

Commit f6b3651

Browse files
committed
More autodoc fixes
1 parent 050797c commit f6b3651

File tree

14 files changed

+43
-19
lines changed

14 files changed

+43
-19
lines changed

tornado/escape.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,15 @@ def linkify(text, shorten=False, extra_params="",
211211
Hello <a href="http://tornadoweb.org">http://tornadoweb.org</a>!
212212
213213
Parameters:
214+
214215
shorten: Long urls will be shortened for display.
216+
215217
extra_params: Extra text to include in the link tag,
216218
e.g. linkify(text, extra_params='rel="nofollow" class="external"')
219+
217220
require_protocol: Only linkify urls which include a protocol. If this is
218221
False, urls such as www.facebook.com will also be linkified.
222+
219223
permitted_protocols: List (or set) of protocols which should be linkified,
220224
e.g. linkify(text, permitted_protocols=["http", "ftp", "mailto"]).
221225
It is very unsafe to include protocols such as "javascript".

tornado/httpclient.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class HTTPClient(object):
1414
"""A blocking HTTP client.
1515
16-
Typical usage looks like this:
16+
Typical usage looks like this::
1717
1818
http_client = httpclient.HTTPClient()
1919
try:
@@ -51,7 +51,7 @@ def callback(response):
5151
class AsyncHTTPClient(object):
5252
"""An non-blocking HTTP client.
5353
54-
Example usage:
54+
Example usage::
5555
5656
import ioloop
5757
@@ -208,13 +208,21 @@ class HTTPResponse(object):
208208
"""HTTP Response object.
209209
210210
Attributes:
211+
211212
* request: HTTPRequest object
213+
212214
* code: numeric HTTP status code, e.g. 200 or 404
215+
213216
* headers: httputil.HTTPHeaders object
217+
214218
* buffer: cStringIO object for response body
219+
215220
* body: respose body as string (created on demand from self.buffer)
221+
216222
* error: Exception object, if any
223+
217224
* request_time: seconds from request start to finish
225+
218226
* time_info: dictionary of diagnostic timing information from the request.
219227
Available data are subject to change, but currently uses timings
220228
available from http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html,
@@ -266,8 +274,10 @@ class HTTPError(Exception):
266274
"""Exception thrown for an unsuccessful HTTP request.
267275
268276
Attributes:
277+
269278
code - HTTP error integer error code, e.g. 404. Error code 599 is
270279
used when no HTTP response was received, e.g. for a timeout.
280+
271281
response - HTTPResponse object, if any.
272282
273283
Note that if follow_redirects is False, redirects become HTTPErrors,

tornado/httpserver.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ def _cpu_count():
6464

6565

6666
class HTTPServer(object):
67-
"""A non-blocking, single-threaded HTTP server.
67+
r"""A non-blocking, single-threaded HTTP server.
6868
6969
A server is defined by a request callback that takes an HTTPRequest
7070
instance as an argument and writes a valid HTTP response with
7171
request.write(). request.finish() finishes the request (but does not
7272
necessarily close the connection in the case of HTTP/1.1 keep-alive
7373
requests). A simple example server that echoes back the URI you
74-
requested:
74+
requested::
7575
7676
import httpserver
7777
import ioloop
@@ -105,7 +105,7 @@ def handle_request(request):
105105
HTTPServer can serve HTTPS (SSL) traffic with Python 2.6+ and OpenSSL.
106106
To make this server serve SSL traffic, send the ssl_options dictionary
107107
argument with the arguments required for the ssl.wrap_socket() method,
108-
including "certfile" and "keyfile":
108+
including "certfile" and "keyfile"::
109109
110110
HTTPServer(applicaton, ssl_options={
111111
"certfile": os.path.join(data_dir, "mydomain.crt"),
@@ -114,7 +114,7 @@ def handle_request(request):
114114
115115
By default, listen() runs in a single thread in a single process. You
116116
can utilize all available CPUs on this machine by calling bind() and
117-
start() instead of listen():
117+
start() instead of listen()::
118118
119119
http_server = httpserver.HTTPServer(handle_request)
120120
http_server.bind(8888)
@@ -503,7 +503,8 @@ def get_ssl_certificate(self):
503503
"""Returns the client's SSL certificate, if any.
504504
505505
To use client certificates, the HTTPServer must have been constructed
506-
with cert_reqs set in ssl_options, e.g.:
506+
with cert_reqs set in ssl_options, e.g.::
507+
507508
server = HTTPServer(app,
508509
ssl_options=dict(
509510
certfile="foo.crt",

tornado/ioloop.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class IOLoop(object):
4949
connections, you should use Linux and either compile our epoll module or
5050
use Python 2.6+ to get epoll support.
5151
52-
Example usage for a simple TCP server:
52+
Example usage for a simple TCP server::
5353
5454
import errno
5555
import functools
@@ -132,7 +132,7 @@ def instance(cls):
132132
133133
A common pattern for classes that depend on IOLoops is to use
134134
a default argument to enable programs with multiple IOLoops
135-
but not require the argument for simpler applications:
135+
but not require the argument for simpler applications::
136136
137137
class MyClass(object):
138138
def __init__(self, io_loop=None):
@@ -296,10 +296,12 @@ def stop(self):
296296
will return immediately.
297297
298298
To use asynchronous methods from otherwise-synchronous code (such as
299-
unit tests), you can start and stop the event loop like this:
299+
unit tests), you can start and stop the event loop like this::
300+
300301
ioloop = IOLoop()
301302
async_method(ioloop=ioloop, callback=ioloop.stop)
302303
ioloop.start()
304+
303305
ioloop.start() will return after async_method has run its callback,
304306
whether that callback was invoked before or after ioloop.start.
305307
"""

tornado/iostream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
ssl = None
3535

3636
class IOStream(object):
37-
"""A utility class to write to and read from a non-blocking socket.
37+
r"""A utility class to write to and read from a non-blocking socket.
3838
3939
We support three methods: write(), read_until(), and read_bytes().
4040
All of the methods take callbacks (since writing and reading are
@@ -48,7 +48,7 @@ class IOStream(object):
4848
and may either be connected before passing it to the IOStream or
4949
connected with IOStream.connect.
5050
51-
A very simple (and broken) HTTP client using this class:
51+
A very simple (and broken) HTTP client using this class::
5252
5353
from tornado import ioloop
5454
from tornado import iostream

tornado/locale.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
"""Translation methods for generating localized strings.
1818
19-
To load a locale and generate a translated string:
19+
To load a locale and generate a translated string::
2020
2121
user_locale = locale.get("es_LA")
2222
print user_locale.translate("Sign out")
2323
2424
locale.get() returns the closest matching locale, not necessarily the
2525
specific locale you requested. You can support pluralization with
26-
additional arguments to translate(), e.g.:
26+
additional arguments to translate(), e.g.::
2727
2828
people = [...]
2929
message = user_locale.translate(

tornado/template.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
"""A simple template system that compiles templates to Python code.
1818
19-
Basic usage looks like:
19+
Basic usage looks like::
2020
2121
t = template.Template("<html>{{ myvalue }}</html>")
2222
print t.generate(myvalue="XXX")
2323
2424
Loader is a class that loads templates from a root directory and caches
25-
the compiled templates:
25+
the compiled templates::
2626
2727
loader = template.Loader("/home/btaylor")
2828
print loader.load("test.html").generate(myvalue="XXX")
2929
3030
We compile all templates to raw Python. Error-reporting is currently... uh,
31-
interesting. Syntax for the templates
31+
interesting. Syntax for the templates::
3232
3333
### base.html
3434
<html>
@@ -57,15 +57,15 @@
5757
5858
Unlike most other template systems, we do not put any restrictions on the
5959
expressions you can include in your statements. if and for blocks get
60-
translated exactly into Python, do you can do complex expressions like:
60+
translated exactly into Python, do you can do complex expressions like::
6161
6262
{% for student in [p for p in people if p.student and p.age > 23] %}
6363
<li>{{ escape(student.name) }}</li>
6464
{% end %}
6565
6666
Translating directly to Python means you can apply functions to expressions
6767
easily, like the escape() function in the examples above. You can pass
68-
functions in to your template just like any other variable:
68+
functions in to your template just like any other variable::
6969
7070
### Python code
7171
def add(x, y):

website/sphinx/escape.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.escape
5+
:members:

website/sphinx/httpclient.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.httpclient
5+
:members:

website/sphinx/httpserver.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.httpserver
5+
:members:

website/sphinx/ioloop.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.ioloop
5+
:members:

website/sphinx/iostream.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.iostream
5+
:members:

website/sphinx/locale.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.locale
5+
:members:

website/sphinx/template.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
======================
33

44
.. automodule:: tornado.template
5+
:members:

0 commit comments

Comments
 (0)