Convert the size to human readable size
323010
function toHumanReadableSize(size, len) {
  if(!size) return '0B';
  if (!len || len <= 0) {
    len = 2;
  }
  var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
  var i = Math.floor( Math.log(size) / Math.log(1024));
  return (size/Math.pow(1024, i)).toFixed(len) + units[i];
}
445514
def size(self, size=None):
        """"""

        if size is None:
            return self._size
        else:
            if not is_numeric(size):
                raise TypeError(
                 "size must be number, not '%s'" % str(size)
                )
            self._size = size
436109
def fontsize(count,maxsize,minsize,maxcount):
    ''''''
    size = int(maxsize - (maxsize)*((float(maxcount-count)/maxcount)))
    if size < minsize:
        size = minsize
    return size
1048682
def _pretty_size(size):
    '''
    
    '''
    units = [' G', ' M', ' K', ' B']
    while units and size >= 1000:
        size = size / 1024.0
        units.pop()
    return '{0}{1}'.format(round(size, 1), units[-1])
302731
def sizes(self: Any) -> Mapping[Hashable, int]:
        
        return Frozen(OrderedDict(zip(self.dims, self.shape)))
1081573
def get_size(self):
        """"""
        self.curses.setupterm()
        return self.curses.tigetnum('cols'), self.curses.tigetnum('lines')
172732
function transformSizes(requestSizes) {
  let sizes = [];
  let sizeObj = {};

  if (utils.isArray(requestSizes) && requestSizes.length === 2 &&
    !utils.isArray(requestSizes[0])) {
    sizeObj.width = parseInt(requestSizes[0], 10);
    sizeObj.height = parseInt(requestSizes[1], 10);
    sizes.push(sizeObj);
  } else if (typeof requestSizes === 'object') {
    for (let i = 0; i < requestSizes.length; i++) {
      let size = requestSizes[i];
      sizeObj = {};
      sizeObj.width = parseInt(size[0], 10);
      sizeObj.height = parseInt(size[1], 10);
      sizes.push(sizeObj);
    }
  }

  return sizes;
}
784816
def Size(self):
        
        return s.uint32 + s.uint64 + s.uint32 + s.uint16 + s.uint32 + GetVarSize(self.UserAgent) + s.uint32 + s.uint8
1116959
def humanize_filesize(value):
    

    value = float(value)

    if value == 1:
        return '1 Byte'
    elif value < 1024:
        return '%d Bytes' % value
    elif value < 1024:
        return '%dB' % value

    for i, s in enumerate(SUFFIXES):
        unit = 1024 ** (i + 2)
        if value < unit:
            return '%.1f %s' % ((1024 * value / unit), s)
    return '%.1f %s' % ((1024 * value / unit), s)
246061
def formatted_size
      @formats.rcompact!
      sz = size
      fs = @formats.size
      fs > sz ? fs : sz
    end
585676
def _parse_size(self, size, has_time=False):
        """"""
        if has_time:
            size = size or 4
        else:
            size = size or 10
        if isinstance(size, str):
            size = {'column': size}
        if isinstance(size, dict):
            if 'column' not in size:
                raise ValueError("`size` must include a 'column' key/value")
            if has_time:
                raise ValueError("When time is specified, size can "
                                 "only be a fixed size")
            old_size = size
            # Default size range, bins, and bin_method
            size = {
                'range': [5, 25],
                'bins': 5,
                'bin_method': BinMethod.quantiles,
            }
            # Assign default range and update if min/max given
            old_size['range'] = old_size.get('range', size['range'])
            if 'min' in old_size:
                old_size['range'][0] = old_size['min']
                old_size.pop('min')
            if 'max' in old_size:
                old_size['range'][1] = old_size['max']
                old_size.pop('max')
            # Update all the keys in size if they exist in old_size
            size.update(old_size)
            self.style_cols[size['column']] = None

        return size
691529
def get_size_str(size):
    
    if size == 0:
        magnitude = 0
        level = 0
    else:
        magnitude = math.floor(math.log(size, 10))
        level = int(min(math.floor(magnitude // 3), 4))
    return ('%d' if level == 0 else '%.2f') % (float(size) / 2**(level*10)) + ' ' + SIZE_LEVEL[level]
69464
def str_filesize(size):
    
    import bisect
    
    d = [(1024-1,'K'), (1024**2-1,'M'), (1024**3-1,'G'), (1024**4-1,'T')]
    s = [x[0] for x in d]
    
    index = bisect.bisect_left(s, size) - 1
    if index == -1:
        return str(size)
    else:
        b, u = d[index]
    return str(size / (b+1)) + u
52958
def _FormatSizeInUnitsOf1024(self, size):
    
    magnitude_1024 = 0
    used_memory_1024 = float(size)
    while used_memory_1024 >= 1024:
      used_memory_1024 /= 1024
      magnitude_1024 += 1

    if 0 < magnitude_1024 <= 7:
      return '{0:.1f} {1:s}'.format(
          used_memory_1024, self._UNITS_1024[magnitude_1024])

    return '{0:d} B'.format(size)
1026045
def get_readable_filesize(size):
	
	if(size < 1024):
		return str(size)+' bytes'
	temp = size/1024.0
	level = 1
	while(temp >= 1024 and level< 3):
		temp = temp/1024
		level += 1
	if(level == 1):
		return str(round(temp,2))+' KB'
	elif(level == 2):
		return str(round(temp,2))+' MB'
	else:
		return str(round(temp,2))+' GB'
1256592
public static String toHumanReadableSize(final long pSizeInBytes) {
        // TODO: Rewrite to use String.format?
        if (pSizeInBytes < 1024L) {
            return pSizeInBytes + " Bytes";
        }
        else if (pSizeInBytes < (1024L << 10)) {
            return getSizeFormat().format(pSizeInBytes / (double) (1024L)) + " KB";
        }
        else if (pSizeInBytes < (1024L << 20)) {
            return getSizeFormat().format(pSizeInBytes / (double) (1024L << 10)) + " MB";
        }
        else if (pSizeInBytes < (1024L << 30)) {
            return getSizeFormat().format(pSizeInBytes / (double) (1024L << 20)) + " GB";
        }
        else  if (pSizeInBytes < (1024L << 40)) {
            return getSizeFormat().format(pSizeInBytes / (double) (1024L << 30)) + " TB";
        }
        else {
            return getSizeFormat().format(pSizeInBytes / (double) (1024L << 40)) + " PB";
        }
    }
243878
def human_filesize(i):
    
    bytes = float(i)
    if bytes < 1024:
        return u"%d Byte%s" % (bytes, bytes != 1 and u"s" or u"")
    if bytes < 1024 * 1024:
        return u"%.1f KB" % (bytes / 1024)
    if bytes < 1024 * 1024 * 1024:
        return u"%.1f MB" % (bytes / (1024 * 1024))
    return u"%.1f GB" % (bytes / (1024 * 1024 * 1024))