mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-06 04:58:04 -05:00
Remove: unused import, round
, formatting indexes. Use tuple
This commit is contained in:
parent
4387589b4f
commit
52d16d21f7
@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import random
|
import random
|
||||||
@ -143,14 +142,14 @@ def human_readable_filesize(b):
|
|||||||
"""
|
"""
|
||||||
thresh = 1024.0
|
thresh = 1024.0
|
||||||
if b < thresh:
|
if b < thresh:
|
||||||
return '{0:.1f} B'.format(b)
|
return '{:.1f} B'.format(b)
|
||||||
units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
|
units = ('KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')
|
||||||
u = 0
|
u = 0
|
||||||
b /= thresh
|
b /= thresh
|
||||||
while b >= thresh:
|
while b >= thresh:
|
||||||
b /= thresh
|
b /= thresh
|
||||||
u += 1
|
u += 1
|
||||||
return '{0:.1f} {1:s}'.format(round(b, 1), units[u])
|
return '{:.1f} {}'.format(b, units[u])
|
||||||
|
|
||||||
|
|
||||||
def format_seconds(seconds):
|
def format_seconds(seconds):
|
||||||
|
Loading…
Reference in New Issue
Block a user