Support non-extension fromhuman for normalization
This commit is contained in:
parent
b29c69378d
commit
95c59c2b39
|
@ -99,6 +99,9 @@ def format_bytes_fromhuman(datahuman):
|
||||||
# Trim off human-readable character
|
# Trim off human-readable character
|
||||||
dataunit = datahuman[-1]
|
dataunit = datahuman[-1]
|
||||||
datasize = int(datahuman[:-1])
|
datasize = int(datahuman[:-1])
|
||||||
|
if not re.match('[A-Z]', dataunit):
|
||||||
|
dataunit = 'B'
|
||||||
|
datasize = int(datahuman)
|
||||||
databytes = datasize * byte_unit_matrix[dataunit]
|
databytes = datasize * byte_unit_matrix[dataunit]
|
||||||
return '{}B'.format(databytes)
|
return '{}B'.format(databytes)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue