// Sanitize takes a partially initialized Identity (for example, deserialized
// from json) and reconstitutes the full object from what has been restored.
342345
func (id *Identity) Sanitize() {
	if id.Labels != nil {
		id.LabelArray = id.Labels.LabelArray()
	}
}
631401
func (m *MockRequester) Sanitize(arg0 []string) fosite.Requester {
	ret := m.ctrl.Call(m, "Sanitize", arg0)
	ret0, _ := ret[0].(fosite.Requester)
	return ret0
}
90902
func (s JSONSerializer) Deserialize(d []byte, ss *sessions.Session) error {
	m := make(map[string]interface{})
	err := json.Unmarshal(d, &m)
	if err != nil {
		fmt.Printf("redistore.JSONSerializer.deserialize() Error: %v", err)
		return err
	}
	for k, v := range m {
		ss.Values[k] = v
	}
	return nil
}
108830
func (s *FQDNSelector) sanitize() error {
	if len(s.MatchName) > 0 && !allowedMatchNameChars.MatchString(s.MatchName) {
		return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", s.MatchName)
	}

	if len(s.MatchPattern) > 0 && !allowedPatternChars.MatchString(s.MatchPattern) {
		return fmt.Errorf("Invalid characters in MatchPattern: \"%s\". Only 0-9, a-z, A-Z and ., - and * characters are allowed", s.MatchPattern)
	}
	_, err := matchpattern.Validate(s.MatchPattern)
	return err
}
997467
func sanitizeSlice(names []string) []string {
	sanitized := []string{}
	for _, n := range names {
		sanitized = append(sanitized, sanitize(n))
	}
	return sanitized
}
1032537
func (p *PrivateKey) Reinitialise() error {
	initP, err := PrivateKeyFromRawBytes(p.RawBytes(), p.CurveType)
	if err != nil {
		return err
	}
	*p = initP
	return nil
}
568133
func Deserialize(p []byte) (*structs.DevUsage, error) {
	u := &structs.DevUsage{}
	err := json.Unmarshal(p, u)
	if err != nil {
		return nil, err
	}
	return u, nil
}
240435
func sanitize(s string) string {
	t := ""
	for _, r := range s {
		if t == "" {
			if unicode.IsLetter(r) || r == '_' {
				t += string(r)
				continue
			}
		} else {
			if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {
				t += string(r)
				continue
			}
		}
		t += "_"
	}
	if t == "_" {
		t = "x"
	}
	return t
}
648957
func (r Rule) Sanitize() error {

	// reject cilium-generated labels on insert.
	// This isn't a proper function because r.Labels is a labels.LabelArray and
	// not a labels.Labels, where we could add a function similar to GetReserved
	for _, lbl := range r.Labels {
		if lbl.Source == labels.LabelSourceCiliumGenerated {
			return fmt.Errorf("rule labels cannot have cilium-generated source")
		}
	}

	if r.EndpointSelector.LabelSelector == nil {
		return fmt.Errorf("rule cannot have nil EndpointSelector")
	}

	if err := r.EndpointSelector.sanitize(); err != nil {
		return err
	}

	for i := range r.Ingress {
		if err := r.Ingress[i].sanitize(); err != nil {
			return err
		}
	}

	for i := range r.Egress {
		if err := r.Egress[i].sanitize(); err != nil {
			return err
		}
	}

	return nil
}
695499
func (s *Schema) Normalize() error {
	if s == nil {
		return errors.New("is nil")
	}
	if s.Schema == nil {
		return errors.New("has no type")
	}
	if enum := s.GetEnum(); enum != nil {
		return enum.Normalize()
	}
	return nil
}
366549
func (a *Execution_Auth) Normalize() error {
	if a == nil {
		return errors.New("Execution_Auth is nil")
	}
	if a.Id == nil {
		return errors.New("Execution_Auth.Id is nil")
	}
	return nil
}
4425
func decapitalise(input string) string {
	if len(input) == 0 {
		return input
	}

	goForm := abi.ToCamelCase(input)
	return strings.ToLower(goForm[:1]) + goForm[1:]
}
1057231
func (s *SecuritySchemeDefinition) Finalize() {
	tu, _ := url.Parse(s.TokenURL)         // validated in Validate
	au, _ := url.Parse(s.AuthorizationURL) // validated in Validate
	tokenOK := s.TokenURL == "" || tu.IsAbs()
	authOK := s.AuthorizationURL == "" || au.IsAbs()
	if tokenOK && authOK {
		return
	}
	var scheme string
	if len(Design.Schemes) > 0 {
		scheme = Design.Schemes[0]
	}
	if !tokenOK {
		tu.Scheme = scheme
		tu.Host = Design.Host
		s.TokenURL = tu.String()
	}
	if !authOK {
		au.Scheme = scheme
		au.Host = Design.Host
		s.AuthorizationURL = au.String()
	}
}
414505
func sanitizePackageName(pkgName string) string {
	pkgName = strings.Replace(pkgName, ".", "_", -1)
	pkgName = strings.Replace(pkgName, "-", "_", -1)
	return pkgName
}
1169299
func sanitizeSynopsis(f *doc.Func) string {
	synopsis := doc.Synopsis(f.Doc)

	// If the synopsis begins with the function name, remove it. This is done to
	// not repeat the text.
	// From:
	// clean	Clean removes the temporarily generated files
	// To:
	// clean 	removes the temporarily generated files
	if syns := strings.Split(synopsis, " "); strings.EqualFold(f.Name, syns[0]) {
		return strings.Join(syns[1:], " ")
	}

	return synopsis
}
8368
func (t *File_Template) Normalize() error {
	if t.Body == "" {
		return errors.New("body is empty")
	}

	defaultParams := make(map[string]*Value, len(t.Param))
	for k, param := range t.Param {
		if k == "" {
			return fmt.Errorf("param %q: invalid name", k)
		}
		if !ParamRegex.MatchString(k) {
			return fmt.Errorf("param %q: malformed name", k)
		}
		if !strings.Contains(t.Body, k) {
			return fmt.Errorf("param %q: not present in body", k)
		}
		if err := param.Normalize(); err != nil {
			return fmt.Errorf("param %q: %s", k, err)
		}
		if param.Default != nil {
			defaultParams[k] = param.Default
		} else {
			defaultParams[k] = param.Schema.Zero()
		}
	}

	maybeJSON, err := t.Render(defaultParams)
	if err != nil {
		return fmt.Errorf("rendering: %s", err)
	}

	err = json.Unmarshal([]byte(maybeJSON), &map[string]interface{}{})
	if err != nil {
		return fmt.Errorf("parsing rendered body: %s", err)
	}
	return nil
}
158651
func sanitizePath(p string) (ret key) {
	if p == "" {
		return
	}
	ret = key(path.Clean("/" + p))
	if ret[0] == '/' {
		ret = ret[1:]
	}
	return
}