From 88ab35529b5be85654b4b00cd558bc083b692df4 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 7 Feb 2018 13:59:23 -0800 Subject: fixup! mpm: Fixup for argument parsing in N310 --- mpm/python/usrp_mpm/mpmutils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mpm/python') diff --git a/mpm/python/usrp_mpm/mpmutils.py b/mpm/python/usrp_mpm/mpmutils.py index 08eb54798..1e4f49b54 100644 --- a/mpm/python/usrp_mpm/mpmutils.py +++ b/mpm/python/usrp_mpm/mpmutils.py @@ -141,4 +141,12 @@ def assert_compat_number( return def str2bool(value): - return value.lower() in ("yes", "true", "t", "1") + """Return a Boolean value from a string, even if the string is not simply + 'True' or 'False'. For non-string values, this will do a simple default + coercion to bool. + """ + try: + return value.lower() in ("yes", "true", "t", "1") + except AttributeError: + return bool(value) + -- cgit v1.2.3