Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Convert a string to a boolean value.

If the string consists of digits, the integer value of the string
is coerced to a boolean value.  Otherwise, any of the strings "t",
"true", "on", "y", and "yes" are considered True and any of the
strings "f", "false", "off", "n", and "no" are considered False.
A ValueError will be raised for any other value.

            @staticmethod
    def to_bool(value, do_raise=True):
        """Convert a string to a boolean value.

        If the string consists of digits, the integer value of the string
        is coerced to a boolean value.  Otherwise, any of the strings "t",
        "true", "on", "y", and "yes" are considered True and any of the
        strings "f", "false", "off", "n", and "no" are considered False.
        A ValueError will be raised for any other value.
        """

        value = value.lower()

        # Try it as an integer
        if value.isdigit():
            return bool(int(value))

        # OK, check it against the true/false values...
        if value in _str_true:
            return True
        elif value in _str_false:
            return False

        # Not recognized
        if do_raise:
            raise ValueError("invalid literal for to_bool(): %r" % value)

        return False
        


src/t/u/turnstile-0.7.0b2/turnstile/middleware.py   turnstile(Download)
 
        # Initialize the control daemon
        if self.conf.to_bool(self.conf['control'].get('remote', 'no'), False):
            self.control_daemon = remote.RemoteControlDaemon(self, self.conf)
        else:

src/t/u/turnstile-HEAD/turnstile/middleware.py   turnstile(Download)
 
        # Initialize the control daemon
        if self.conf.to_bool(self.conf['control'].get('remote', 'no'), False):
            self.control_daemon = remote.RemoteControlDaemon(self, self.conf)
        else:

src/t/u/turnstile-0.7.0b2/turnstile/tools.py   turnstile(Download)
        elif attr_type == bool:
            try:
                value = config.Config.to_bool(child.text)
            except ValueError:
                warnings.warn("Unrecognized boolean value %r while parsing "

src/t/u/turnstile-HEAD/turnstile/tools.py   turnstile(Download)
        elif attr_type == bool:
            try:
                value = config.Config.to_bool(child.text)
            except ValueError:
                warnings.warn("Unrecognized boolean value %r while parsing "