// BooleanField returns the boolean value for a given username and field name.
// If the user or field is missing, false will be returned.
// Useful for states where it makes sense that the returned value is not true
// unless everything is in order.
547944
func (state *UserState) BooleanField(username, fieldname string) bool {
	hasUser := state.HasUser(username)
	if !hasUser {
		return false
	}
	value, err := state.users.Get(username, fieldname)
	if err != nil {
		return false
	}
	return value == "true"
}
307507
func (client *Client) BooleanRequest(command Command) error {
	resp, err := client.Request(command)
	if err != nil {
		return err
	}

	if b, ok := resp.(*BooleanResponse); ok {
		return b.Error()
	}

	panic(fmt.Errorf("command %q is not a proper boolean response. %#v", client.APIName(command), resp))
}
634291
func (is *Is) False(b bool) {
	is.TB.Helper()
	if b {
		fail(is, "expected boolean to be false")
	}
}
296843
func (r *Reply) Bool() (bool, error) {
	if r.Type == ErrorReply {
		return false, r.Err
	}
	i, err := r.Int()
	if err == nil {
		if i == 0 {
			return false, nil
		}

		return true, nil
	}

	s, err := r.Str()
	if err == nil {
		if s == "0" {
			return false, nil
		}

		return true, nil
	}

	return false, errors.New("boolean value is not available for this reply type")
}
368910
func (f *Queries) Bool(key string) (bool, error) {
	s, err := f.String(key)
	if err != nil {
		return false, err
	}
	return strconv.ParseBool(s)
}
662356
func parseObjectField(parser *Parser, isConst bool) (*ast.ObjectField, error) {
	var (
		name  *ast.Name
		value ast.Value
		err   error
	)
	start := parser.Token.Start
	if name, err = parseName(parser); err != nil {
		return nil, err
	}
	if _, err = expect(parser, lexer.COLON); err != nil {
		return nil, err
	}
	if value, err = parseValueLiteral(parser, isConst); err != nil {
		return nil, err
	}
	return ast.NewObjectField(&ast.ObjectField{
		Name:  name,
		Value: value,
		Loc:   loc(parser, start),
	}), nil
}
826288
func GetBool(key string) (bool, error) {
	value, err := Get(key)
	if err != nil {
		return false, err
	}
	if v, ok := value.(bool); ok {
		return v, nil
	}
	return false, &InvalidValue{key, "boolean"}
}
1352263
def boolean(name=None):
    

    if name is None:
        name = 'Boolean Field'

    # Basic field
    field = pp.Regex('[YN]')

    # Parse action
    field.setParseAction(lambda b: _to_boolean(b[0]))

    # Name
    field.setName(name)

    return field
507320
func structFieldByName(st reflect.Type, name string) (int, *Properties, bool) {
	sprops := GetProperties(st)
	i, ok := sprops.decoderOrigNames[name]
	if ok {
		return i, sprops.Prop[i], true
	}
	return -1, nil, false
}
1300537
func (c *JSONConfigContainer) Bool(key string) (bool, error) {
	val := c.getData(key)
	if val != nil {
		return ParseBool(val)
	}
	return false, fmt.Errorf("not exist key: %q", key)
}
30593
func (v *Value) Boolean() *Boolean {
	data, ok := v.value.(bool)
	if !ok {
		v.chain.fail("\nexpected boolean value, but got:\n%s",
			dumpValue(v.value))
	}
	return &Boolean{v.chain, data}
}
63848
func (m *SnapshotCommit) Field(fieldpath []string) (string, bool) {
	if len(fieldpath) == 0 {
		return "", false
	}

	switch fieldpath[0] {
	case "key":
		return string(m.Key), len(m.Key) > 0
	case "name":
		return string(m.Name), len(m.Name) > 0
	}
	return "", false
}
1161739
func ParseBool(q url.Values, name string) (bool, bool, error) {
	stringVal := q.Get(name)
	if stringVal == "" {
		return false, false, nil
	}

	val, err := strconv.ParseBool(stringVal)
	if err != nil {
		return false, false, trace.BadParameter(
			"'%v': expected 'true' or 'false', got %v", name, stringVal)
	}
	return val, true, nil
}
368917
func BoolWithKey(target interface{}, key string) bool {
	item, err := fieldWithKey(target, key)
	if err != nil {
		return false
	}

	field := reflect.ValueOf(target).Elem().FieldByName(item)

	if field.Kind() == reflect.Bool {
		ptr := field.Addr().Interface().(*bool)

		return bool(*ptr)
	}

	return false
}
41085
func BoolArray(name string, values []bool) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeUint8, outTypeBoolean, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			bool8 := uint8(0)
			if v {
				bool8 = uint8(1)
			}
			ed.writeUint8(bool8)
		}
	}
}
280836
func getBoolValue(b []rune) (int, error) {
	if len(b) < 4 {
		return 0, NewParseError("invalid boolean value")
	}

	n := 0
	for _, lv := range literalValues {
		if len(lv) > len(b) {
			continue
		}

		if isLitValue(lv, b) {
			n = len(lv)
		}
	}

	if n == 0 {
		return 0, NewParseError("invalid boolean value")
	}

	return n, nil
}
948319
func (dt *DbfTable) FieldValueByName(row int, fieldName string) (value string, err error) {
	if fieldIndex, entryFound := dt.fieldMap[fieldName]; entryFound {
		return dt.FieldValue(row, fieldIndex), err
	}
	err = errors.New("Field name \"" + fieldName + "\" does not exist")
	return
}