From 190d42fbb527a8710a8e710dc3260ad8054a9d1d Mon Sep 17 00:00:00 2001 From: Evelyn Date: Sun, 10 Apr 2016 17:40:58 +0100 Subject: simpler boolean channel settings --- Utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Utils.py') 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 -- cgit v1.3.1-10-gc9f91