Fix docstring formatting errors

This commit is contained in:
Cadel Watson
2017-03-16 16:52:18 +11:00
parent 24f745a334
commit d713533d26
4 changed files with 16 additions and 18 deletions

View File

@@ -251,8 +251,7 @@ def text(body, status=200, headers=None,
:param body: Response data to be encoded.
:param status: Response code.
:param headers: Custom Headers.
:param content_type:
the content type (string) of the response
:param content_type: the content type (string) of the response
"""
return HTTPResponse(
body, status=status, headers=headers,
@@ -266,8 +265,7 @@ def raw(body, status=200, headers=None,
:param body: Response data.
:param status: Response code.
:param headers: Custom Headers.
:param content_type:
the content type (string) of the response
:param content_type: the content type (string) of the response.
"""
return HTTPResponse(body_bytes=body, status=status, headers=headers,
content_type=content_type)
@@ -316,17 +314,16 @@ def stream(
content_type="text/plain; charset=utf-8"):
"""Accepts an coroutine `streaming_fn` which can be used to
write chunks to a streaming response. Returns a `StreamingHTTPResponse`.
Example usage:
```
@app.route("/")
async def index(request):
async def streaming_fn(response):
await response.write('foo')
await response.write('bar')
Example usage::
return stream(streaming_fn, content_type='text/plain')
```
@app.route("/")
async def index(request):
async def streaming_fn(response):
await response.write('foo')
await response.write('bar')
return stream(streaming_fn, content_type='text/plain')
:param streaming_fn: A coroutine accepts a response and
writes content to that response.