// POSTagShortcut is a shortcut function to help the POSTagger shortcircuit some decisions about what the tag is
493171
func POSTagShortcut(l Lexeme) (POSTag, bool) {
	switch l.LexemeType {
	case Number:
		return NUM, true
	case Punctuation:
		return PUNCT, true
	case Symbol:
		return SYM, true
	case URI:
		return X, true
	case Date:
		return NUM, true
	case Time:
		return NUM, true
	case EOF:
		return X, true
	}
	return X, false
}
1281290
func MustParseClientGenTags(lines []string) Tags {
	tags, err := ParseClientGenTags(lines)
	if err != nil {
		panic(err.Error())
	}
	return tags
}
389406
func (slice TagSlice) AppDataTags() map[string][]*Tag {
	appData := make(map[string][]*Tag)
	appTags := make([]*Tag, 0)

	for _, tag := range slice {
		if tag.Code == appDataMarker {
			if tag.Value.ToString() == "}" {
				appTags = append(appTags, tag)
				appData[appTags[0].Value.ToString()] = appTags
				appTags = appTags[:0]
			} else {
				appTags = appTags[:0]
				appTags = append(appTags, tag)
			}
		} else {
			if len(appTags) > 0 {
				appTags = append(appTags, tag)
			}
		}
	}

	return appData
}
1128163
func (s *Server) HandleDeleteShortcut(c web.C, w http.ResponseWriter, r *http.Request) {
	err := s.Store.Delete(fmt.Sprintf("/shortcuts/%s", c.URLParams["id"]))
	if err != nil {
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}
	w.WriteHeader(http.StatusNoContent)
}
978968
func ParseImageStreamTagName(istag string) (name string, tag string, err error) {
	if strings.Contains(istag, "@") {
		err = fmt.Errorf("%q is an image stream image, not an image stream tag", istag)
		return
	}
	segments := strings.SplitN(istag, ":", 3)
	switch len(segments) {
	case 2:
		name = segments[0]
		tag = segments[1]
		if len(name) == 0 || len(tag) == 0 {
			err = fmt.Errorf("image stream tag name %q must have a name and a tag", istag)
		}
	default:
		err = fmt.Errorf("expected exactly one : delimiter in the istag %q", istag)
	}
	return
}
1197354
func tagsFromMapRDS(m map[string]interface{}) []*rds.Tag {
	result := make([]*rds.Tag, 0, len(m))
	for k, v := range m {
		t := &rds.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredRDS(t) {
			result = append(result, t)
		}
	}

	return result
}
509218
func tagsToMap(ts []*ec2.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnored(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
790571
func (a *Client) PostTags(params *PostTagsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTagsCreated, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "PostTags",
		Method:             "POST",
		PathPattern:        "/tags",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &PostTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PostTagsCreated), nil
}
889345
func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error {
	return flags.SetAnnotation(name, BashCompCustom, []string{f})
}
706434
func FindASGTag(tags []*autoscaling.TagDescription, key string) (string, bool) {
	for _, tag := range tags {
		if key == aws.StringValue(tag.Key) {
			return aws.StringValue(tag.Value), true
		}
	}
	return "", false
}
593461
func autoscalingTagsFromMap(m map[string]interface{}, resourceID string) ([]*autoscaling.Tag, error) {
	result := make([]*autoscaling.Tag, 0, len(m))
	for _, v := range m {
		attr, ok := v.(map[string]interface{})
		if !ok {
			continue
		}

		t, err := autoscalingTagFromMap(attr, resourceID)
		if err != nil {
			return nil, err
		}

		if t != nil {
			result = append(result, t)
		}
	}

	return result, nil
}
1110188
func (p Paginator) Tag(opts Options) (*Tag, error) {
	// return an empty div if there is only 1 page
	if p.TotalPages <= 1 {
		return New("div", Options{}), nil
	}

	path, class, wing := extractBaseOptions(opts)
	opts["class"] = strings.Join([]string{class, "pagination"}, " ")

	t := New("ul", opts)

	barLength := wing*2 + 1
	center := wing + 1
	loopStart := 1
	loopEnd := p.TotalPages

	li, err := p.addPrev(opts, path)
	if err != nil {
		return t, errors.WithStack(err)
	}
	t.Append(li)

	if p.TotalPages > barLength {
		loopEnd = barLength - 2 // range 1 ~ center
		if p.Page > center {    /// range center
			loopStart = p.Page - wing + 2
			loopEnd = loopStart + barLength - 5
			li, err := pageLI("1", 1, path, p)
			if err != nil {
				return t, errors.WithStack(err)
			}
			t.Append(li)
			t.Append(pageLIDummy())
		}
		if p.Page > (p.TotalPages - wing - 1) {
			loopEnd = p.TotalPages
			loopStart = p.TotalPages - barLength + 3
		}
	}

	for i := loopStart; i <= loopEnd; i++ {
		li, err := pageLI(strconv.Itoa(i), i, path, p)
		if err != nil {
			return t, errors.WithStack(err)
		}
		t.Append(li)
	}

	if p.TotalPages > loopEnd {
		t.Append(pageLIDummy())
		label := strconv.Itoa(p.TotalPages)
		li, err := pageLI(label, p.TotalPages, path, p)
		if err != nil {
			return t, errors.WithStack(err)
		}
		t.Append(li)
	}

	li, err = p.addNext(opts, path)
	if err != nil {
		return t, errors.WithStack(err)
	}
	t.Append(li)

	return t, nil
}
614784
func (slice TagSlice) XDataTags() []*Tag {
	tags := make([]*Tag, 0)

	for _, tag := range slice {
		if tag.Code > 999 {
			tags = append(tags, tag)
		}
	}

	return tags
}
954954
func (t *tree) textOrTag(token item, until []itemType) (node ast.Node, halt bool) {
	var seenComment = token.typ == itemComment
	for token.typ == itemComment {
		token = t.next() // skip any comments
	}

	// Two ways to end a list:
	// 1. We found the until token (e.g. EOF)
	if isOneOf(token.typ, until) {
		return nil, true
	}

	// 2. The until token is a command, e.g. {else} {/template}
	var token2 = t.next()
	if token.typ == itemLeftDelim && isOneOf(token2.typ, until) {
		return nil, true
	}

	t.backup()
	switch token.typ {
	case itemText:
		var text = token.val
		var next item
		for {
			next = t.next()
			if next.typ != itemText {
				break
			}
			text += next.val
		}
		t.backup()
		var textvalue = rawtext(text, seenComment, next.typ == itemComment)
		if len(textvalue) == 0 {
			return nil, false
		}
		return &ast.RawTextNode{token.pos, textvalue}, false
	case itemLeftDelim:
		return t.beginTag(), false
	case itemSoyDocStart:
		return t.parseSoyDoc(token), false
	default:
		t.unexpected(token, "input")
	}
	return nil, false
}
836367
func Tag(c context.Context, v string) context.Context {
	return context.WithValue(c, &clockTagKey, append(Tags(c), v))
}
18888
func (slice TagSlice) SubclassesTags() map[string][]*Tag {
	classes := make(map[string][]*Tag)
	tags := make([]*Tag, 0)
	name := "noname"

	for _, tag := range slice.RegularTags() {
		if tag.Code == subclassMarker {
			classes[name] = tags
			tags = tags[:0]
			name = tag.Value.ToString()
		} else {
			tags = append(tags, tag)
		}
	}
	classes[name] = tags
	return classes
}
391607
func SortStatusTags(tags map[string]TagEventList) []string {
	tagSlice := make([]tag, len(tags))
	index := 0
	for tag, list := range tags {
		tagSlice[index].Name = tag
		if len(list.Items) > 0 {
			tagSlice[index].Created = list.Items[0].Created.Round(time.Second)
		}
		index++
	}

	sort.Sort(byCreationTimestamp(tagSlice))

	actual := make([]string, len(tagSlice))
	for i, tag := range tagSlice {
		actual[i] = tag.Name
	}

	return actual
}