Skip to content

Commit ea54e3b

Browse files
authored
FIX: Properly capitalize unit letters
* Revert commit b19d276 but keep the last 'K' for kibibyte uppercased The symbol 'k' indicates the decimal unit prefix 'kilo-' and must be written in lowercased form; and the unit 'bit' would usually be written in lowercase 'b' to avoid confusing with 'B' for 'byte'. * Add comments about different units
1 parent 76049a5 commit ea54e3b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dool

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,12 +1924,15 @@ def cprint(var, ctype = 'f', width = 4, scale = 1000):
19241924
return theme['error'] + '-'.rjust(width) + theme['default']
19251925

19261926
if base != 1024:
1927-
units = (char['space'], 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
1927+
# Miscellaneous value using base of 1000 (1, kilo-, mega-, giga-, ...)
1928+
units = (char['space'], 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
19281929
elif op.bits and ctype in ('b', ):
1929-
units = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
1930+
# Bit value using base of 1000 (bit, kilobit, megabit, gigabit, ...)
1931+
units = ('b', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
19301932
base = scale = 1000
19311933
var = var * 8.0
19321934
else:
1935+
# Byte value using base of 1024 (byte, kibibyte, mebibyte, gibibyte, ...)
19331936
units = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
19341937

19351938
if step == op.delay:

0 commit comments

Comments
 (0)