synology_apm_repo.sdk.presentation.format module

Size/duration/count formatting shared by the CLI and the TUI. Both surfaces must render these identically, so they live in the SDK rather than in cli/progress_render.py or browser/format.py: a per-surface copy would let them silently drift apart.

synology_apm_repo.sdk.presentation.format.pluralize(count, singular, plural=None)

singular for count == 1, else plural (default: singular with an “s” appended) — the English-pluralization shape every status line reporting a count already needed on its own.

synology_apm_repo.sdk.presentation.format.format_bytes(n)
synology_apm_repo.sdk.presentation.format.format_duration(seconds)
synology_apm_repo.sdk.presentation.format.format_timestamp(dt)

Renders an already timezone-aware datetime (a Node’s own node_modified_time(), a version’s own backup epoch, …) in the machine’s local timezone — shared by catalog/version.py’s own _version_display_name(), so a Modified column and a version’s own display name read consistently.

synology_apm_repo.sdk.presentation.format.format_rate(rate, unit)

Format a ProgressMeter.rate value for display: "12.3 MiB/s" for the byte-denominated "bytes" unit, "4.0 <unit>/s" for any other progress unit. Callers should only invoke this once rate > 0 — a zero/negative rate isn’t a meaningful display value and both call sites already gate on it.