Set pbr 'warnerrors' option for doc build

By setting this pbr option in setup.cfg, the doc build will fail in case
of any warnings or errors occur during the build process. To be able to
turn on this setting, the current formatting errors were fixed.

Change-Id: Iec3f70eeb56c4652c2171e5f58c433f1434e6be1
This commit is contained in:
Ildiko 2014-06-06 11:37:39 +02:00
parent ad3c887fbf
commit 39625e18b2
8 changed files with 94 additions and 94 deletions

View File

@ -26,9 +26,9 @@ class BaseCache(object):
:params parsed_url: Parsed url object.
:params options: A dictionary with configuration parameters
for the cache. For example:
- default_ttl: An integer defining the default ttl
for keys.
for the cache. For example:
- default_ttl: An integer defining the default ttl for keys.
"""
def __init__(self, parsed_url, options=None):
@ -43,20 +43,17 @@ class BaseCache(object):
def set(self, key, value, ttl, not_exists=False):
"""Sets or updates a cache entry
NOTE: Thread-safety is required and has to be
guaranteed by the backend implementation.
.. note:: Thread-safety is required and has to be guaranteed by the
backend implementation.
:params key: Item key as string.
:type key: `unicode string`
:params value: Value to assign to the key. This
can be anything that is handled
by the current backend.
:params ttl: Key's timeout in seconds. 0 means
no timeout.
:params value: Value to assign to the key. This can be anything that
is handled by the current backend.
:params ttl: Key's timeout in seconds. 0 means no timeout.
:type ttl: int
:params not_exists: If True, the key will be set
if it doesn't exist. Otherwise,
it'll always be set.
:params not_exists: If True, the key will be set if it doesn't exist.
Otherwise, it'll always be set.
:type not_exists: bool
:returns: True if the operation succeeds, False otherwise.
@ -74,9 +71,8 @@ class BaseCache(object):
:params key: Item key as string.
:type key: `unicode string`
:params value: Value to assign to the key. This
can be anything that is handled
by the current backend.
:params value: Value to assign to the key. This can be anything that
is handled by the current backend.
"""
try:
return self[key]
@ -91,15 +87,14 @@ class BaseCache(object):
def get(self, key, default=None):
"""Gets one item from the cache
NOTE: Thread-safety is required and it has to be
guaranteed by the backend implementation.
.. note:: Thread-safety is required and it has to be guaranteed
by the backend implementation.
:params key: Key for the item to retrieve
from the cache.
:params key: Key for the item to retrieve from the cache.
:params default: The default value to return.
:returns: `key`'s value in the cache if it exists,
otherwise `default` should be returned.
:returns: `key`'s value in the cache if it exists, otherwise
`default` should be returned.
"""
return self._get(key, default)
@ -115,8 +110,8 @@ class BaseCache(object):
def __delitem__(self, key):
"""Removes an item from cache.
NOTE: Thread-safety is required and it has to be
guaranteed by the backend implementation.
.. note:: Thread-safety is required and it has to be guaranteed by
the backend implementation.
:params key: The key to remove.
@ -130,8 +125,8 @@ class BaseCache(object):
def clear(self):
"""Removes all items from the cache.
NOTE: Thread-safety is required and it has to be
guaranteed by the backend implementation.
.. note:: Thread-safety is required and it has to be guaranteed by
the backend implementation.
"""
return self._clear()
@ -143,9 +138,8 @@ class BaseCache(object):
"""Increments the value for a key
:params key: The key for the value to be incremented
:params delta: Number of units by which to increment
the value. Pass a negative number to
decrement the value.
:params delta: Number of units by which to increment the value.
Pass a negative number to decrement the value.
:returns: The new value
"""
@ -158,10 +152,8 @@ class BaseCache(object):
def append_tail(self, key, tail):
"""Appends `tail` to `key`'s value.
:params key: The key of the value to which
`tail` should be appended.
:params tail: The list of values to append to the
original.
:params key: The key of the value to which `tail` should be appended.
:params tail: The list of values to append to the original.
:returns: The new value
"""
@ -181,10 +173,8 @@ class BaseCache(object):
def append(self, key, value):
"""Appends `value` to `key`'s value.
:params key: The key of the value to which
`tail` should be appended.
:params value: The value to append to the
original.
:params key: The key of the value to which `tail` should be appended.
:params value: The value to append to the original.
:returns: The new value
"""
@ -196,8 +186,7 @@ class BaseCache(object):
:params key: The key to verify.
:returns: True if the key exists,
otherwise False.
:returns: True if the key exists, otherwise False.
"""
@abc.abstractmethod
@ -209,9 +198,8 @@ class BaseCache(object):
"""Gets keys' value from cache
:params keys: List of keys to retrieve.
:params default: The default value to return
for each key that is not in
the cache.
:params default: The default value to return for each key that is not
in the cache.
:returns: A generator of (key, value)
"""
@ -227,13 +215,12 @@ class BaseCache(object):
def set_many(self, data, ttl=None):
"""Puts several items into the cache at once
Depending on the backend, this operation may or may
not be efficient. The default implementation calls
set for each (key, value) pair passed, other backends
support set_many operations as part of their protocols.
Depending on the backend, this operation may or may not be efficient.
The default implementation calls set for each (key, value) pair
passed, other backends support set_many operations as part of their
protocols.
:params data: A dictionary like {key: val} to store
in the cache.
:params data: A dictionary like {key: val} to store in the cache.
:params ttl: Key's timeout in seconds.
"""

View File

@ -223,6 +223,8 @@ def find_resource(manager, name_or_id, **find_args):
Used as a helper for the _find_* methods.
Example:
.. code-block:: python
def _find_hypervisor(cs, hypervisor):
#Get a hypervisor by name or ID.
return cliutils.find_resource(cs.hypervisors, hypervisor)
@ -287,9 +289,12 @@ def service_type(stype):
"""Adds 'service_type' attribute to decorated function.
Usage:
@service_type('volume')
def mymethod(f):
...
.. code-block:: python
@service_type('volume')
def mymethod(f):
...
"""
def inner(f):
f.service_type = stype

View File

@ -25,21 +25,25 @@ Hooks.
Example Hook object:
class MyHook(object):
def pre(self, *args, **kwargs):
# do stuff before wrapped callable runs
.. code-block:: python
def post(self, rv, *args, **kwargs):
# do stuff after wrapped callable runs
class MyHook(object):
def pre(self, *args, **kwargs):
# do stuff before wrapped callable runs
def post(self, rv, *args, **kwargs):
# do stuff after wrapped callable runs
Example Hook object with function parameters:
class MyHookWithFunction(object):
def pre(self, f, *args, **kwargs):
# do stuff with wrapped function info
def post(self, f, *args, **kwards):
# do stuff with wrapped function info
.. code-block:: python
class MyHookWithFunction(object):
def pre(self, f, *args, **kwargs):
# do stuff with wrapped function info
def post(self, f, *args, **kwards):
# do stuff with wrapped function info
"""
import functools

