quartzbio.utils.humanize module¶
Bits & Bytes related humanization.
- quartzbio.utils.humanize.naturalsize(value, binary=False, gnu=False, format='%.1f')¶
Format a number of byteslike a human readable filesize (eg. 10 kB). By default, decimal suffixes (kB, MB) are used. Passing binary=true will use binary suffixes (KiB, MiB) are used and the base will be 2**10 instead of 10**3. If
gnu
is True, the binary argument is ignored and GNU-style (ls -sh style) prefixes are used (K, M) with the 2**10 definition. Non-gnu modes are compatible with jinja2’sfilesizeformat
filter.