// GetBool returns the result of applying a path to the given Graph.
// The result is returned as a bool. If the path result cannot be converted
// to a boolean, then an error is returned.
426525
func (g *Graph) GetBool(path string) (bool, error) {

	if len(path) == 0 {
		return g.Bool(), nil
	}

	i := g.Get(path)
	if i == nil {
		return false, errors.New("not found")
	}
	if i.Len() == 0 {
		return false, errors.New("Get() design error: not subnodes")
	}
	j, ok := _boolf(i.Out[0].This)
	if !ok {
		return false, errors.New("not a boolean")
	}
	return j, nil
}
873051
func getKernelBoolParam(path string) (bool, error) {
	enabled := false
	line, err := ioutil.ReadFile(path)
	if err != nil {
		return false, err
	}
	if len(line) > 0 {
		enabled = line[0] == '1'
	}
	return enabled, err
}
566590
func (context *BaseContext) GetBool(
	key string, defaultValue ...bool) bool {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(bool); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return false
}
8325
func ToBool(s string) (b bool) {
	if len(s) == 0 {
		log.Fatal("ERROR: variable empty, cannot convert to boolean")
	}
	switch s {
	case "false":
		b = false
	case "true":
		b = true
	}
	return b
}
450460
func (r *Reader) ReadBool() bool {
	tag := r.readByte()
	decoder := boolDecoders[tag]
	if decoder == nil {
		castError(tag, "bool")
	}
	return decoder(r)
}
1161106
func toBool(v reflect.Value) bool {
	b, _ := tryToBool(v)
	return b
}
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
}
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
}
65920
func (e *etc) ValueAsBool(path string, dv bool) bool {
	value := e.valueAt(path)
	return defaulter.AsBool(value, dv)
}
1063600
func Bool(value interface{}) bool {
	b, _ := strconv.ParseBool(String(value))
	return b
}
629623
func (c *client) Bool(key string, fallback bool) bool {
	if b, err := strconv.ParseBool(c.Getenv(key)); err == nil {
		return b
	}

	return fallback
}
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
}
125453
func readBool(input string) (value bool, valid bool) {
	switch input {
	case "1", "true", "TRUE", "True":
		return true, true
	case "0", "false", "FALSE", "False":
		return false, true
	}

	// Not a valid bool value
	return
}
1218654
func parseBool(str string) (value bool, err error) {
	switch str {
	case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On":
		return true, nil
	case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off":
		return false, nil
	}
	return false, fmt.Errorf("parsing \"%s\": invalid syntax", str)
}
317490
func (s *Session) GetBoolean(key string) (bool, error) {
	v := s.Get(key)
	if v == nil {
		return false, errFindParse.Format("bool", key, "nil")
	}

	// here we could check for "true", "false" and 0 for false and 1 for true
	// but this may cause unexpected behavior from the developer if they expecting an error
	// so we just check if bool, if yes then return that bool, otherwise return false and an error.
	if vb, ok := v.(bool); ok {
		return vb, nil
	}
	if vstring, ok := v.(string); ok {
		return strconv.ParseBool(vstring)
	}

	return false, errFindParse.Format("bool", key, v)
}
353644
func (cmd *Cmd) GetBoolVar(name string) (val bool) {
	sval, _ := cmd.context.GetVar(name)
	val, _ = strconv.ParseBool(sval)
	return
}
585691
func (d *Context) GetBoolean(index int) bool {
	return int(C.duk_get_boolean(d.duk_context, C.duk_idx_t(index))) == 1
}