utils

Utils functions

Imports

Constants

Utils


source

format

 format (size:int=1, base:int=1000, sep:Optional[str]=' ',
         precision:Optional[int]=1, units:Iterable=('byte', 'kilobyte',
         'megabyte', 'gigabyte', 'terabyte', 'petabyte', 'exabyte',
         'zettabyte', 'yottabyte'))

source

getnum

 getnum (size:int=1, base:int=1000, precision:Optional[int]=1,
         units:Iterable=('byte', 'kilobyte', 'megabyte', 'gigabyte',
         'terabyte', 'petabyte', 'exabyte', 'zettabyte', 'yottabyte'))

Returns the unit suffix for a given size and base


source

getsuf

 getsuf (size:int=1, base:int=1000, units:Iterable=('byte', 'kilobyte',
         'megabyte', 'gigabyte', 'terabyte', 'petabyte', 'exabyte',
         'zettabyte', 'yottabyte'))

Returns the unit suffix for a given size and base


source

getexp

 getexp (size:int=1, base:int=1000, units:Iterable=('byte', 'kilobyte',
         'megabyte', 'gigabyte', 'terabyte', 'petabyte', 'exabyte',
         'zettabyte', 'yottabyte'))

Gets the power of the unit for a given size and base


source

getidx

 getidx (size:int=1, base:int=1000, units:Iterable=('byte', 'kilobyte',
         'megabyte', 'gigabyte', 'terabyte', 'petabyte', 'exabyte',
         'zettabyte', 'yottabyte'))

Gets the index of the unit for a given size and base