// TrimNamed removes any tag or digest from the named reference.
182919
func TrimNamed(ref Named) Named {
	domain, path := SplitHostname(ref)
	return repository{
		domain: domain,
		path:   path,
	}
}
852079
func (mc MongoClient) DeleteRegistrationByName(name string) error {
	return mc.deleteRegistration(bson.M{"name": name})
}
486324
func (actor Actor) DeleteIsolationSegmentByName(name string) (Warnings, error) {
	isolationSegment, warnings, err := actor.GetIsolationSegmentByName(name)
	allWarnings := append(Warnings{}, warnings...)
	if err != nil {
		return allWarnings, err
	}

	apiWarnings, err := actor.CloudControllerClient.DeleteIsolationSegment(isolationSegment.GUID)
	return append(allWarnings, apiWarnings...), err
}
653337
func (repo *Repository) DeleteTag(name string) error {
	cmd := NewCommand("tag", "-d")

	cmd.AddArguments(name)
	_, err := cmd.RunInDir(repo.Path)

	return err
}
629610
func (b *UpdateBuilder) TimestampNamed(name string) *UpdateBuilder {
	b.using.TimestampNamed(name)
	return b
}
1177778
func TagNameOnly(ref Named) Named {
	if IsNameOnly(ref) {
		namedTagged, err := WithTag(ref, defaultTag)
		if err != nil {
			// Default tag must be valid, to create a NamedTagged
			// type with non-validated input the WithTag function
			// should be used instead
			panic(err)
		}
		return namedTagged
	}
	return ref
}
1224410
func (i *Info) Namespaced() bool {
	return i.Mapping != nil && i.Mapping.Scope.Name() == meta.RESTScopeNameNamespace
}
1097484
func (m *MemoryCache) trim() {
	m.object = make(map[string]Object)
	m.memoryUsage = 0
}
981275
func CancelNamedMutations(c context.Context, parent *ds.Key, names ...string) error {
	toDel := make([]*ds.Key, 0, len(names))
	nameSet := stringset.NewFromSlice(names...)
	nameSet.Iter(func(name string) bool {
		toDel = append(toDel, ds.NewKey(c, "tumble.Mutation", "n:"+name, 0, parent))
		return true
	})
	err := ds.Delete(c, toDel)
	numFailed := int64(0)
	if me, ok := err.(errors.MultiError); ok {
		numFailed = int64(len(me))
	}
	metricDeleted.Add(c, int64(len(toDel))-numFailed, parent.Namespace())
	return errors.Filter(err, ds.ErrNoSuchEntity)
}
702249
func trim(s []byte) []byte {
	i := 0
	for i < len(s) && isSpace(s[i]) {
		i++
	}
	n := len(s)
	for n > i && isSpace(s[n-1]) {
		n--
	}
	return s[i:n]
}
1075721
func (ns *Namespace) TrimRight(cutset, s interface{}) (string, error) {
	ss, err := cast.ToStringE(s)
	if err != nil {
		return "", err
	}

	sc, err := cast.ToStringE(cutset)
	if err != nil {
		return "", err
	}

	return _strings.TrimRight(ss, sc), nil
}
1223024
func (s *RedisQueueStore) Trim(key string, length int) error {
	if !strings.HasPrefix(key, s.prefix) {
		key = s.prefix + key
	}
	err := s.client.LTrim(key, 0, int64(length-1)).Err()
	if err == redis.Nil {
		return nil
	}
	return err
}
323188
func (c *nameCoordinator) Remove(names []string) {
	c.mu.Lock()
	for _, name := range names {
		delete(c.names, strings.ToLower(name))
	}
	c.mu.Unlock()
}
1194022
func (ns *Namespace) TrimPrefix(prefix, s interface{}) (string, error) {
	ss, err := cast.ToStringE(s)
	if err != nil {
		return "", err
	}

	sx, err := cast.ToStringE(prefix)
	if err != nil {
		return "", err
	}

	return _strings.TrimPrefix(ss, sx), nil
}
305589
func trim(chunk string) (string, string, string) {
	code := strings.TrimSpace(chunk)
	wsl := chunk[:strings.Index(chunk, code)]
	wsr := chunk[len(wsl)+len(code):]
	return wsl, code, wsr
}
1137579
func trimSheetName(name string) string {
	if strings.ContainsAny(name, ":\\/?*[]") || utf8.RuneCountInString(name) > 31 {
		r := make([]rune, 0, 31)
		for _, v := range name {
			switch v {
			case 58, 92, 47, 63, 42, 91, 93: // replace :\/?*[]
				continue
			default:
				r = append(r, v)
			}
			if len(r) == 31 {
				break
			}
		}
		name = string(r)
	}
	return name
}
1148791
func TrimStrings(items []string) []string {
	ret := make([]string, len(items))
	for i, item := range items {
		ret[i] = strings.TrimSpace(item)
	}
	return ret
}