// Formatting function used to implement the %package% code
490259
func ioOutputFormatPackage(ld *LineData, b *bytes.Buffer) error {
	_, err := b.WriteString(ld.CallingPackage)
	return err
}
837999
func (t *ConsoleFormatter) FormatSkip(errin error, skip int) (errtext string, err error) {
	errobj := castErrorObject(nil, skip+1, errin)
	if errobj == nil {
		return "", nil
	}

	buffer := &bytes.Buffer{}

	if t.TimeFormat != "" {
		if _, errio := buffer.WriteString(time.Now().Format(t.TimeFormat)); errio != nil {
			return buffer.String(), errio
		}
	}

	if t.LongFile || t.ShortFile {
		if _, errio := WriteCallInfo(buffer, errobj, t.LongFile, t.Line, t.ReplacePackages); errio != nil {
			return buffer.String(), errio
		}
		if _, errio := buffer.WriteString(" "); errio != nil {
			return buffer.String(), errio
		}
	}

	if t.Seperator == "" {
		if _, errio := buffer.WriteString(getErrorText(errin)); errio != nil {
			return buffer.String(), errio
		}
		return buffer.String(), nil
	}

	firstError := true
	if walkerr := WalkErrors(errobj, func(errloop ErrorObject) (stop bool, walkerr error) {
		if !firstError {
			if _, errio := buffer.WriteString(t.Seperator); errio != nil {
				return true, errio
			}
		}
		firstError = false

		if _, errio := buffer.WriteString(getErrorText(errloop)); errio != nil {
			return true, errio
		}
		return false, nil
	}); walkerr != nil {
		return buffer.String(), walkerr
	}

	return buffer.String(), nil
}
171626
func parseFormatStyleSet(style string) (*formatStyle, error) {
	format := formatStyle{
		DecimalPlaces: 2,
	}
	err := json.Unmarshal([]byte(style), &format)
	return &format, err
}
222185
func (s ShortFuncFormatter) Format(w io.Writer, entry zapcore.Entry, fields []zapcore.Field) {
	f := runtime.FuncForPC(entry.Caller.PC)
	if f == nil {
		fmt.Fprintf(w, s.FormatVerb, "(unknown)")
		return
	}

	fname := f.Name()
	funcIdx := strings.LastIndex(fname, ".")
	fmt.Fprintf(w, s.FormatVerb, fname[funcIdx+1:])
}
1341030
func NewFormatter() *Formatter {
	return &Formatter{
		KeyColor:        color.New(color.FgBlue, color.Bold),
		StringColor:     color.New(color.FgGreen, color.Bold),
		BoolColor:       color.New(color.FgYellow, color.Bold),
		NumberColor:     color.New(color.FgCyan, color.Bold),
		NullColor:       color.New(color.FgBlack, color.Bold),
		StringMaxLength: 0,
		DisabledColor:   false,
		Indent:          2,
		Newline:         "\n",
	}
}
1014257
func (a *DerivativeAggregation) Format(format string) *DerivativeAggregation {
	a.format = format
	return a
}
744065
func (f *formatter) formatSci(b []byte, adj int, e byte) {
	f.WriteByte(b[0])

	if len(b) > 1 {
		f.WriteByte('.')
		f.Write(b[1:])
	}

	// If negative, the call to strconv.Itoa will add the minus sign for us.
	f.WriteByte(e)
	if adj > 0 {
		f.WriteByte('+')
	}
	f.WriteString(strconv.Itoa(adj))
}
1051382
func (e Error) formatParams() string {
	if e.Params == nil || len(e.Params) == 0 {
		return "[]"
	}

	var keyValuePairs []struct {
		key   string
		value string
	}

	for k, v := range e.Params {
		keyValuePairs = append(keyValuePairs, struct {
			key   string
			value string
		}{
			key:   k,
			value: v,
		})
	}
	sort.Slice(keyValuePairs, func(i, j int) bool {
		return keyValuePairs[i].key < keyValuePairs[j].key
	})

	result := "["
	l := len(keyValuePairs)
	for i, kvp := range keyValuePairs {
		result += kvp.key + ":" + kvp.value
		if i < l-1 {
			result += ", "
		}
	}
	result += "]"
	return result
}
1317401
func formatToA(i int, v string) string {
	f, err := strconv.ParseFloat(v, 64)
	if err != nil {
		return v
	}
	if f < 0 {
		t := int(math.Abs(f))
		return fmt.Sprintf("(%d)", t)
	}
	t := int(f)
	return fmt.Sprintf("%d", t)
}
936021
func (a Address) Format(s fmt.State, c rune) {
	fmt.Fprintf(s, "%"+string(c), a[:])
}
821343
func formatOutput(data interface{}, format string) ([]byte, error) {
	var out string

	switch format {

	case "json":
		jsonout, err := json.MarshalIndent(data, "", "  ")
		if err != nil {
			return nil, err
		}
		out = string(jsonout)

	case "text":
		out = data.(fmt.Stringer).String()

	default:
		return nil, fmt.Errorf("Invalid output format \"%s\"", format)

	}
	return []byte(prepareOutput(out)), nil
}
779280
func interpolationFuncFormat() ast.Function {
	return ast.Function{
		ArgTypes:     []ast.Type{ast.TypeString},
		Variadic:     true,
		VariadicType: ast.TypeAny,
		ReturnType:   ast.TypeString,
		Callback: func(args []interface{}) (interface{}, error) {
			format := args[0].(string)
			return fmt.Sprintf(format, args[1:]...), nil
		},
	}
}
493911
func formatList(in []string) string {
	columnConf := columnize.DefaultConfig()
	columnConf.Empty = "<none>"
	return columnize.Format(in, columnConf)
}
756571
func FormatMap(m map[string]string) (fmtStr string) {
	// output with keys in sorted order to provide stable output
	keys := sets.NewString()
	for key := range m {
		keys.Insert(key)
	}
	for _, key := range keys.List() {
		fmtStr += fmt.Sprintf("%v=%q\n", key, m[key])
	}
	fmtStr = strings.TrimSuffix(fmtStr, "\n")

	return
}
692833
func (f Function) ExecCode() (string, error) {
	name := f.Name
	if f.Receiver != "" {
		name = f.Receiver + "{}." + name
	}
	if f.Package != "" {
		name = f.Package + "." + name
	}

	if f.IsContext && f.IsError {
		out := `
			wrapFn := func(ctx context.Context) error {
				return %s(ctx)
			}
			err := runTarget(wrapFn)`[1:]
		return fmt.Sprintf(out, name), nil
	}
	if f.IsContext && !f.IsError {
		out := `
			wrapFn := func(ctx context.Context) error {
				%s(ctx)
				return nil
			}
			err := runTarget(wrapFn)`[1:]
		return fmt.Sprintf(out, name), nil
	}
	if !f.IsContext && f.IsError {
		out := `
			wrapFn := func(ctx context.Context) error {
				return %s()
			}
			err := runTarget(wrapFn)`[1:]
		return fmt.Sprintf(out, name), nil
	}
	if !f.IsContext && !f.IsError {
		out := `
			wrapFn := func(ctx context.Context) error {
				%s()
				return nil
			}
			err := runTarget(wrapFn)`[1:]
		return fmt.Sprintf(out, name), nil
	}
	return "", fmt.Errorf("Error formatting ExecCode code for %#v", f)
}
361852
func formatToInt(i int, v string) string {
	f, err := strconv.ParseFloat(v, 64)
	if err != nil {
		return v
	}
	return fmt.Sprintf("%d", int(f))
}
651757
func (m ModuleFormatter) Format(w io.Writer, entry zapcore.Entry, fields []zapcore.Field) {
	fmt.Fprintf(w, m.FormatVerb, entry.LoggerName)
}