// NormalizePartial will nil out the Partial field for this Attempt if all
// Partial fields are false.
967587
func (d *Attempt) NormalizePartial() {
	p := d.GetPartial()
	if p == nil {
		return
	}
	if !(p.Data || p.Executions || p.FwdDeps || p.BackDeps ||
		p.Result != Attempt_Partial_LOADED) {
		d.Partial = nil
	}
}
16205
func (entry *Entry) Partial(fields []string) *Entry {
	partial := NewEmptyEntry()
	for _, name := range fields {
		value, _ := entry.Field(name)
		partial.SetField(name, value)
	}
	return partial
}
1069033
func parsePartialTime(buff []byte, cursor *int, l int) (partialTime, error) {
	var pt partialTime

	hour, minute, err := getHourMinute(buff, cursor, l)
	if err != nil {
		return pt, err
	}

	if buff[*cursor] != ':' {
		return pt, ErrInvalidTimeFormat
	}

	*cursor++

	// ----

	seconds, err := parseSecond(buff, cursor, l)
	if err != nil {
		return pt, err
	}

	pt = partialTime{
		hour:    hour,
		minute:  minute,
		seconds: seconds,
	}

	// ----

	if buff[*cursor] != '.' {
		return pt, nil
	}

	*cursor++

	secFrac, err := parseSecFrac(buff, cursor, l)
	if err != nil {
		return pt, nil
	}
	pt.secFrac = secFrac

	return pt, nil
}
1201802
func (v *printVisitor) VisitPartial(node *PartialStatement) interface{} {
	v.indent()
	v.str("{{> PARTIAL:")

	v.original = true
	node.Name.Accept(v)
	v.original = false

	if len(node.Params) > 0 {
		v.str(" ")
		node.Params[0].Accept(v)
	}

	// hash
	if node.Hash != nil {
		v.str(" ")
		node.Hash.Accept(v)
	}

	v.str(" }}")
	v.nl()

	return nil
}
17948
func (tpl *Template) RegisterPartial(name string, source string) {
	tpl.addPartial(name, source, nil)
}
516630
func NormalizeURL(u *url.URL, f NormalizationFlags) string {
	for _, k := range flagsOrder {
		if f&k == k {
			flags[k](u)
		}
	}
	return urlesc.Escape(u)
}
1225473
func (r *Rego) Partial(ctx context.Context) (*PartialQueries, error) {
	var err error
	if r.txn == nil {
		r.txn, err = r.store.NewTransaction(ctx)
		if err != nil {
			return nil, err
		}
		defer r.store.Abort(ctx, r.txn)
	}

	pq, err := r.PrepareForPartial(ctx)
	if err != nil {
		return nil, err
	}

	return pq.Partial(ctx)
}
145136
func NormalizeSecret(un *unstructured.Unstructured) {
	if un == nil {
		return
	}
	gvk := un.GroupVersionKind()
	if gvk.Group != "" || gvk.Kind != "Secret" {
		return
	}
	var secret corev1.Secret
	err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &secret)
	if err != nil {
		return
	}
	// We normalize nils to empty string to handle: https://github.com/argoproj/argo-cd/issues/943
	for k, v := range secret.Data {
		if len(v) == 0 {
			secret.Data[k] = []byte("")
		}
	}
	if len(secret.StringData) > 0 {
		if secret.Data == nil {
			secret.Data = make(map[string][]byte)
		}
		for k, v := range secret.StringData {
			secret.Data[k] = []byte(v)
		}
		delete(un.Object, "stringData")
	}
	newObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&secret)
	if err != nil {
		log.Warnf("object unable to convert from secret: %v", err)
		return
	}
	if secret.Data != nil {
		err = unstructured.SetNestedField(un.Object, newObj["data"], "data")
		if err != nil {
			log.Warnf("failed to set secret.data: %v", err)
			return
		}
	}
}
686504
func (s *Parameters_Scheduling) Normalize() (err error) {
	if s.Priority > 255 {
		return errors.New("scheduling.priority > 256")
	}
	// Priority == 0 means default.
	if s.Priority == 0 {
		s.Priority = DefaultSwarmingPriority
	}
	for k, v := range s.Dimensions {
		if k == "" {
			return errors.New("scheduling.dimensions: empty dimension key")
		}
		if v == "" {
			return fmt.Errorf("scheduling.dimensions: dimension key %q with empty value", k)
		}
	}
	if google.DurationFromProto(s.IoTimeout) < 0 {
		return errors.New("scheduling.io_timeout: negative timeout not allowed")
	}
	return
}
306007
func (d *DepsStage) Normalize() error {
	for _, d := range d.Deps {
		if err := d.Normalize(); err != nil {
			return err
		}
	}
	return nil
}
214799
func (t *TemplateInstantiation) Normalize() error {
	if t.Project == "" {
		return errors.New("empty project")
	}
	return t.Specifier.Normalize()
}
627042
func LowerInitial(str string) string {
	for i, v := range str {
		return string(unicode.ToLower(v)) + str[i+1:]
	}
	return ""
}
1158244
func RegisterPartialTemplate(name string, tpl *Template) {
	partialsMutex.Lock()
	defer partialsMutex.Unlock()

	if partials[name] != nil {
		panic(fmt.Errorf("Partial already registered: %s", name))
	}

	partials[name] = newPartial(name, "", tpl)
}
788037
func (tpl *Template) RegisterPartials(partials map[string]string) {
	for name, partial := range partials {
		tpl.RegisterPartial(name, partial)
	}
}
407438
func (m *Module) Normalized() string {
	return m.formatWithPrefix(m.normalizedHostPrefix(m.Host().Normalized()), false)
}
813411
func (t *File_Template) Normalize() error {
	if t.DistributorConfigName == "" {
		return fmt.Errorf("missing distributor_config_name")
	}
	if err := t.Parameters.Normalize(); err != nil {
		return err
	}
	if err := t.DistributorParameters.Normalize(); err != nil {
		return err
	}
	return nil
}
856695
func (p *Parameters) Normalize() (err error) {
	if err = p.Scheduling.Normalize(); err != nil {
		return
	}
	if err = p.Meta.Normalize(); err != nil {
		return
	}
	if err = p.Job.Normalize(); err != nil {
		return
	}
	return
}