diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-02-07 13:59:23 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-02-07 13:59:23 -0800 |
commit | 88ab35529b5be85654b4b00cd558bc083b692df4 (patch) | |
tree | 6031543272688c7b82b225ffd3ef669a7b4a9f28 /mpm/python | |
parent | 0d73d8ab817ed0e0e1578d26fff98201b2cff961 (diff) | |
download | uhd-88ab35529b5be85654b4b00cd558bc083b692df4.tar.gz uhd-88ab35529b5be85654b4b00cd558bc083b692df4.tar.bz2 uhd-88ab35529b5be85654b4b00cd558bc083b692df4.zip |
fixup! mpm: Fixup for argument parsing in N310
Diffstat (limited to 'mpm/python')
-rw-r--r-- | mpm/python/usrp_mpm/mpmutils.py | 10 |
1 files changed, 9 insertions, 1 deletions
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) + |