// CheckboxFromInstance creates and initializes a checkbox field based on its name, the reference object instance, field number and field options.
5460
func CheckboxFromInstance(val reflect.Value, t reflect.Type, fieldNo int, name string, options map[string]struct{}) *Field {
	ret := FieldWithType(name, formcommon.CHECKBOX)
	if _, ok := options["checked"]; ok {
		ret.AddTag("checked")
	} else {
		v := val.Field(fieldNo).Bool()
		if v {
			ret.AddTag("checked")
		}
	}
	return ret
}
531936
func (e *Environ) PrecheckInstance(ctx context.ProviderCallContext, args environs.PrecheckInstanceParams) error {
	if _, err := e.deriveAvailabilityZone(ctx, args.Placement, args.VolumeAttachments); err != nil {
		return errors.Trace(err)
	}
	if !args.Constraints.HasInstanceType() {
		return nil
	}
	// Constraint has an instance-type constraint so let's see if it is valid.
	novaClient := e.nova()
	flavors, err := novaClient.ListFlavorsDetail()
	if err != nil {
		common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
		return err
	}
	for _, flavor := range flavors {
		if flavor.Name == *args.Constraints.InstanceType {
			return nil
		}
	}
	return errors.Errorf("invalid Openstack flavour %q specified", *args.Constraints.InstanceType)
}
145888
func (a *Authenticator) checkInitialized() (bool, error) {
	if a.err != nil || a.baseToken != nil {
		return true, a.err
	}
	return false, nil
}
217606
func CheckNodeAffinity(pv *v1.PersistentVolume, nodeLabels map[string]string) error {
	return checkVolumeNodeAffinity(pv, nodeLabels)
}
999241
func EventBoxFromObject(object *glib.GObject) *EventBox {
	return &EventBox{Bin{Container{Widget{C.toGWidget(object.Object)}}}}
}
723759
func (service *VboxPortType) IGuestgetAdditionsRevision(request *IGuestgetAdditionsRevision) (*IGuestgetAdditionsRevisionResponse, error) {
	response := new(IGuestgetAdditionsRevisionResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
380940
func NewFlagCheckOption(flag bool) Option {
	return &option{optionType: flagCheckOption, value: NewFlagCheckFilter(flag)}
}
1122983
func (o *Options) validateFunc() ValidateFunc {
	if o.ValidateFunc == nil {
		return defaultValidateFunc
	}

	return o.ValidateFunc
}
1014746
func (service *VboxPortType) IGuestUserStateChangedEventgetName(request *IGuestUserStateChangedEventgetName) (*IGuestUserStateChangedEventgetNameResponse, error) {
	response := new(IGuestUserStateChangedEventgetNameResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
277106
func (v ElementBuildingVisitor) CreateTypeElement(item *typeItem) (apply.Element, error) {
	meta, err := getFieldMeta(item.GetMeta(), item.Name)
	if err != nil {
		return nil, err
	}
	return v.typeElement(meta, item)
}
1273790
func (env *environ) PrecheckInstance(ctx context.ProviderCallContext, args environs.PrecheckInstanceParams) error {
	_, err := env.parsePlacement(ctx, args.Placement)
	return errors.Trace(err)
}
182579
func (f Form) CheckboxTag(opts tags.Options) *tags.Tag {
	opts["type"] = "checkbox"

	value := opts["value"]
	delete(opts, "value")

	checked := opts["checked"]
	delete(opts, "checked")
	if checked == nil {
		checked = "true"
	}
	opts["value"] = checked

	unchecked := opts["unchecked"]
	delete(opts, "unchecked")

	hl := opts["hide_label"]
	delete(opts, "hide_label")

	if opts["tag_only"] == true {
		delete(opts, "label")
		ct := f.InputTag(opts)
		ct.Checked = template.HTMLEscaper(value) == template.HTMLEscaper(checked)
		return ct
	}

	tag := tags.New("label", tags.Options{})
	ct := f.InputTag(opts)
	ct.Checked = template.HTMLEscaper(value) == template.HTMLEscaper(checked)
	tag.Append(ct)

	if opts["name"] != nil && unchecked != nil {
		tag.Append(tags.New("input", tags.Options{
			"type":  "hidden",
			"name":  opts["name"],
			"value": unchecked,
		}))
	}

	if opts["label"] != nil && hl == nil {
		label := fmt.Sprint(opts["label"])
		delete(opts, "label")
		tag.Append(" " + label)
	}
	return tag
}
750204
func DateFieldFromInstance(val reflect.Value, t reflect.Type, fieldNo int, name string) *Field {
	ret := DateField(name)
	// check tags
	if v := formcommon.TagVal(t, fieldNo, "form_min"); v != "" {
		if !validateDate(v) {
			panic(errors.New(fmt.Sprintf("Invalid date value (min) for field", name)))
		}
		ret.SetParam("min", v)
	}
	if v := formcommon.TagVal(t, fieldNo, "form_max"); v != "" {
		if !validateDate(v) {
			panic(errors.New(fmt.Sprintf("Invalid date value (max) for field", name)))
		}
		ret.SetParam("max", v)
	}
	v := formcommon.TagVal(t, fieldNo, "form_value")
	if vt := val.Field(fieldNo).Interface().(time.Time); !vt.IsZero() {
		v = vt.Format(DATE_FORMAT)
	}
	ret.SetValue(v)
	return ret
}
993252
func PasswordFieldFromInstance(val reflect.Value, t reflect.Type, fieldNo int, name string) *Field {
	ret := PasswordField(name)
	ret.SetValue(fmt.Sprintf("%s", val.Field(fieldNo).String()))
	return ret
}
460507
func (*environ) PrecheckInstance(ctx context.ProviderCallContext, args environs.PrecheckInstanceParams) error {
	if args.Placement != "" && args.Placement != "valid" {
		return fmt.Errorf("%s placement is invalid", args.Placement)
	}
	return nil
}
1220929
func InstanceOf(value interface{}, object *js.Object) bool {
	return js.Global.Get("$jsbuiltin$").Call("instanceoffunc", value, object).Bool()
}
1340116
func (p PhysicalSelection) Init(ctx sessionctx.Context, stats *property.StatsInfo, props ...*property.PhysicalProperty) *PhysicalSelection {
	p.basePhysicalPlan = newBasePhysicalPlan(ctx, TypeSel, &p)
	p.childrenReqProps = props
	p.stats = stats
	return &p
}