// Summary converts routes into a comma separated string.
766801
func (rs Routes) Summary() string {
	formattedRoutes := []string{}
	for _, route := range rs {
		formattedRoutes = append(formattedRoutes, route.String())
	}
	return strings.Join(formattedRoutes, ", ")
}
820609
func routes(action *design.ActionDefinition) string {
	var buf bytes.Buffer
	routes := action.Routes
	buf.WriteRune('[')
	if len(routes) > 1 {
		buf.WriteRune('(')
	}
	paths := make([]string, len(routes))
	for i, r := range routes {
		path := r.FullPath()
		matches := design.WildcardRegex.FindAllStringSubmatch(path, -1)
		for _, match := range matches {
			paramName := match[1]
			path = strings.Replace(path, ":"+paramName, strings.ToUpper(paramName), 1)
		}
		paths[i] = fmt.Sprintf("%q", path)
	}
	buf.WriteString(strings.Join(paths, "|"))
	if len(routes) > 1 {
		buf.WriteRune(')')
	}
	buf.WriteRune(']')
	return buf.String()
}
596364
func (r *Router) Routes() Routes {
	routes := make(Routes, len(r.routes))
	for i := 0; i < len(r.routes); i++ {
		routes[i] = r.routes[i]
	}

	for _, sr := range r.subrouters {
		routes = append(routes, sr.Routes()...)
	}

	return routes
}
401481
func synopsis(s string) string {

	parts := strings.SplitN(s, "\n\n", 2)
	s = parts[0]

	var buf []byte
	const (
		other = iota
		period
		space
	)
	last := space
Loop:
	for i := 0; i < len(s); i++ {
		b := s[i]
		switch b {
		case ' ', '\t', '\r', '\n':
			switch last {
			case period:
				break Loop
			case other:
				buf = append(buf, ' ')
				last = space
			}
		case '.':
			last = period
			buf = append(buf, b)
		default:
			last = other
			buf = append(buf, b)
		}
	}

	// Ensure that synopsis fits an App Engine datastore text property.
	const m = 400
	if len(buf) > m {
		buf = buf[:m]
		if i := bytes.LastIndex(buf, []byte{' '}); i >= 0 {
			buf = buf[:i]
		}
		buf = append(buf, " ..."...)
	}

	s = string(buf)

	r, n := utf8.DecodeRuneInString(s)
	if n < 0 || unicode.IsPunct(r) || unicode.IsSymbol(r) {
		// ignore Markdown headings, editor settings, Go build constraints, and * in poorly formatted block comments.
		s = ""
	} else {
		for _, prefix := range badSynopsisPrefixes {
			if strings.HasPrefix(s, prefix) {
				s = ""
				break
			}
		}
	}

	return s
}
988951
func DescribeRouteTables(cloud fi.Cloud, clusterName string) (map[string]*ec2.RouteTable, error) {
	c := cloud.(awsup.AWSCloud)

	routeTables := make(map[string]*ec2.RouteTable)
	glog.V(2).Info("Listing EC2 RouteTables")
	for _, filters := range buildEC2FiltersForCluster(clusterName) {
		request := &ec2.DescribeRouteTablesInput{
			Filters: filters,
		}
		response, err := c.EC2().DescribeRouteTables(request)
		if err != nil {
			return nil, fmt.Errorf("error listing RouteTables: %v", err)
		}

		for _, rt := range response.RouteTables {
			routeTables[aws.StringValue(rt.RouteTableId)] = rt
		}
	}

	return routeTables, nil
}
880666
func NewSummary(opts prometheus.SummaryOpts) prometheus.Summary {
	s := prometheus.NewSummary(opts)
	prometheus.MustRegister(s)
	return s
}
1166878
func summarizeResultsPython(results []taskResult) ([]byte, error) {
	var shards []map[string]interface{}

	for _, result := range results {
		buf, err := json.Marshal(result.result)
		if err != nil {
			return nil, err
		}

		var jsonResult map[string]interface{}
		if err := json.Unmarshal(buf, &jsonResult); err != nil {
			return nil, err
		}

		if jsonResult != nil {
			jsonResult["output"] = result.output
		}
		shards = append(shards, jsonResult)
	}

	return json.MarshalIndent(map[string]interface{}{
		"shards": shards,
	}, "", "  ")
}
370380
func (c *connectionBenchmark) summarize() *Summary {
	return &Summary{
		SuccessTotal:                c.successTotal,
		ErrorTotal:                  c.errorTotal,
		TimeElapsed:                 c.elapsed,
		SuccessHistogram:            hdrhistogram.Import(c.successHistogram.Export()),
		UncorrectedSuccessHistogram: hdrhistogram.Import(c.uncorrectedSuccessHistogram.Export()),
		ErrorHistogram:              hdrhistogram.Import(c.errorHistogram.Export()),
		UncorrectedErrorHistogram:   hdrhistogram.Import(c.uncorrectedErrorHistogram.Export()),
		Throughput:                  float64(c.successTotal+c.errorTotal) / c.elapsed.Seconds(),
		RequestRate:                 c.requestRate,
	}
}
1182146
func (r *Router) Route(
	ctx context.Context,
	rpcType protos.RPCType,
	svType string,
	route *route.Route,
	msg *message.Message,
) (*cluster.Server, error) {
	if r.serviceDiscovery == nil {
		return nil, constants.ErrServiceDiscoveryNotInitialized
	}
	serversOfType, err := r.serviceDiscovery.GetServersByType(svType)
	if err != nil {
		return nil, err
	}
	if rpcType == protos.RPCType_User {
		server := r.defaultRoute(serversOfType)
		return server, nil
	}
	routeFunc, ok := r.routesMap[svType]
	if !ok {
		logger.Log.Debugf("no specific route for svType: %s, using default route", svType)
		server := r.defaultRoute(serversOfType)
		return server, nil
	}
	return routeFunc(ctx, route, msg.Data, serversOfType)
}
191953
func (s *ServeMux) String() string {
	routes := make([]string, 0, 1)
	s.baseRoute.stringRoutes(&routes)

	buf := bytes.Buffer{}

	for _, route := range routes {
		buf.WriteString(route + "\n")
	}

	for host, baseRoute := range s.hostRoutes {
		routes = routes[0:0]
		baseRoute.stringRoutes(&routes)
		for _, route := range routes {
			buf.WriteString(host + route + "\n")
		}
	}

	return buf.String()
}
328067
func formatSummary(writer io.Writer, value interface{}) error {
	plans, ok := value.([]plan)
	if !ok {
		return errors.Errorf("expected value of type %T, got %T", plans, value)
	}
	tw := output.TabWriter(writer)
	p := func(values ...interface{}) {
		for _, v := range values {
			fmt.Fprintf(tw, "%s\t", v)
		}
		fmt.Fprintln(tw)
	}
	p("Plan", "Price")
	for _, plan := range plans {
		p(plan.URL, plan.Price)
	}
	tw.Flush()
	return nil
}
781404
func (f FileInfo) Summarize(wordcount int) (string, error) {
	fp, err := f.ctx.Root.Open(f.Name())
	if err != nil {
		return "", err
	}
	defer fp.Close()

	buf, err := ioutil.ReadAll(fp)
	if err != nil {
		return "", err
	}

	return string(summary.Markdown(buf, wordcount)), nil
}
1099311
func (fe *T) Route() string {
	fe.mu.Lock()
	route := fe.cfg.Route
	fe.mu.Unlock()
	return route
}
802937
func digests(summaries []archiver.IsolatedSummary) []string {
	var result []string
	for _, summary := range summaries {
		result = append(result, string(summary.Digest))
	}
	return result
}
461162
func (r *Route) stringRoutes(routes *[]string) {

	var thisRoute string

	// handle root node
	if r.fullPath == "" {
		thisRoute = "/"
	} else {
		thisRoute = r.fullPath
	}

	if len(r.handlers) > 0 {
		thisRoute = thisRoute + "\t["
		methods := make([]string, 0, 8)
		for method := range r.handlers {
			methods = append(methods, method)
		}
		thisRoute = thisRoute + strings.Join(methods, ", ") + "]"
		*routes = append(*routes, thisRoute)
	}

	// recursion
	for _, child := range r.getChildren() {
		child.stringRoutes(routes)
	}
}
587549
func (p Page) Summary() (summary string) {
	out, err := sanitize.HTMLAllowing(p.Body, []string{"p"})
	if err != nil {
		log.Println(err)
		return ""
	}
	if strings.Index(out, "\n") > 10 && strings.Index(out, "\n") < 255 {
		return strings.SplitN(out, "\n", 2)[0]
	}
	arr := strings.Split(out, " ")
	if len(arr) < 2 {
		return p.Body
	}
	var cnt = 0
	for i, v := range arr {
		cnt += len(v)
		if cnt > 255 {
			summary = strings.Join(arr[:i-1], " ")
			break
		}
	}
	return
}
1311466
func (s DeletionSummary) String() string {
	summary := fmt.Sprintf("%9d Blocks purged\n", s.Blocks)
	summary += fmt.Sprintf("%9d Vins purged\n", s.Vins)
	summary += fmt.Sprintf("%9d Vouts purged\n", s.Vouts)
	summary += fmt.Sprintf("%9d Addresses purged\n", s.Addresses)
	summary += fmt.Sprintf("%9d Transactions purged\n", s.Transactions)
	summary += fmt.Sprintf("%9d Tickets purged\n", s.Tickets)
	summary += fmt.Sprintf("%9d Votes purged\n", s.Votes)
	summary += fmt.Sprintf("%9d Misses purged", s.Misses)
	return summary
}