Returns the size of num (bytes) in a human readable form up to Yottabytes (YB).
    :param num: The size of interest in bytes.
    :param suffix: A suffix, default 'B' for 'bytes'.
    :return: a human readable representation of a size in bytes
19658
def bytes_to_string(num, suffix='B'):
    
    extensions = ["%s%s" % (x, suffix) for x in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']]
    if num == 0:
        return "0%s" % extensions[0]
    else:
        n_bytes = float(abs(num))
        place = int(math.floor(math.log(n_bytes, 1024)))
        return "%.1f%s" % (np.sign(num) * (n_bytes / 1024** place), extensions[place])
462478
def strnum(prefix: str, num: int, suffix: str = "") -> str:
    
    return "{}{}{}".format(prefix, num, suffix)
1186519
def encoded_length(self, num_bytes=16):
        
        factor = math.log(256) / math.log(self._alpha_len)
        return int(math.ceil(factor * num_bytes))
973239
def size(self) -> Optional[int]:
        """"""
        if not self._parts:
            return 0

        total = 0
        for part, encoding, te_encoding in self._parts:
            if encoding or te_encoding or part.size is None:
                return None

            total += int(
                2 + len(self._boundary) + 2 +  # b'--'+self._boundary+b'\r\n'
                part.size + len(part._binary_headers) +
                2  # b'\r\n'
            )

        total += 2 + len(self._boundary) + 4  # b'--'+self._boundary+b'--\r\n'
        return total
1234126
def binary_size(self):
        ''''''
        return (
            1 + # group_id
            2 + # next offset marker
            1 + len(self.name.encode('utf-8')) + # size of name and name bytes
            1 + # data size
            1 + len(self.dimensions) + # size of dimensions and dimension bytes
            self.total_bytes + # data
            1 + len(self.desc.encode('utf-8')) # size of desc and desc bytes
            )
287226
def _format_numer(number_format, prefix='', suffix=''):
    """"""
    @_surpress_formatting_errors
    def inner(v):
        if isinstance(v, Number):
            return ("{{}}{{:{}}}{{}}"
                    .format(number_format)
                    .format(prefix, v, suffix))
        else:
            raise TypeError("Numberic type required.")
    return inner
865356
def suffix?(suffix, text)
      len = suffix.length
      len <= text.length and suffix == text[-len, len]
    end
929158
def try_fix_num(n):
    
    if not n.isdigit():
        return n
    if n.startswith("0"):
        n = n.lstrip("0")
    if not n:
        n = "0"
    return int(n)
506565
def humanize_filesize(bytes_size):
    
    if not bytes_size:
        return '0 B'
    
    names = ('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB')

    name_idx = int(math.floor(math.log(bytes_size, 1024)))
    size = round(bytes_size / math.pow(1024, name_idx), 2)

    return '%s %s' % (size, names[name_idx])
938120
def length_prefix(length, offset):
    
    if length < 56:
        return ALL_BYTES[offset + length]
    elif length < LONG_LENGTH:
        length_string = int_to_big_endian(length)
        return ALL_BYTES[offset + 56 - 1 + len(length_string)] + length_string
    else:
        raise ValueError('Length greater than 256**8')
368506
def size(self):
        '''
            
        '''
        t = self._type
        if t.startswith('uint'):
            return int(t[len('uint'):])
        if t.startswith('int'):
            return int(t[len('int'):])
        if t == 'bool':
            return int(8)
        if t == 'address':
            return int(160)
        if t.startswith('bytes'):
            return int(t[len('bytes'):])
        return None
1317929
def sext(self, num):
        
        sign = self._items[-1]
        return self.__class__(self._items + [sign] * num, ftype=self.ftype)
1350719
public String num2Chn(int num){
		char s[]=new char[32],ch;
		int counter1,counter2;
		int chr,preChr=-1;
		int len=0;
		boolean suffixZero=true;
		counter1=0;
		counter2=0;
		while(num>0){
			chr=num%10;
			if(chr!=0){
				suffixZero=false;
				if(counter1>0){
					s[len]=this.strUnit.charAt(counter1);
					len++;
				}
				if(num/10!=0 || counter1!=1 || chr!=1){
					s[len]=this.strDigitOut.charAt(chr);
					len++;
				}
			}
			else{
				if(!suffixZero)
					if(preChr!=0){
						s[len]=this.strDigitOut.charAt(chr);
						len++;
					}
			}
			num=num/10;
			preChr=chr;
			counter1++;
			if(counter1==4){
				counter1=0;
				counter2++;
				suffixZero=true;
				if(num%10000>0){
					s[len]=this.strUnit.charAt(3+counter2);
					len++;
				}
			}
		}
		for(int i=0;i<len/2;i++){
			ch=s[i];
			s[i]=s[len-i-1];
			s[len-i-1]=ch;
		}
		if(len==0){
			s[len]=this.strDigitOut.charAt(0);
			len++;
		}
		return new String(s,0,len);
	}
337751
def humanize_size(number)
      return nil if number.nil?

      if number.to_i < 1024
        unit = number > 1 ? 'Bytes' : 'Byte'
      else
        max_exp  = STORAGE_UNITS.size - 1
        number   = Float(number)
        exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024
        exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit
        number  /= 1024**exponent
        unit = STORAGE_UNITS[exponent]
      end

      '%n %u'.gsub(/%n/, number.to_i.to_s).gsub(/%u/, unit)
    end
664864
def _size_fmt(num):
    '''
    
    '''
    try:
        num = int(num)
        if num < 1024:
            return '{0} bytes'.format(num)
        num /= 1024.0
        for unit in ('KiB', 'MiB', 'GiB', 'TiB', 'PiB'):
            if num < 1024.0:
                return '{0:3.1f} {1}'.format(num, unit)
            num /= 1024.0
    except Exception:
        log.error('Unable to format file size for \'%s\'', num)
        return 'unknown'
1058291
def num2bytes(x, bytes):
    
    if not isinstance(x, int):  # If it is another "thing", just return ZEROs
        return tuple([0] * bytes)

    x = x & ((2 << (bytes * 8)) - 1)  # mask the initial value
    result = ()

    for i in range(bytes):
        result += (x & 0xFF,)
        x >>= 8

    return result
355028
function numberPad(num, size) {
  var s = "000000000" + num;
  return s.substr(s.length-size);
}