diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2014-06-26 17:06:38 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2014-06-27 09:12:38 -0500 |
| commit | a78d75f290278501b5d8130dc58420952a13e1a1 (patch) | |
| tree | 71d8a88c05dfa2cb418425fe0c28b0065007e999 /openstackclient/common/parseractions.py | |
| parent | 8f59524c3e1ff3f34474d0cfcd217bc9fe0cbfc1 (diff) | |
| download | python-openstackclient-a78d75f290278501b5d8130dc58420952a13e1a1.tar.gz | |
Fix PEP8 H405 errors
Change-Id: Id9ea03e7d88148f84bffe1b18b5b4315e6123012
Diffstat (limited to 'openstackclient/common/parseractions.py')
| -rw-r--r-- | openstackclient/common/parseractions.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/openstackclient/common/parseractions.py b/openstackclient/common/parseractions.py index 644472d8..8f6008e2 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: |
