Remove the need to use the hurry.filesize package

This commit is contained in:
Hugo Posnic 2019-02-20 17:10:03 +01:00
parent 460161b6ee
commit 1e602b2a77
7 changed files with 13 additions and 245 deletions

9
src/trimage/tools.py Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env python3
def human_readable_size(num, suffix='B'):
for unit in ['','K','M','G','T','P','E','Z']:
if abs(num) < 1024.0:
return "%3.1f%s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f%s%s" % (num, 'Y', suffix)