Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1def split_seconds(seconds): 

2 """Return a tuple of hours, minutes and seconds for the given seconds.""" 

3 hours, remainder = divmod(seconds, 3600) 

4 minutes, seconds = divmod(remainder, 60) 

5 return hours, minutes, seconds 

6 

7 

8def humanize_size_bytes(size_bytes): 

9 """Return human readable version for given bytes""" 

10 for x in ['bytes', 'KB', 'MB', 'GB']: 

11 if size_bytes < 1024.0 and size_bytes > -1024.0: 

12 return "%3.1f%s" % (size_bytes, x) 

13 size_bytes /= 1024.0 

14 return "%3.1f%s" % (size_bytes, 'TB')