// Canonicalize returns a copy of this name, canonicalized for the specified
// mechanism
963707
func (n Name) Canonicalize(mech_type *OID) (canonical *Name, err error) {
	canonical = &Name{
		Lib: n.Lib,
	}

	var min C.OM_uint32
	maj := C.wrap_gss_canonicalize_name(n.Fp_gss_canonicalize_name, &min,
		n.C_gss_name_t, mech_type.C_gss_OID, &canonical.C_gss_name_t)
	err = n.stashLastStatus(maj, min)
	if err != nil {
		return nil, err
	}

	return canonical, nil
}
288377
func Normalize(name string) string {
	fargs := func(c rune) bool {
		return !unicode.IsLetter(c) && !unicode.IsNumber(c)
	}
	// get function
	return strings.Join(strings.FieldsFunc(name, fargs), "-")
}
199423
func (branch *GitBranch) CanonicalName() string {
	if name := branch.BranchName; name != "" {
		return name
	} else {
		return branch.FullRemoteBranchName()
	}
}
620242
func canonicalizedAmzHeadersV2(headers http.Header) string {
	var keys []string
	keyval := make(map[string]string)
	for key := range headers {
		lkey := strings.ToLower(key)
		if !strings.HasPrefix(lkey, "x-amz-") {
			continue
		}
		keys = append(keys, lkey)
		keyval[lkey] = strings.Join(headers[key], ",")
	}
	sort.Strings(keys)
	var canonicalHeaders []string
	for _, key := range keys {
		canonicalHeaders = append(canonicalHeaders, key+":"+keyval[key])
	}
	return strings.Join(canonicalHeaders, "\n")
}
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
}
99947
func normalize(name string) (string, error) {
	host, remoteName := splitHostname(name)
	if strings.ToLower(remoteName) != remoteName {
		return "", errors.New("invalid reference format: repository name must be lowercase")
	}
	if host == DefaultHostname {
		if strings.HasPrefix(remoteName, DefaultRepoPrefix) {
			return strings.TrimPrefix(remoteName, DefaultRepoPrefix), nil
		}
		return remoteName, nil
	}
	return name, nil
}
420834
func MakeCanonicalName(resolvedWriters []kbname.NormalizedUsername,
	unresolvedWriters []keybase1.SocialAssertion,
	resolvedReaders []kbname.NormalizedUsername,
	unresolvedReaders []keybase1.SocialAssertion,
	extensions []HandleExtension) CanonicalName {
	return makeCanonicalName(
		resolvedWriters, unresolvedWriters, resolvedReaders, unresolvedReaders,
		extensions, false)
}
536036
func (rs *Ruleset) Titleize(word string) string {
	words := splitAtCaseChangeWithTitlecase(word)
	result := strings.Join(words, " ")

	var acronymWords []string
	for index, word := range words {
		if len(word) == 1 {
			acronymWords = append(acronymWords, word)
		}

		if len(word) > 1 || index == len(words)-1 || len(acronymWords) > 1 {
			acronym := strings.Join(acronymWords, "")
			if !rs.isAcronym(acronym) {
				acronymWords = acronymWords[:len(acronymWords)]
				continue
			}

			result = strings.Replace(result, strings.Join(acronymWords, " "), acronym, 1)
			acronymWords = []string{}
		}
	}

	return result
}
98872
func (t *Task) Canonicalize(job *Job, tg *TaskGroup) {
	// Ensure that an empty and nil map are treated the same to avoid scheduling
	// problems since we use reflect DeepEquals.
	if len(t.Meta) == 0 {
		t.Meta = nil
	}
	if len(t.Config) == 0 {
		t.Config = nil
	}
	if len(t.Env) == 0 {
		t.Env = nil
	}

	for _, service := range t.Services {
		service.Canonicalize(job.Name, tg.Name, t.Name)
	}

	// If Resources are nil initialize them to defaults, otherwise canonicalize
	if t.Resources == nil {
		t.Resources = DefaultResources()
	} else {
		t.Resources.Canonicalize()
	}

	// Set the default timeout if it is not specified.
	if t.KillTimeout == 0 {
		t.KillTimeout = DefaultKillTimeout
	}

	if t.Vault != nil {
		t.Vault.Canonicalize()
	}

	for _, template := range t.Templates {
		template.Canonicalize()
	}
}
1142368
func Normalize(platform specs.Platform) specs.Platform {
	platform.OS = normalizeOS(platform.OS)
	platform.Architecture, platform.Variant = normalizeArch(platform.Architecture, platform.Variant)

	// these fields are deprecated, remove them
	platform.OSFeatures = nil
	platform.OSVersion = ""

	return platform
}
743667
func (a *ActionDefinition) CanonicalScheme() string {
	if a.WebSocket() {
		for _, s := range a.EffectiveSchemes() {
			if s == "wss" {
				return s
			}
		}
		return "ws"
	}
	for _, s := range a.EffectiveSchemes() {
		if s == "https" {
			return s
		}
	}
	return "http"
}
798591
func (n *normalizedEndpoints) normalize(name string) string {
	n.mux.RLock()
	norm, ok := n.names[name]
	l := len(n.names)
	n.mux.RUnlock()
	if ok {
		return norm
	}
	if l >= n.maxSize {
		return ""
	}
	return n.normalizeWithLock(name)
}
189827
func (q *Quest_Desc) Normalize() error {
	if q.Meta == nil {
		q.Meta = &Quest_Desc_Meta{
			Retry:    &Quest_Desc_Meta_Retry{},
			Timeouts: &Quest_Desc_Meta_Timeouts{},
		}
	} else {
		if q.Meta.Retry == nil {
			q.Meta.Retry = &Quest_Desc_Meta_Retry{}
		}
		if q.Meta.Timeouts == nil {
			q.Meta.Timeouts = &Quest_Desc_Meta_Timeouts{}
		}
	}
	if err := q.Meta.Timeouts.Normalize(); err != nil {
		return err
	}

	length := len(q.Parameters) + len(q.DistributorParameters)
	if length > QuestDescPayloadMaxLength {
		return fmt.Errorf("quest payload is too large: %d > %d",
			length, QuestDescPayloadMaxLength)
	}
	normed, err := templateproto.NormalizeJSON(q.Parameters, true)
	if err != nil {
		return fmt.Errorf("failed to normalize parameters: %s", err)
	}
	q.Parameters = normed

	normed, err = templateproto.NormalizeJSON(q.DistributorParameters, true)
	if err != nil {
		return fmt.Errorf("failed to normalize distributor parameters: %s", err)
	}
	q.DistributorParameters = normed
	return nil
}
183277
func (c *client) Initialize(ctx context.Context) error {
	if c.initialized {
		return nil
	}

	// check schema for all registered entities
	registered := c.registrar.FindAll()
	if len(registered) == 0 {
		return errors.Errorf("No registered entities found")
	}

	eds := []*EntityDefinition{}
	for _, re := range registered {
		eds = append(eds, re.EntityDefinition())
	}

	// fetch latest version for all registered entities, assume order is preserved
	version, err := c.connector.CheckSchema(ctx, c.registrar.Scope(), c.registrar.NamePrefix(), eds)
	if err != nil {
		return errors.Wrap(err, "CheckSchema failed")
	}

	// set version for all registered entities
	for _, reg := range registered {
		reg.SetVersion(version)
	}
	c.initialized = true
	return nil
}
868135
func (u *User) CanonicalName() string {
	return C.GoString(C.sp_user_canonical_name(u.sp_user))
}
423182
func (a *ActionDefinition) Finalize() {
	// Inherit security scheme
	if a.Security == nil {
		a.Security = a.Parent.Security // ResourceDefinition
		if a.Security == nil {
			a.Security = Design.Security
		}
	}

	if a.Security != nil && a.Security.Scheme.Kind == NoSecurityKind {
		a.Security = nil
	}

	if a.Payload != nil {
		a.Payload.Finalize()
	}

	a.mergeResponses()
	a.initImplicitParams()
	a.initQueryParams()
}
1306196
func (i Name) CanonicalName() CanonicalName {
	return CanonicalName{
		Name: Name{
			Domain: i.Registry(),
			Image:  i.Repository(),
		},
	}
}