aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo_gsm_tester/util.py')
-rw-r--r--src/osmo_gsm_tester/util.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index 602ae45..af6a2f0 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -305,4 +305,13 @@ def input_polling(prompt, poll_func):
input_thread.join()
return input_thread.result
+def str2bool(val):
+ if val is None or not val:
+ return False
+ if val.upper() in ['FALSE', 'NO', 'OFF']:
+ return False
+ if val.upper() in ['TRUE','YES', 'ON']:
+ return True
+ raise ValueError('Invalid BOOL field: %r' % val)
+
# vim: expandtab tabstop=4 shiftwidth=4