Convert string value to bool.
358471
def to_bool(value):
        """"""
        bool_value = False
        if str(value).lower() in ['1', 'true']:
            bool_value = True
        return bool_value
27894
def validate(self, value):
        
        if isinstance(value, bool):
            return value
        if isinstance(value, (str, unicode)):
            if value.lower() == "true":
                value = True
            elif value.lower() == "false":
                value = False
            else:
                raise ValueError("Not a boolean: %r" % (value, ))
        value = super(Boolean, self).validate(value)
        if not isinstance(value, bool):
            raise ValueError("Not a boolean: %r" % (value, ))
        return value
1104417
def validate_bool(b):
    """"""
    if isinstance(b, six.string_types):
        b = b.lower()
    if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
        return True
    elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
        return False
    else:
        raise ValueError('Could not convert "%s" to boolean' % b)
30759
private static function bool2str($value){
        //convert boolean to text value.
        $value = $value === true ? 'true' : $value;
        $value = $value === false ? 'false' : $value;
        return $value;
    }
750314
def str2bool(value):
    """"""
    if value.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    if value.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    if value.lower() in ('d', 'default', ''):
        return None
    raise argparse.ArgumentTypeError('Expected: (Y)es/(T)rue/(N)o/(F)alse/(D)efault')
806382
def convert(self, argument):
    """"""
    if isinstance(argument, str):
      if argument.lower() in ['true', 't', '1']:
        return True
      elif argument.lower() in ['false', 'f', '0']:
        return False

    bool_argument = bool(argument)
    if argument == bool_argument:
      # The argument is a valid boolean (True, False, 0, or 1), and not just
      # something that always converts to bool (list, string, int, etc.).
      return bool_argument

    raise ValueError('Non-boolean argument to boolean flag', argument)
683016
private final boolean parseBoolean(String value)
   {
      return value != null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("y") || value.equalsIgnoreCase("yes"));
   }
689335
def parse_bool(cls, value, default=None):
        """"""
        if value is None:
            return default

        elif isinstance(value, bool):
            return value

        elif isinstance(value, str):
            if value == 'True':
                return True
            elif value == 'False':
                return False

        raise Exception("Value %s is not boolean." % value)
976536
def _parse_boolean(value):
    
    value = value.lower()
    if value in _true_strings:
        return True
    elif value in _false_strings:
        return False
    else:
        return None
665689
def __convert_bool(node):
    """"""
    converted = __convert_node(node, default_value='true')

    # Check for a switch for reversing the value
    reverse_switch = __get_attribute(node, 'ReverseSwitch')

    if reverse_switch:
        converted_reverse = copy.deepcopy(converted)

        converted_reverse['switch'] = reverse_switch
        converted_reverse['value'] = 'false'

        return [converted_reverse, converted]

    # Modify flags when there is an argument child
    __with_argument(node, converted)

    return __check_for_flag(converted)
954494
static function toBoolean ($v)
  {
    return is_string ($v) ? get (self::$BOOLEAN_VALUES, $v, false) : boolval ($v);
  }
509686
def str_to_bool(value):
    
    if isinstance(value, basestring):
        value = value.strip().lower()
        if value in ['true', 't', 'yes', 'y']:
            return True
        elif value in ['false', 'f', 'no', 'n', '']:
            return False
        else:
            raise NotImplementedError("Unknown bool %s" % value)

    return value
1198952
def to_bool(val):
    '''
    
    '''
    if val is None:
        return False
    if isinstance(val, bool):
        return val
    if isinstance(val, (six.text_type, six.string_types)):
        return val.lower() in ('yes', '1', 'true')
    if isinstance(val, six.integer_types):
        return val > 0
    if not isinstance(val, collections.Hashable):
        return bool(val)
    return False
538975
def str_to_boolean(input_str):
    
    if not isinstance(input_str, six.string_types):
        raise ValueError(input_str)
    input_str = str_quote_stripper(input_str)
    return input_str.lower() in ("true", "t", "1", "y", "yes")
655743
def to_boolean(value, ctx):
    
    if isinstance(value, bool):
        return value
    elif isinstance(value, int):
        return value != 0
    elif isinstance(value, Decimal):
        return value != Decimal(0)
    elif isinstance(value, str):
        value = value.lower()
        if value == 'true':
            return True
        elif value == 'false':
            return False
    elif isinstance(value, datetime.date) or isinstance(value, datetime.time):
        return True

    raise EvaluationError("Can't convert '%s' to a boolean" % str(value))
431413
function boolStringOption(value){
    if(value === 'true' || value === true) return true;
    if(value === 'false' || value === false) return false;
    return value;
}
1365257
def to_bool(x):
    """""""
    if isinstance(x, bool):
        return x
    elif isinstance(x, str):
        return False if x.lower() in _FALSES else True
    else:
        return bool(x)