aboutsummaryrefslogtreecommitdiff
path: root/Utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Utils.py')
-rw-r--r--Utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Utils.py b/Utils.py
index 092946df..9cbc3a3f 100644
--- a/Utils.py
+++ b/Utils.py
@@ -165,3 +165,12 @@ def from_pretty_time(pretty_time):
seconds += number
if seconds > 0:
return seconds
+
+IS_TRUE = ["true", "yes", "on", "y"]
+IS_FALSE = ["false", "no", "off", "n"]
+def bool_or_none(s):
+ s = s.lower()
+ if s in IS_TRUE:
+ return True
+ elif s in IS_FALSE:
+ return False