// isValidUgenInput returns false if val is not a valid ugen input and true otherwise.
8747
func isValidUgenInput(val interface{}) (Input, bool) {
	switch x := val.(type) {
	case int:
		return C(float32(x)), true
	case float64:
		return C(float32(x)), true
	case float32:
		return C(x), true
	case Input:
		return x, true
	default:
		return nil, false
	}
}
1109114
func IsValid(na *wire.NetAddress) bool {
	// IsUnspecified returns if address is 0, so only all bits set, and
	// RFC3849 need to be explicitly checked.
	return na.IP != nil && !(na.IP.IsUnspecified() ||
		na.IP.Equal(net.IPv4bcast))
}
586008
func IsInvalidTransaction(err error) bool {
	switch err := err.(type) {
	case *Error:
		return err.Code == InvalidTransactionErr
	}
	return false
}
591632
func (v *TimeIsPresent) IsValid(errors *validate.Errors) {
	t := time.Time{}
	if v.Field.UnixNano() != t.UnixNano() {
		return
	}

	if len(v.Message) > 0 {
		errors.Add(GenerateKey(v.Name), v.Message)
		return
	}

	errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be blank.", v.Name))
}
1287771
func (uri *redirectURI) isValid() bool {
	return len(uri.scheme) > 0 && len(uri.host) > 0
}
1001692
func (m *GormIdentityRepository) IsValid(ctx context.Context, id uuid.UUID) bool {
	_, err := m.Load(ctx, id)
	if err != nil {
		return false
	}
	return true
}
1324226
func (b IPv4) IsValid(pktSize int) bool {
	if len(b) < IPv4MinimumSize {
		return false
	}

	hlen := int(b.HeaderLength())
	tlen := int(b.TotalLength())
	if hlen > tlen || tlen > pktSize {
		return false
	}

	return true
}
798667
func (v *EmailIsPresent) IsValid(errors *validate.Errors) {
	if !rxEmail.Match([]byte(v.Field)) {
		if v.Message == "" {
			v.Message = fmt.Sprintf("%s does not match the email format.", v.Name)
		}
		errors.Add(GenerateKey(v.Name), v.Message)
	}
}
1317473
func isValidTtl(v string) (uint32, bool) {
	i, err := strconv.Atoi(v)
	if err != nil {
		return uint32(0), false
	}
	if i > 2147483647 {
		return uint32(0), false
	}
	if i < 0 {
		return uint32(0), false
	}
	return uint32(i), true
}
418335
func ValidateProgressOutput(val string) error {
	valid := []string{"auto", "plain", "tty"}
	for _, s := range valid {
		if s == val {
			return nil
		}
	}
	return fmt.Errorf("invalid value %q passed to --progress, valid values are: %s", val, strings.Join(valid, ", "))
}
986250
func (m *GormLabelRepository) IsValid(ctx context.Context, id uuid.UUID) bool {
	return repository.CheckExists(ctx, m.db, LabelTableName, id) == nil
}
717872
func IsValidUserID(uid int64) []string {
	if minUserID <= uid && uid <= maxUserID {
		return nil
	}
	return []string{InclusiveRangeError(minUserID, maxUserID)}
}
724470
func (def *Synthdef) processUgenInput(input Input, stack *stack, depth int) {
	switch v := input.(type) {
	case *Ugen:
		def.topsortr(v, stack, depth+1)
		break
	case MultiInput:
		// multi input
		mins := v.InputArray()
		for j := len(mins) - 1; j >= 0; j-- {
			switch w := mins[j].(type) {
			case *Ugen:
				def.topsortr(w, stack, depth+1)
				break
			}
		}
		break
	}
}
1285641
func (h HLL) IsValid() error {
	if len(h) < 8 {
		return errors.New("size too small")
	}

	if (len(h)-8)%3 != 0 {
		return errors.New("hll byte size sould be 8 + a multiple of 3")
	}
	m := Dense(h[8:]).m()
	if m&(m-1) != 0 {
		return errors.New("hll byte size sould be 8 + 3 times a power of two")
	}
	var p byte
	for z := m; z != 0; z >>= 1 {
		p++
	}
	p--
	if p < 4 || p > 25 {
		return errors.New("p must be between 4 and 25, inclusive")
	}
	if h[0]&(1<<6) == 0 {
		sz := sparse(h).size()
		if len(h) < 8+8*int(sz) {
			return errors.New("sparse HLL is corrupted")
		}
	}
	return nil
}
493570
func (r *Result) IsValid() bool {
	if r == nil {
		return true
	}
	return len(r.Errors) == 0
}
674501
func (mv *Validator) Valid(val interface{}, tags string) error {
	if tags == "-" {
		return nil
	}
	v := reflect.ValueOf(val)
	if v.Kind() == reflect.Ptr && !v.IsNil() {
		return mv.Valid(v.Elem().Interface(), tags)
	}
	var err error
	switch v.Kind() {
	case reflect.Struct:
		return ErrUnsupported
	case reflect.Invalid:
		err = mv.validateVar(nil, tags)
	default:
		err = mv.validateVar(val, tags)
	}
	return err
}
468921
func (c *timeSeriesConfCache) IsValid() bool {
	return c.TimeSeriesConfs != nil && time.Since(c.Generated) < c.TTL
}