Fix 'code-block' tag format issues

Modify 'code-block' tag format so that the following python code
could be showed exactly, and reformat the more than 79 chars of lines.

Change-Id: Ic6721e4cc8f4c7a3e4a7c7dbd63d9089180cdc33
This commit is contained in:
Rui Chen 2016-02-29 15:48:43 +08:00
parent fa998d641d
commit c832e2a771
2 changed files with 17 additions and 15 deletions

View File

@ -27,10 +27,10 @@ prepended (such as in the traditional GNU option usage) like `--share` and
In order to handle those APIs that behave differently when a field is set to In order to handle those APIs that behave differently when a field is set to
`None` and when the field is not present in a passed argument list or dict, `None` and when the field is not present in a passed argument list or dict,
each of the boolean options shall set its own variable to `True` as part of each of the boolean options shall set its own variable to `True` as part of
a mutiually exclusive group, rather than the more common configuration of setting a a mutiually exclusive group, rather than the more common configuration of
single destination variable `True` or `False` directly. This allows us to setting a single destination variable `True` or `False` directly. This allows
detect the situation when neither option is present (both variables will be us to detect the situation when neither option is present (both variables will
`False`) and act accordingly for those APIs where this matters. be `False`) and act accordingly for those APIs where this matters.
This also requires that each of the boolean values be tested in the This also requires that each of the boolean values be tested in the
`take_action()` method to correctly set (or not) the underlying API field `take_action()` method to correctly set (or not) the underlying API field
@ -47,9 +47,9 @@ values.
Implementation Implementation
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
The parser declaration should look like this:: The parser declaration should look like this:
.. code-block: python .. code-block:: python
enable_group = parser.add_mutually_exclusive_group() enable_group = parser.add_mutually_exclusive_group()
enable_group.add_argument( enable_group.add_argument(
@ -63,7 +63,9 @@ The parser declaration should look like this::
help=_('Disable <resource>'), help=_('Disable <resource>'),
) )
An example handler in `take_action()`:: An example handler in `take_action()`:
.. code-block:: python
# This leaves 'enabled' undefined if neither option is present # This leaves 'enabled' undefined if neither option is present
if parsed_args.enable: if parsed_args.enable:
@ -88,9 +90,9 @@ commands should allow `--long` even if they return all fields by default.
Implementation Implementation
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
The parser declaration should look like this:: The parser declaration should look like this:
.. code-block: python .. code-block:: python
parser.add_argument( parser.add_argument(
'--long', '--long',
@ -102,9 +104,9 @@ The parser declaration should look like this::
Pagination Pagination
---------- ----------
There are many ways to do pagination, some OpenStack APIs support it, some don't. There are many ways to do pagination, some OpenStack APIs support it, some
OpenStackClient attempts to define a single common way to specify pagination on don't. OpenStackClient attempts to define a single common way to specify
the command line. pagination on the command line.
.. option:: --marker <marker> .. option:: --marker <marker>
@ -117,9 +119,9 @@ the command line.
Implementation Implementation
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
The parser declaration should look like this:: The parser declaration should look like this:
.. code-block: python .. code-block:: python
parser.add_argument( parser.add_argument(
"--marker", "--marker",

View File

@ -34,7 +34,7 @@ deprecation message as a warning to the user then calls the original class.
Example Deprecation Class Example Deprecation Class
------------------------- -------------------------
.. code-block: python .. code-block:: python
class ListFooOld(ListFoo): class ListFooOld(ListFoo):
"""List resources""" """List resources"""