[Docs] Fix example and param notation in reST docstrings

* For future parsing into other docstring styles.
This commit is contained in:
Calum Lind 2016-11-15 10:33:52 +00:00
parent c1249a2f3a
commit ecf9822ac0
5 changed files with 16 additions and 24 deletions

View File

@ -317,7 +317,6 @@ def fsize(fsize_b, precision=1, shortform=False):
str: A formatted string in KiB, MiB or GiB units. str: A formatted string in KiB, MiB or GiB units.
Examples: Examples:
>>> fsize(112245) >>> fsize(112245)
'109.6 KiB' '109.6 KiB'
>>> fsize(112245, precision=0) >>> fsize(112245, precision=0)
@ -554,7 +553,7 @@ def is_url(url):
:returns: True or False :returns: True or False
:rtype: bool :rtype: bool
**Usage** :Example:
>>> is_url('http://deluge-torrent.org') >>> is_url('http://deluge-torrent.org')
True True
@ -586,7 +585,7 @@ def is_magnet(uri):
:returns: True or False :returns: True or False
:rtype: bool :rtype: bool
**Usage** :Example:
>>> is_magnet('magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN') >>> is_magnet('magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN')
True True
@ -730,7 +729,7 @@ def is_ip(ip):
:returns: True or False :returns: True or False
:rtype: bool :rtype: bool
** Usage ** :Example:
>>> is_ip('127.0.0.1') >>> is_ip('127.0.0.1')
True True
@ -769,7 +768,7 @@ def decode_string(s, encoding='utf8'):
:param s: string to decode :param s: string to decode
:type s: string :type s: string
:keyword encoding: the encoding to use in the decoding :param encoding: the encoding to use in the decoding
:type encoding: string :type encoding: string
:returns: s converted to unicode :returns: s converted to unicode
:rtype: unicode :rtype: unicode
@ -802,7 +801,7 @@ def utf8_encoded(s, encoding='utf8'):
:param s: (unicode) string to (re-)encode :param s: (unicode) string to (re-)encode
:type s: basestring :type s: basestring
:keyword encoding: the encoding to use in the decoding :param encoding: the encoding to use in the decoding
:type encoding: string :type encoding: string
:returns: a utf8 encoded string of s :returns: a utf8 encoded string of s
:rtype: str :rtype: str

View File

@ -165,7 +165,6 @@ class Config(object):
currently in the config and it could not convert the value. currently in the config and it could not convert the value.
Examples: Examples:
>>> config = Config('test.conf') >>> config = Config('test.conf')
>>> config['test'] = 5 >>> config['test'] = 5
>>> config['test'] >>> config['test']
@ -239,7 +238,6 @@ class Config(object):
ValueError: If 'key' is not in the config dictionary. ValueError: If 'key' is not in the config dictionary.
Examples: Examples:
>>> config = Config('test.conf', defaults={'test': 5}) >>> config = Config('test.conf', defaults={'test': 5})
>>> config['test'] >>> config['test']
5 5
@ -267,7 +265,6 @@ class Config(object):
any: The value of item 'key' or default. any: The value of item 'key' or default.
Examples: Examples:
>>> config = Config('test.conf', defaults={'test': 5}) >>> config = Config('test.conf', defaults={'test': 5})
>>> config.get('test', 10) >>> config.get('test', 10)
5 5
@ -297,7 +294,6 @@ class Config(object):
ValueError: If 'key' is not in the config dictionary. ValueError: If 'key' is not in the config dictionary.
Examples: Examples:
>>> config = Config('test.conf', defaults={'test': 5}) >>> config = Config('test.conf', defaults={'test': 5})
>>> del config['test'] >>> del config['test']
@ -323,7 +319,6 @@ class Config(object):
callback (func): The function to call with parameters: f(key, value). callback (func): The function to call with parameters: f(key, value).
Examples: Examples:
>>> config = Config('test.conf', defaults={'test': 5}) >>> config = Config('test.conf', defaults={'test': 5})
>>> def cb(key, value): >>> def cb(key, value):
... print key, value ... print key, value
@ -342,7 +337,6 @@ class Config(object):
apply_now (bool): If True, the function will be called immediately after it's registered. apply_now (bool): If True, the function will be called immediately after it's registered.
Examples: Examples:
>>> config = Config('test.conf', defaults={'test': 5}) >>> config = Config('test.conf', defaults={'test': 5})
>>> def cb(key, value): >>> def cb(key, value):
... print key, value ... print key, value
@ -366,7 +360,6 @@ class Config(object):
"""Calls all set functions. """Calls all set functions.
Examples: Examples:
>>> config = Config('test.conf', defaults={'test': 5}) >>> config = Config('test.conf', defaults={'test': 5})
>>> def cb(key, value): >>> def cb(key, value):
... print key, value ... print key, value

