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

@ -305,7 +305,7 @@ class Sanic:
the output URL's query string. the output URL's query string.
:param view_name: string referencing the view name :param view_name: string referencing the view name
:param **kwargs: keys and values that are used to build request :param \*\*kwargs: keys and values that are used to build request
parameters and query string arguments. parameters and query string arguments.
:return: the built URL :return: the built URL

View File

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

View File

@ -75,9 +75,10 @@ class Router:
"""Parse a parameter string into its constituent name, type, and """Parse a parameter string into its constituent name, type, and
pattern pattern
For example: For example::
`parse_parameter_string('<param_one:[A-z]>')` ->
('param_one', str, '[A-z]') parse_parameter_string('<param_one:[A-z]>')` ->
('param_one', str, '[A-z]')
:param parameter_string: String to parse :param parameter_string: String to parse
:return: tuple containing :return: tuple containing

View File

@ -329,7 +329,7 @@ def serve(host, port, request_handler, error_handler, before_start=None,
`app` instance and `loop` `app` instance and `loop`
:param after_stop: function to be executed when a stop signal is :param after_stop: function to be executed when a stop signal is
received after it is respected. Takes arguments received after it is respected. Takes arguments
`app` instance and `loop` `app` instance and `loop`
:param debug: enables debug output (slows server) :param debug: enables debug output (slows server)
:param request_timeout: time in seconds :param request_timeout: time in seconds
:param ssl: SSLContext :param ssl: SSLContext