View File

@ -113,14 +113,13 @@ def set_tcp_keepalive(sock, tcp_keepalive=True,
This function configures tcp keepalive parameters if users wish to do
so.
:param tcp_keepalive: Boolean, turn on or off tcp_keepalive. If users are
not sure, this should be True, and default values will be used.
:param tcp_keepidle: time to wait before starting to send keepalive probes
:param tcp_keepalive_interval: time between successive probes, once the
initial wait time is over
:param tcp_keepalive_count: number of probes to send before the connection
is killed
"""

View File

@ -14,9 +14,9 @@
"""Provides Report classes
This module defines various classes representing
reports and report sections. All reports take the
form of a report class containing various report sections.
This module defines various classes representing reports and report sections.
All reports take the form of a report class containing various report
sections.
"""
from openstack.common.report.views.text import header as header_views
@ -28,7 +28,7 @@ class BasicReport(object):
A Basic Report consists of a collection of :class:`ReportSection`
objects, each of which contains a top-level model and generator.
It collects these sections into a cohesive report which may then
be serialized by calling :func:`run`
be serialized by calling :func:`run`.
"""
def __init__(self):
@ -78,10 +78,9 @@ class BasicReport(object):
class ReportSection(object):
"""A Report Section
A report section contains a generator and a top-level view.
When something attempts to serialize the section by calling
str() on it, the section runs the generator and calls the view
on the resulting model.
A report section contains a generator and a top-level view. When something
attempts to serialize the section by calling str() on it, the section runs
the generator and calls the view on the resulting model.
.. seealso::
@ -90,8 +89,7 @@ class ReportSection(object):
:param view: the top-level view for this section
:param generator: the generator for this section
(any callable object which takes
no parameters and returns a data model)
(any callable object which takes no parameters and returns a data model)
"""
def __init__(self, view, generator):

View File

@ -27,24 +27,24 @@ LOG = logging.getLogger(__name__)
def link_request_ids(context, source_id, target_id=None, stage=None,
target_name=None, notifier=None):
"""Links the Request ID from the Source service to
the Request ID returned from the Target service.
"""Links the Request ID from the Source service to the Request ID returned
from the Target service.
Linkages are logged and emitted as INFO notifications.
Linkages are logged and emitted as INFO notifications.
:params context: context object
:params source_id: the Request ID of the source
:params target_id: the Request ID of the target
:params stage: optional event name extension to
indicate which part of the linkage
this is.
:params target_name: human readable name of the
target system you are talking to.
:params notifier: notifier object
:params context: context object
:params source_id: the Request ID of the source
:params target_id: the Request ID of the target
:params stage: optional event name extension to indicate which part of the
linkage this is.
:params target_name: human readable name of the target system you are
talking to.
:params notifier: notifier object
A typical use case is: System A asking System B
to perform some action. The linkages might look
like this:
A typical use case is: System A asking System B to perform some action. The
linkages might look like this:
.. code-block:: python
link_request_ids(sys_A.request_ID, stage="start")
# send request to System B and get request ID
@ -53,7 +53,10 @@ def link_request_ids(context, source_id, target_id=None, stage=None,
link_request_ids(sys_A.request_ID, target_id=sys_B.request.ID,
stage="end")
But, it could be as simple as:
But, it could be as simple as:
.. code-block:: python
link_request_ids(sys_A.request_ID, target_id=sys_B.request.ID)
"""

View File

@ -25,13 +25,14 @@ class IgnoreAttemptedHostsFilter(filters.BaseHostFilter):
A host passes this filter if it has not already been attempted for
scheduling. The scheduler needs to add previously attempted hosts
to the 'retry' key of filter_properties in order for this to work
correctly. For example:
{
'retry': {
correctly. For example::
{
'retry': {
'hosts': ['host1', 'host2'],
'num_attempts': 3,
}
}
}
}
"""
def host_passes(self, host_state, filter_properties):

View File

@ -67,3 +67,6 @@ all_files = 1
[upload_sphinx]
upload-dir = doc/build/html
[pbr]
warnerrors = true