View File

@ -108,7 +108,7 @@ class Auth(JSONComponent):
""" """
Creates a new session. Creates a new session.
:keyword login: the username of the user logging in, currently \ :param login: the username of the user logging in, currently \
only for future use currently. only for future use currently.
:type login: string :type login: string
""" """
@ -194,9 +194,9 @@ class Auth(JSONComponent):
:param request: The HTTP request in question :param request: The HTTP request in question
:type request: twisted.web.http.Request :type request: twisted.web.http.Request
:keyword method: Check the specified method :param method: Check the specified method
:type method: function :type method: function
:keyword level: Check the specified auth level :param level: Check the specified auth level
:type level: integer :type level: integer
:raises: Exception :raises: Exception

View File

@ -52,7 +52,7 @@ def export(auth_level=AUTH_LEVEL_DEFAULT):
:param func: the function to export :param func: the function to export
:type func: function :type func: function
:keyword auth_level: the auth level required to call this method :param auth_level: the auth level required to call this method
:type auth_level: int :type auth_level: int
""" """
@ -830,9 +830,9 @@ class WebApi(JSONComponent):
:type host: string :type host: string
:param port: the port :param port: the port
:type port: int :type port: int
:keyword username: the username to login as :param username: the username to login as
:type username: string :type username: string
:keyword password: the password to login with :param password: the password to login with
:type password: string :type password: string
""" """

View File

@ -270,7 +270,7 @@ class ScriptResource(resource.Resource, component.Component):
:type path: string :type path: string
:param filepath: The physical location of the script :param filepath: The physical location of the script
:type filepath: string :type filepath: string
:keyword script_type: The type of script to add (normal, debug, dev) :param script_type: The type of script to add (normal, debug, dev)
:param script_type: string :param script_type: string
""" """
if script_type not in ('dev', 'debug', 'normal'): if script_type not in ('dev', 'debug', 'normal'):
@ -289,9 +289,9 @@ class ScriptResource(resource.Resource, component.Component):
:type path: string :type path: string
:param filepath: The physical location of the script :param filepath: The physical location of the script
:type filepath: string :type filepath: string
:keyword script_type: The type of script to add (normal, debug, dev) :param script_type: The type of script to add (normal, debug, dev)
:param script_type: string :param script_type: string
:keyword recurse: Whether or not to recurse into other folders :param recurse: Whether or not to recurse into other folders
:param recurse: bool :param recurse: bool
""" """
if script_type not in ('dev', 'debug', 'normal'): if script_type not in ('dev', 'debug', 'normal'):
@ -308,7 +308,7 @@ class ScriptResource(resource.Resource, component.Component):
:param path: The path of the folder :param path: The path of the folder
:type path: string :type path: string
:keyword script_type: The type of script to add (normal, debug, dev) :param script_type: The type of script to add (normal, debug, dev)
:param script_type: string :param script_type: string
""" """
if script_type not in ('dev', 'debug', 'normal'): if script_type not in ('dev', 'debug', 'normal'):
@ -322,7 +322,7 @@ class ScriptResource(resource.Resource, component.Component):
Returns a list of the scripts that can be used for producing Returns a list of the scripts that can be used for producing
script tags. script tags.
:keyword script_type: The type of scripts to get (normal, debug, dev) :param script_type: The type of scripts to get (normal, debug, dev)
:param script_type: string :param script_type: string
""" """
if script_type not in ('dev', 'debug', 'normal'): if script_type not in ('dev', 'debug', 'normal'):