// TagAttr returns the lower-cased key and unescaped value of the next unparsed
// attribute for the current tag token and whether there are more attributes.
// The contents of the returned slices may change on the next call to Next.
1424
func (z *Tokenizer) TagAttr() (key, val []byte, moreAttr bool) {
	if z.nAttrReturned < len(z.attr) {
		switch z.tt {
		case StartTagToken, SelfClosingTagToken:
			x := z.attr[z.nAttrReturned]
			z.nAttrReturned++
			key = z.buf[x[0].start:x[0].end]
			val = z.buf[x[1].start:x[1].end]
			return lower(key), unescape(convertNewlines(val), true), z.nAttrReturned < len(z.attr)
		}
	}
	return nil, nil, false
}
445729
func (h *XMLElement) Attr(k string) string {
	if h.isHTML {
		for _, a := range h.attributes.([]html.Attribute) {
			if a.Key == k {
				return a.Val
			}
		}
	} else {
		for _, a := range h.attributes.([]xml.Attr) {
			if a.Name.Local == k {
				return a.Value
			}
		}
	}
	return ""
}
1311877
func (i *Index) TagValueIterator(name, key []byte) (tsdb.TagValueIterator, error) {
	a := make([]tsdb.TagValueIterator, 0, len(i.partitions))
	for _, p := range i.partitions {
		itr, err := p.TagValueIterator(name, key)
		if err != nil {
			for _, itr := range a {
				itr.Close()
			}
			return nil, err
		} else if itr != nil {
			a = append(a, itr)
		}
	}
	return tsdb.MergeTagValueIterators(a...), nil
}
534611
func (t *PEP425Tag) TagString() string {
	return strings.Join([]string{t.Python, t.Abi, t.Platform}, "-")
}
639468
func tagsFromMapECR(m map[string]interface{}) []*ecr.Tag {
	result := make([]*ecr.Tag, 0, len(m))
	for k, v := range m {
		t := &ecr.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredECR(t) {
			result = append(result, t)
		}
	}

	return result
}
40812
func (s *Selection) Attr(attrName string) (val string, exists bool) {
	if len(s.Nodes) == 0 {
		return
	}
	return getAttributeValue(attrName, s.Nodes[0])
}
70039
func GetAttrs(e Markup, f, val string) []*Attribute {

	var found []*Attribute

	for _, as := range e.Attributes() {
		if as.Name != f {
			continue
		}

		if val != "" {
			if !strings.Contains(as.Value, val) {
				continue
			}
		}

		found = append(found, as)
	}

	return found
}
471008
func (r *Row) tagsKeys() []string {
	a := make([]string, 0, len(r.Tags))
	for k := range r.Tags {
		a = append(a, k)
	}
	sort.Strings(a)
	return a
}
830096
func (h *XMLElement) ChildAttrs(xpathQuery, attrName string) []string {
	var res []string
	if h.isHTML {
		for _, child := range htmlquery.Find(h.DOM.(*html.Node), xpathQuery) {
			for _, attr := range child.Attr {
				if attr.Key == attrName {
					res = append(res, strings.TrimSpace(attr.Val))
				}
			}
		}
	} else {
		xmlquery.FindEach(h.DOM.(*xmlquery.Node), xpathQuery, func(i int, child *xmlquery.Node) {
			for _, attr := range child.Attr {
				if attr.Name.Local == attrName {
					res = append(res, strings.TrimSpace(attr.Value))
				}
			}
		})
	}
	return res
}
205451
func (t *Templates) SetAttr(key string, value interface{}) (err error) {
	if _, exists := t.locals[key]; exists {
		err = fmt.Errorf("templates: overwriting key %s in attrs", key)
	}
	t.locals[key] = value
	return
}
1079527
func (l *Logger) SetAttr(name string, val interface{}) {
	l.attrs[name] = val
}
449162
func (f *IndexFile) TagKeyIterator(name []byte) TagKeyIterator {
	blk := f.tblks[string(name)]
	if blk == nil {
		return nil
	}
	return blk.TagKeyIterator()
}
1274608
func (b *BoolWrapper) UnmarshalXMLAttr(attr xml.Attr) error {
	*b = false
	if strings.ToLower(attr.Value) == "true" {
		*b = true
	}

	return nil
}
646426
func GetAttr(e Markup, f string) (*Attribute, error) {
	for _, as := range e.Attributes() {
		if as.Name == f {
			return as, nil
		}
	}
	return nil, ErrNotFound
}
1010001
func tagOptionParser(doc *p2.Parser, start *p2.Token, arguments *p2.Parser) (p2.INodeTag, *p2.Error) {
	var field string
	typeToken := arguments.MatchType(p2.TokenIdentifier)
	if typeToken != nil {
		field = typeToken.Val
	} else if sToken := arguments.MatchType(p2.TokenString); nil != sToken {
		field = sToken.Val
	} else {
		return nil, arguments.Error("Expected an identifier or string.", nil)
	}

	expr, err := arguments.ParseExpression()
	if err != nil {
		return nil, err
	}

	var v *tagOptionNode
	if sToken := arguments.MatchType(p2.TokenString); nil != sToken {
		v = &tagOptionNode{Pongo2BaseTag: Pongo2BaseTag{field: field},
			value: expr,
			label: sToken.Val}
	} else {
		return nil, arguments.Error("Expected an string.", nil)
	}
	return &INodeImplied{Exec: func(ctx *p2.ExecutionContext, w p2.TemplateWriter) *p2.Error {
		return v.Execute(ctx, w)
	}}, nil
}
113957
func (g *Game) GetTagPair(k string) *TagPair {
	for _, tag := range g.tagPairs {
		if tag.Key == k {
			return tag
		}
	}
	return nil
}
1352491
func (s *Selection) SetAttr(attrName, val string) *Selection {
	for _, n := range s.Nodes {
		attr := getAttributePtr(attrName, n)
		if attr == nil {
			n.Attr = append(n.Attr, html.Attribute{Key: attrName, Val: val})
		} else {
			attr.Val = val
		}
	}

	return s
}