Convert a number to nepali
964122
def nepali_number(number):
    
    nepnum = ""
    for n in str(number):
        nepnum += values.NEPDIGITS[int(n)]
    return nepnum
1249962
def _convert_np_data(data, data_type, num_elems):   # @NoSelf
        '''
        
        '''
        if (data_type == 51 or data_type == 52):
            if (data == ''):
                return ('\x00'*num_elems).encode()
            else:
                return data.ljust(num_elems, '\x00').encode('utf-8')
        elif (data_type == 32):
            data_stream = data.real.tobytes()
            data_stream += data.imag.tobytes()
            return data_stream
        else:
            return data.tobytes()
1052295
def as_number(as_number_val):
    """"""
    as_number_str = py23_compat.text_type(as_number_val)
    if "." in as_number_str:
        big, little = as_number_str.split(".")
        return (int(big) << 16) + int(little)
    else:
        return int(as_number_str)
1275349
def convert(self, value, view):
        
        if isinstance(value, int):
            return value
        elif isinstance(value, float):
            return int(value)
        else:
            self.fail(u'must be a number', view, True)
1335239
def _convert_value_to_native(value):
    
    if isinstance(value, Counter32):
        return int(value.prettyPrint())
    if isinstance(value, Counter64):
        return int(value.prettyPrint())
    if isinstance(value, Gauge32):
        return int(value.prettyPrint())
    if isinstance(value, Integer):
        return int(value.prettyPrint())
    if isinstance(value, Integer32):
        return int(value.prettyPrint())
    if isinstance(value, Unsigned32):
        return int(value.prettyPrint())
    if isinstance(value, IpAddress):
        return str(value.prettyPrint())
    if isinstance(value, OctetString):
        try:
            return value.asOctets().decode(value.encoding)
        except UnicodeDecodeError:
            return value.asOctets()
    if isinstance(value, TimeTicks):
        return timedelta(seconds=int(value.prettyPrint()) / 100.0)
    return value
1092351
def decode_format(number_format):
    

    style = number_format[0]
    prec = "." + str(int(number_format[1:])) if len(number_format) > 1 else ""

    if style == NUMBER:
        return "," + prec + "g","",1.

    elif style == THOUSANDS:
        return "," + prec + "g","k",1e-3

    elif style == MILLIONS:
        return "," + prec + "g","m",1e-6

    elif style == BILLIONS:
        return "," + prec + "g","bn",1e-9

    elif style == TRILLIONS:
        return "," + prec + "g","tr",1e-12

    elif style == PERCENTAGE:
        return prec + "f","%",1e2

    elif style == BASIS_POINTS:
        return prec + "f","bp",1e4

    elif style == INTEGER:
        return "d","",1.

    elif style == SCIENTIFIC:
        return ".4e","",1.

    else: # style FLOAT
        return prec + "f","",1.
590091
def number(v):
    """"""
    if nodesetp(v):
        v = string(v)
    try:
        return float(v)
    except ValueError:
        return float('NaN')
59828
function bignumToString(bignum, base, alphabet) {
        // Prefer native conversion
        if (alphabet === "native" && base != 6) {
            return bignum.toString(base);
        }

        // Old-sk00l conversion
        var result = [];

        while (bignum.gt(0)) {
            var ord = bignum.mod(base);
            result.push(alphabet.charAt(ord));
            bignum = bignum.div(base);
        }

        return result.reverse().join("");
    }
372875
function ( num, integer ) {
			var tmp, item, i,
				transformTable, numberString, convertedNumber;

			// Set the target Transform table:
			transformTable = this.digitTransformTable( $.i18n().locale );
			numberString = '' + num;
			convertedNumber = '';

			if ( !transformTable ) {
				return num;
			}

			// Check if the restore to Latin number flag is set:
			if ( integer ) {
				if ( parseFloat( num, 10 ) === num ) {
					return num;
				}

				tmp = [];

				for ( item in transformTable ) {
					tmp[transformTable[item]] = item;
				}

				transformTable = tmp;
			}

			for ( i = 0; i < numberString.length; i++ ) {
				if ( transformTable[numberString[i]] ) {
					convertedNumber += transformTable[numberString[i]];
				} else {
					convertedNumber += numberString[i];
				}
			}

			return integer ? parseFloat( convertedNumber, 10 ) : convertedNumber;
		}
