Support non-extension fromhuman for normalization

This commit is contained in:
Joshua Boniface 2020-02-11 20:31:42 -05:00
parent b29c69378d
commit 95c59c2b39
1 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,9 @@ def format_bytes_fromhuman(datahuman):
# Trim off human-readable character
dataunit = datahuman[-1]
datasize = int(datahuman[:-1])
if not re.match('[A-Z]', dataunit):
dataunit = 'B'
datasize = int(datahuman)
databytes = datasize * byte_unit_matrix[dataunit]
return '{}B'.format(databytes)