diff options
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) + | 
