// NewFormat returns a Format for rendering using a network Context
765121
func NewFormat(source string, quiet bool) formatter.Format {
	switch source {
	case formatter.TableFormatKey:
		if quiet {
			return formatter.DefaultQuietFormat
		}
		return defaultNetworkTableFormat
	case formatter.RawFormatKey:
		if quiet {
			return `network_id: {{.ID}}`
		}
		return `network_id: {{.ID}}\nname: {{.Name}}\ndriver: {{.Driver}}\nscope: {{.Scope}}\n`
	}
	return formatter.Format(source)
}
414990
func nbParamInFormat(f string) int {
	return strings.Count(f, "%") - 2*strings.Count(f, "%%")
}
8103
func (s *CreateJobPlaylist) SetFormat(v string) *CreateJobPlaylist {
	s.Format = &v
	return s
}
882945
func createFormatter(name string, kind string) (Formatter, error) {
	if kind == FormatEnv {
		kind = logxiFormat
	}
	if kind == "" {
		kind = FormatText
	}

	fn := formatterCreators[kind]
	if fn == nil {
		fn = formatterCreators[FormatText]
	}

	formatter, err := fn(name, kind)
	if err != nil {
		return nil, err
	}
	// custom formatter may have not returned a formatter
	if formatter == nil {
		formatter, err = formatFactory(name, FormatText)
	}
	return formatter, err
}
390903
func (s *BusinessReportSchedule) SetFormat(v string) *BusinessReportSchedule {
	s.Format = &v
	return s
}
347239
func (h *DatabaseBackupHistory) FormatCreatedAt(layout string) string {
	return h.CreatedAt.Format(layout)
}
423899
func (s *CreateIPSetInput) SetFormat(v string) *CreateIPSetInput {
	s.Format = &v
	return s
}
1245688
func (s *GetIPSetOutput) SetFormat(v string) *GetIPSetOutput {
	s.Format = &v
	return s
}
123372
func NewDiskUsageFormat(source string, verbose bool) Format {
	switch {
	case verbose && source == RawFormatKey:
		format := `{{range .Images}}type: Image
` + NewImageFormat(source, false, true) + `
{{end -}}
{{range .Containers}}type: Container
` + NewContainerFormat(source, false, true) + `
{{end -}}
{{range .Volumes}}type: Volume
` + NewVolumeFormat(source, false) + `
{{end -}}
{{range .BuildCache}}type: Build Cache
` + NewBuildCacheFormat(source, false) + `
{{end -}}`
		return format
	case !verbose && source == TableFormatKey:
		return Format(defaultDiskUsageTableFormat)
	case !verbose && source == RawFormatKey:
		format := `type: {{.Type}}
total: {{.TotalCount}}
active: {{.Active}}
size: {{.Size}}
reclaimable: {{.Reclaimable}}
`
		return Format(format)
	default:
		return Format(source)
	}
}
378165
func NewHistoryFormat(source string, quiet bool, human bool) formatter.Format {
	switch source {
	case formatter.TableFormatKey:
		switch {
		case quiet:
			return formatter.DefaultQuietFormat
		case !human:
			return nonHumanHistoryTableFormat
		default:
			return defaultHistoryTableFormat
		}
	}

	return formatter.Format(source)
}
1357357
func (b ConnectionStringBuilder) WithFormat(f ConnectionFormat) ConnectionStringBuilder {
	b.connectFormat = f
	return b
}
24189
func PrettyFormat(i interface{}) string {
	var out bytes.Buffer
	PrettyPrintTo(&out, i, false)
	return out.String()
}
323931
func NewRateFromFormatted(formatted string) (Rate, error) {
	rate := Rate{}

	values := strings.Split(formatted, "-")
	if len(values) != 2 {
		return rate, errors.Errorf("incorrect format '%s'", formatted)
	}

	periods := map[string]time.Duration{
		"S": time.Second, // Second
		"M": time.Minute, // Minute
		"H": time.Hour,   // Hour
	}

	limit, period := values[0], strings.ToUpper(values[1])

	duration, ok := periods[period]
	if !ok {
		return rate, errors.Errorf("incorrect period '%s'", period)
	}

	p := 1 * duration
	l, err := strconv.ParseInt(limit, 10, 64)
	if err != nil {
		return rate, errors.Errorf("incorrect limit '%s'", limit)
	}

	rate = Rate{
		Formatted: formatted,
		Period:    p,
		Limit:     l,
	}

	return rate, nil
}
979785
func (s *Thumbnails) SetFormat(v string) *Thumbnails {
	s.Format = &v
	return s
}
438127
func (fs *FSObjects) ReloadFormat(ctx context.Context, dryRun bool) error {
	logger.LogIf(ctx, NotImplemented{})
	return NotImplemented{}
}
901670
func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {
	fs := &formatState{value: v, cs: cs}
	fs.pointers = make(map[uintptr]int)
	return fs
}
291876
func NewDiffFormat(source string) formatter.Format {
	switch source {
	case formatter.TableFormatKey:
		return defaultDiffTableFormat
	}
	return formatter.Format(source)
}