pop_arg "default" to default to None
- Changed the "default" arg for the pop_arg() function to default to
None.
- Also, for source_to_object() function, altered the test for
detecting special-case of collections.OrderedDict from
startswith("[") to startswith("[("). By making the test more
strict, we allow for simple lists to be processed as lists rather
than as collections.OrderedDict.
Change-Id: I4d861307653332530023d53a89d191e828aaed5c
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/func_args.py b/lib/func_args.py
index 1bff858..8f3f539 100644
--- a/lib/func_args.py
+++ b/lib/func_args.py
@@ -8,7 +8,7 @@
import collections
-def pop_arg(default, *args, **kwargs):
+def pop_arg(default=None, *args, **kwargs):
r"""
Pop a named argument from the args/kwargs and return a tuple consisting of
the argument value, the modified args and the modified kwargs.
@@ -146,8 +146,9 @@
# code.
value = value.strip()
- # Try special case of collections.OrderedDict:
- if value.startswith("["):
+ # Try special case of collections.OrderedDict which accepts a list of
+ # tuple pairs.
+ if value.startswith("[("):
try:
return eval("collections.OrderedDict(" + value + ")")
except (TypeError, NameError, ValueError):