from Param import Param def ParamBool(Param): def __init__(self, value, classname=""): self._classname = classname super(ParamBool).__init__() self.value = self._bool_correct(value) def _bool_correct(self, b): if type(b) == str: if re.match(r'true', b, re.IGNORECASE): return True elif re.match(r'false', b, re.IGNORECASE): return False elif type(b) == bool: return b self.err_warn("Not a bool: %s" % str(b))