def test_asbool(self): for val in ("t", "true", "y", "yes", "on", "1", 1, True): self.assertTrue(bu.asbool(val)) if isinstance(val, str): self.assertTrue(bu.asbool(val.upper())) for val in ("f", "false", "n", "no", "off", "0", 0, False): self.assertFalse(bu.asbool(val)) if isinstance(val, str): self.assertFalse(bu.asbool(val.upper()))
def __init__(self, engine, config): widgets = [] super(Module, self).__init__(engine, config, widgets) self._includelist = set(filter(lambda x: len(x) > 0, self.parameter("list", default="").split(','))) self._format = self.parameter("format", default="{name} {shortstatus} {used}/{size} " + "({percentfree}%)") self._usesudo = asbool(self.parameter("sudo", default=False)) self._showio = asbool(self.parameter("showio", default=True)) self._ioformat = self.parameter("ioformat", default="{band}") self._warnfree = int(self.parameter("warnfree", default=10)) self._update_widgets(widgets)