diff --git a/openstackclient/common/commandmanager.py b/openstackclient/common/commandmanager.py index aa238a23f0..08710c7735 100644 --- a/openstackclient/common/commandmanager.py +++ b/openstackclient/common/commandmanager.py @@ -13,7 +13,7 @@ # under the License. # -"""Modify Cliff's CommandManager""" +"""Modify cliff.CommandManager""" import logging import pkg_resources @@ -25,9 +25,12 @@ LOG = logging.getLogger(__name__) class CommandManager(cliff.commandmanager.CommandManager): - """Alters Cliff's default CommandManager behaviour to load additional - command groups after initialization. + """Add additional functionality to cliff.CommandManager + + Load additional command groups after initialization + Add *_command_group() methods """ + def __init__(self, namespace, convert_underscores=True): self.group_list = [] super(CommandManager, self).__init__(namespace, convert_underscores) diff --git a/openstackclient/common/parseractions.py b/openstackclient/common/parseractions.py index 644472d88e..8f6008e26b 100644 --- a/openstackclient/common/parseractions.py +++ b/openstackclient/common/parseractions.py @@ -19,9 +19,11 @@ import argparse class KeyValueAction(argparse.Action): - """A custom action to parse arguments as key=value pairs. - Ensures that dest is a dict + """A custom action to parse arguments as key=value pairs + + Ensures that ``dest`` is a dict """ + def __call__(self, parser, namespace, values, option_string=None): # Make sure we have an empty dict rather than None if getattr(namespace, self.dest, None) is None: @@ -35,7 +37,14 @@ class KeyValueAction(argparse.Action): class RangeAction(argparse.Action): - """A custom action to parse a single value or a range of values.""" + """A custom action to parse a single value or a range of values + + Parses single integer values or a range of integer values delimited + by a colon and returns a tuple of integers: + '4' sets ``dest`` to (4, 4) + '6:9' sets ``dest`` to (6, 9) + """ + def __call__(self, parser, namespace, values, option_string=None): range = values.split(':') if len(range) == 0: diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 67eaca55e6..6aae1a682e 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -330,9 +330,8 @@ class OpenStackShell(app.App): return parser def authenticate_user(self): - """Make sure the user has provided all of the authentication - info we need. - """ + """Verify the required authentication credentials are present""" + self.log.debug('validating authentication options') if self.options.os_token or self.options.os_url: # Token flow auth takes priority diff --git a/openstackclient/tests/utils.py b/openstackclient/tests/utils.py index ff7d8a336d..48385d138a 100644 --- a/openstackclient/tests/utils.py +++ b/openstackclient/tests/utils.py @@ -41,9 +41,8 @@ class TestCase(testtools.TestCase): if tuple(sys.version_info)[0:2] < (2, 7): def assertIsInstance(self, obj, cls, msg=None): - """Same as self.assertTrue(isinstance(obj, cls)), with a nicer - default message - """ + """self.assertTrue(isinstance(obj, cls)), with a nicer message""" + if not isinstance(obj, cls): standardMsg = '%s is not an instance of %r' % (obj, cls) self.fail(self._formatMessage(msg, standardMsg)) diff --git a/tox.ini b/tox.ini index c646457ff7..95f00cdf8d 100644 --- a/tox.ini +++ b/tox.ini @@ -28,6 +28,6 @@ commands= python setup.py build_sphinx [flake8] -ignore = E126,E202,W602,H302,H402,E265,H305,H307,H405,H904 +ignore = E126,E202,W602,H302,H402,E265,H305,H307,H904 show-source = True exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools