// ParseBool parses string as boolean value,
// returns error in case if value is not recognized
488144
func ParseBool(value string) (bool, error) {
	switch strings.ToLower(value) {
	case "yes", "yeah", "y", "true", "1", "on":
		return true, nil
	case "no", "nope", "n", "false", "0", "off":
		return false, nil
	default:
		return false, trace.BadParameter("unsupported value: %q", value)
	}
}
1247583
func GetBool(key string, defaultValue bool) bool {
	b, err := factory.GetValue(key).ToBool()
	if err != nil {
		return defaultValue
	}
	return b
}
948885
func (env *Env) GetBool(key string) (value bool) {
	s := strings.ToLower(strings.Trim(env.Get(key), " \t"))
	if s == "" || s == "0" || s == "no" || s == "false" || s == "none" {
		return false
	}
	return true
}
634705
func ParseBool(val interface{}) (value bool, err error) {
	if val != nil {
		switch v := val.(type) {
		case bool:
			return v, nil
		case string:
			switch v {
			case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On":
				return true, nil
			case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "N", "n", "OFF", "off", "Off":
				return false, nil
			}
		case int8, int32, int64:
			strV := fmt.Sprintf("%s", v)
			if strV == "1" {
				return true, nil
			} else if strV == "0" {
				return false, nil
			}
		case float64:
			if v == 1 {
				return true, nil
			} else if v == 0 {
				return false, nil
			}
		}
		return false, fmt.Errorf("parsing %q: invalid syntax", val)
	}
	return false, fmt.Errorf("parsing <nil>: invalid syntax")
}
951031
func (dec *Decoder) SliceBool(s *[]bool) error {
	err := dec.Array(DecodeArrayFunc(func(dec *Decoder) error {
		var b bool
		if err := dec.Bool(&b); err != nil {
			return err
		}
		*s = append(*s, b)
		return nil
	}))

	if err != nil {
		return err
	}
	return nil
}
418162
func ConvertBool(str string) (bool, error) {
	_, ok := evaluatesAsTrue[strings.ToLower(str)]
	return ok, nil
}
717252
func ParseBoolFlag(s string) (bf BoolFlag, err error) {
	switch s {
	case "on":
		bf = true
	case "off":
		bf = false
	default:
		err = fmt.Errorf("invalid value ‘%s’ for BoolFlag", s)
	}

	return bf, err
}
516443
func TryToBool(i interface{}) (b bool, err error) {
	switch v := i.(type) {
	case nil:
	case bool:
		b = v
	case *bool:
		b = *v
	case string:
		b, err = strconv.ParseBool(v)
	case *string:
		b, err = strconv.ParseBool(*v)
	case int, int8, int16, int32, int64:
		b = v != 0
	default:
		err = castError(i, "bool")
	}
	return
}
702606
func (me *DefaultAdapter) LiteralBool(buf *SqlBuilder, b bool) error {
	if buf.IsPrepared {
		return me.PlaceHolderSql(buf, b)
	}
	if b {
		buf.Write(me.True)
	} else {
		buf.Write(me.False)
	}
	return nil
}
1180280
func (RPCResponse *RPCResponse) GetBool() (bool, error) {
	val, ok := RPCResponse.Result.(bool)
	if !ok {
		return false, fmt.Errorf("could not parse bool from %s", RPCResponse.Result)
	}

	return val, nil
}
767740
func (r *Encoder) EncodeBool(b bool) error {
	var data byte
	if b {
		data = CHR_TRUE
	} else {
		data = CHR_FALSE
	}

	_, err := r.w.Write([]byte{data})
	return err
}
308858
func parseBool(v string) (bool, error) {
	switch strings.ToLower(v) {
	case "true", "t", "yes", "y", "1", "":
		return true, nil
	case "false", "f", "no", "n", "0":
		return false, nil
	}
	return false, fmt.Errorf(`illegal input "%s" for bool value`, v)
}
151932
func (reader *PluginConfigReader) GetBool(key string, defaultValue bool) bool {
	value, err := reader.WithError.GetBool(key, defaultValue)
	reader.Errors.Push(err)
	return value
}
625353
func (c *ConfigParser) Getbool(section, option string) (val bool, err error) {
	sv, err := c.Get(section, option)
	if err != nil {
		return val, err
	}

	val, ok := booleanStates[strings.ToLower(sv)]
	if !ok {
		return val, errors.New(fmt.Sprintf("No boolean: %s", sv))
	}

	return val, err
}
223054
func AsBool(v string) bool {
	if v == "" {
		return false
	}
	out, _ := ParseBool(v)
	return out
}
442074
func (params Params) GetBool(key string) (bool, error) {
	v, err := params.Get(key)
	if err != nil {
		return false, err
	}
	vt, ok := v.(bool)
	if !ok {
		return false, newErrorType(key, v, "bool")
	}
	return vt, nil
}
1063595
func parseBool(str string) (bool, error) {
	switch strings.ToLower(str) {
	case "1", "t", "true", "y", "yes":
		return true, nil
	case "0", "f", "false", "n", "no":
		return false, nil
	}
	return false, fmt.Errorf("%s is not valid. Please choose between (y)es or (n)o", str)
}