File: kformat.py

package info (click to toggle)
kf6-kcoreaddons 6.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,716 kB
  • sloc: cpp: 21,217; xml: 3,687; ansic: 38; sh: 34; python: 18; makefile: 7
file content (18 lines) | stat: -rwxr-xr-x 519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3

# SPDX-FileCopyrightText: 2025 Nicolas Fella <nicolas.fella@gmx.de>
# SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL

from KCoreAddons import KFormat

formatter = KFormat()

print(formatter.formatByteSize(1234567))

print(formatter.formatDecimalDuration(54353534))

print(formatter.formatDistance(3.41, KFormat.MetricDistanceUnits))

print(formatter.formatDuration(1234567, KFormat.AbbreviatedDuration))

print(formatter.formatSpelloutDuration(1234567))