// Expands a link with possible, otherwise it expands the default link
328714
func ExpandWithDefault(link *Hyperlink, defaultLink *Hyperlink, params M) (u *url.URL, err error) {
	if link == nil {
		link = defaultLink
	}

	return link.Expand(params)
}
35814
func (l Links) Self(href string, args ...interface{}) Links {
	return l.Link("self", href, args...)
}
190834
func Expand(s string, fns ...KeyFunc) string {
	val, _ := ExpandStrict(s, append(fns, Empty)...)
	return val
}
1351291
func ExpandPath(path string) string {
	usr, err := user.Current()
	if err != nil {
		return path
	}

	if path == "~" {
		return usr.HomeDir
	} else if strings.HasPrefix(path, "~/") {
		return filepath.Join(usr.HomeDir, path[2:])
	}

	return path
}
190418
func (s *IndicesCloseService) ExpandWildcards(expandWildcards string) *IndicesCloseService {
	s.expandWildcards = expandWildcards
	return s
}
1159674
func NewEmptyLink(label string) *Link {
	return &Link{Link: model.Link{Label: label}}
}
250266
func (s *ScrollService) ExpandWildcards(expandWildcards string) *ScrollService {
	s.expandWildcards = expandWildcards
	return s
}
1180614
func (self *Graph) Link(source, target uint32, weight float64) {
	if _, ok := self.nodes[source]; ok == false {
		self.nodes[source] = &node{
			weight:   0,
			outbound: 0,
		}
	}

	self.nodes[source].outbound += weight

	if _, ok := self.nodes[target]; ok == false {
		self.nodes[target] = &node{
			weight:   0,
			outbound: 0,
		}
	}

	if _, ok := self.edges[source]; ok == false {
		self.edges[source] = map[uint32]float64{}
	}

	self.edges[source][target] += weight
}
863509
func (s *IndicesGetMappingService) ExpandWildcards(expandWildcards string) *IndicesGetMappingService {
	s.expandWildcards = expandWildcards
	return s
}
724444
func (b *base) link(from string) error {
	debug("symlinking %s to %s", from, b.Path())
	return os.Symlink(from, b.Path())
}
237982
func (a *Artist) Link() *Link {
	sp_link := C.sp_link_create_from_artist(a.sp_artist)
	return newLink(a.session, sp_link, false)
}
1056299
func NewLink(options ...JITOption) (*LinkState, error) {
	link := &LinkState{}

	argcount, args, argvals := link.encodeArguments(options)
	err := result(C.cuLinkCreate(argcount, args, argvals, &link.state))
	return link, err
}
643953
func (c *ConstantStruct) Link(scope Scope, t TypeSpec) (ConstantValue, error) {
	s, ok := RootTypeSpec(t).(*StructSpec)
	if !ok {
		return nil, constantValueCastError{Value: c, Type: t}
	}

	for _, field := range s.Fields {
		f, ok := c.Fields[field.Name]
		if !ok {
			if field.Default == nil {
				if field.Required {
					return nil, constantValueCastError{
						Value:  c,
						Type:   t,
						Reason: fmt.Errorf("%q is a required field", field.Name),
					}
				}
				continue
			}
			f = field.Default
			c.Fields[field.Name] = f
		}

		f, err := f.Link(scope, field.Type)
		if err != nil {
			return nil, constantValueCastError{
				Value: c,
				Type:  t,
				Reason: constantStructFieldCastError{
					FieldName: field.Name,
					Reason:    err,
				},
			}
		}

		c.Fields[field.Name] = f
	}

	return c, nil
}
365037
func AddLink(link *Link, obj ModelObj) {
	link.ObjType = obj.GetType()
	link.ObjKey = obj.GetKey()
}
1197520
func (s *IndicesOpenService) ExpandWildcards(expandWildcards string) *IndicesOpenService {
	s.expandWildcards = expandWildcards
	return s
}
1313946
func Expand(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {
	s := p.Get("content", "").(string)

	// TODO: We could easily add support here for Expand().

	return os.ExpandEnv(s), nil
}
308220
func (l Links) Add(rel string, links ...Link) Links {
	if l.Items == nil {
		l.Items = make(map[string]linkSet)
	}

	set, exists := l.Items[rel]

	if exists {
		set = append(set, links...)
	} else {
		set = make([]Link, len(links))
		copy(set, links)
	}

	l.Items[rel] = set

	return l
}