Fix PEP8 H405 errors
Change-Id: Id9ea03e7d88148f84bffe1b18b5b4315e6123012
This commit is contained in:
parent
8f59524c3e
commit
a78d75f290
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
"""Modify Cliff's CommandManager"""
|
"""Modify cliff.CommandManager"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
@ -25,9 +25,12 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class CommandManager(cliff.commandmanager.CommandManager):
|
class CommandManager(cliff.commandmanager.CommandManager):
|
||||||
"""Alters Cliff's default CommandManager behaviour to load additional
|
"""Add additional functionality to cliff.CommandManager
|
||||||
command groups after initialization.
|
|
||||||
|
Load additional command groups after initialization
|
||||||
|
Add *_command_group() methods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, namespace, convert_underscores=True):
|
def __init__(self, namespace, convert_underscores=True):
|
||||||
self.group_list = []
|
self.group_list = []
|
||||||
super(CommandManager, self).__init__(namespace, convert_underscores)
|
super(CommandManager, self).__init__(namespace, convert_underscores)
|
||||||
|
@ -19,9 +19,11 @@ import argparse
|
|||||||
|
|
||||||
|
|
||||||
class KeyValueAction(argparse.Action):
|
class KeyValueAction(argparse.Action):
|
||||||
"""A custom action to parse arguments as key=value pairs.
|
"""A custom action to parse arguments as key=value pairs
|
||||||
Ensures that dest is a dict
|
|
||||||
|
Ensures that ``dest`` is a dict
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __call__(self, parser, namespace, values, option_string=None):
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
# Make sure we have an empty dict rather than None
|
# Make sure we have an empty dict rather than None
|
||||||
if getattr(namespace, self.dest, None) is None:
|
if getattr(namespace, self.dest, None) is None:
|
||||||
@ -35,7 +37,14 @@ class KeyValueAction(argparse.Action):
|
|||||||
|
|
||||||
|
|
||||||
class RangeAction(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):
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
range = values.split(':')
|
range = values.split(':')
|
||||||
if len(range) == 0:
|
if len(range) == 0:
|
||||||
|
@ -330,9 +330,8 @@ class OpenStackShell(app.App):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def authenticate_user(self):
|
def authenticate_user(self):
|
||||||
"""Make sure the user has provided all of the authentication
|
"""Verify the required authentication credentials are present"""
|
||||||
info we need.
|
|
||||||
"""
|
|
||||||
self.log.debug('validating authentication options')
|
self.log.debug('validating authentication options')
|
||||||
if self.options.os_token or self.options.os_url:
|
if self.options.os_token or self.options.os_url:
|
||||||
# Token flow auth takes priority
|
# Token flow auth takes priority
|
||||||
|
@ -41,9 +41,8 @@ class TestCase(testtools.TestCase):
|
|||||||
if tuple(sys.version_info)[0:2] < (2, 7):
|
if tuple(sys.version_info)[0:2] < (2, 7):
|
||||||
|
|
||||||
def assertIsInstance(self, obj, cls, msg=None):
|
def assertIsInstance(self, obj, cls, msg=None):
|
||||||
"""Same as self.assertTrue(isinstance(obj, cls)), with a nicer
|
"""self.assertTrue(isinstance(obj, cls)), with a nicer message"""
|
||||||
default message
|
|
||||||
"""
|
|
||||||
if not isinstance(obj, cls):
|
if not isinstance(obj, cls):
|
||||||
standardMsg = '%s is not an instance of %r' % (obj, cls)
|
standardMsg = '%s is not an instance of %r' % (obj, cls)
|
||||||
self.fail(self._formatMessage(msg, standardMsg))
|
self.fail(self._formatMessage(msg, standardMsg))
|
||||||
|
2
tox.ini
2
tox.ini
@ -28,6 +28,6 @@ commands=
|
|||||||
python setup.py build_sphinx
|
python setup.py build_sphinx
|
||||||
|
|
||||||
[flake8]
|
[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
|
show-source = True
|
||||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||||
|
Loading…
Reference in New Issue
Block a user