aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
authorPierre Mdawar <pierre@mdawar.dev>2021-12-28 03:38:31 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-12-28 03:42:19 +0530
commitf02d24d8d2c79a8f053874b373e33e011fd11f13 (patch)
tree9518d04c01245a8cfdb38cd4e84db54cecf7feb3 /yt_dlp
parentceb98323f2b6a4c5b654a203a4d8137e88388957 (diff)
downloadhypervideo-pre-f02d24d8d2c79a8f053874b373e33e011fd11f13.tar.lz
hypervideo-pre-f02d24d8d2c79a8f053874b373e33e011fd11f13.tar.xz
hypervideo-pre-f02d24d8d2c79a8f053874b373e33e011fd11f13.zip
[utils] Fix `format_bytes` output for Bytes (#2132)
Authored by: pukkandan, mdawar
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index cdc9a0ecf..5ce6df7ac 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -2118,11 +2118,11 @@ def format_decimal_suffix(num, fmt='%d%s', *, factor=1000):
exponent = 0 if num == 0 else int(math.log(num, factor))
suffix = ['', *'KMGTPEZY'][exponent]
converted = num / (factor ** exponent)
- return fmt % (converted, suffix)
+ return fmt % (converted, f'{suffix}i' if suffix and factor == 1024 else suffix)
def format_bytes(bytes):
- return format_decimal_suffix(bytes, '%.2f%siB', factor=1024) or 'N/A'
+ return format_decimal_suffix(bytes, '%.2f%sB', factor=1024) or 'N/A'
def lookup_unit_table(unit_table, s):