229355
function _convertNumber($num)
    {
        // Integer in the range 0..2**16-1
        if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
            return pack("Cv", $this->ptg['ptgInt'], $num);
        } else { // A float
            if ($this->_byte_order) { // if it's Big Endian
                $num = strrev($num);
            }
            return pack("Cd", $this->ptg['ptgNum'], $num);
        }
    }
535720
function mkNumber(val) {
            var sign = 1;
            if (val.charAt(0) == '-') {
                sign = -1;
                val = val.substring(1);
            }
            if (Lang.NUMBER_DEC.test(val))
                return sign * parseInt(val, 10);
            else if (Lang.NUMBER_HEX.test(val))
                return sign * parseInt(val.substring(2), 16);
            else if (Lang.NUMBER_OCT.test(val))
                return sign * parseInt(val.substring(1), 8);
            else if (val === 'inf')
                return sign * Infinity;
            else if (val === 'nan')
                return NaN;
            else if (Lang.NUMBER_FLT.test(val))
                return sign * parseFloat(val);
            throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
        }
260846
private static Object toExternalNumber( BigDecimal number)
    {
    return
      Optional.ofNullable(
        toObject(
          number,
          ObjectUtils::toInt,
          ObjectUtils::toLong))

      .orElse( number);
    }
983707
def PBToPy(numpb):
    """"""
    return PhoneNumber(country_code=numpb.country_code if numpb.HasField("country_code") else None,
                       national_number=numpb.national_number if numpb.HasField("national_number") else None,
                       extension=numpb.extension if numpb.HasField("extension") else None,
                       italian_leading_zero=numpb.italian_leading_zero if numpb.HasField("italian_leading_zero") else None,
                       number_of_leading_zeros=numpb.number_of_leading_zeros if numpb.HasField("number_of_leading_zeros") else None,
                       raw_input=numpb.raw_input if numpb.HasField("raw_input") else None,
                       country_code_source=numpb.country_code_source if numpb.HasField("country_code_source") else CountryCodeSource.UNSPECIFIED,
                       preferred_domestic_carrier_code=numpb.preferred_domestic_carrier_code if numpb.HasField("preferred_domestic_carrier_code") else None)
1066581
def to_str(number):
    
    states = globals()
    for name, value in states.items():
        if number == value and name.isalpha() and name.isupper():
            return name
    return '(unknown state %d)' % number
304585
def _convert_number_to_subscript(num):
        
        subscript = ''
        for character in str(num):
            subscript += chr(0x2080 + int(character))
        return subscript
1229322
def humanize(number):
    
    # units = ('bytes', 'KB', 'MB', 'GB', 'TB')
    # base = 1000
    units = ('bytes', 'KiB', 'MiB', 'GiB', 'TiB')
    base = 1024
    if number is None:
        return None
    pow = int(math.log(number, base)) if number > 0 else 0
    pow = min(pow, len(units) - 1)
    mantissa = number / (base ** pow)
    return "%.4g %s" % (mantissa, units[pow])
209392
public int toInteger() throws NumberFormatException {
        int res = 0;
        byte currChar;
        int i=1;
        currChar=chars[pos];
        boolean isMinus=false;
        
        if(currChar==minus_byte)
        	isMinus=true;
        else if(currChar>=zero_byte && currChar<=nine_byte)
    		res+=currChar-zero_byte;
    	else
    		throw new NumberFormatException("value is not numeric");
    	
        for (; i < len; i++) {
        	currChar=chars[pos+i];        		
        	if(currChar>=zero_byte && currChar<=nine_byte)
        	{
        		res*=10;
        		res+=currChar-zero_byte;
        	}        
        	else
        		throw new NumberFormatException("value is not numeric");
        }
        
        if(isMinus)
        	return 0-res;
        else
        	return res;
    }