CONSTRUCTOR PROPERTIES PRIVATE FUNCTIONS Convert a numeric string of baseIn to a numeric string of baseOut.
503175
function je(ct,pt,ut,bt){var kt=ct.indexOf("."),It=Ye,At=We,ht,mt,yt,_t,vt,xt,St;// Remove trailing zeros.
for(37>ut&&(ct=ct.toLowerCase()),0<=kt&&(yt=st,st=0,ct=ct.replace(".",""),St=new Ne(ut),vt=St.pow(ct.length-kt),st=yt,St.c=ue(he(ce(vt.c),vt.e),10,pt),St.e=St.c.length),xt=ue(ct,ut,pt),mt=yt=xt.length;0==xt[--yt];xt.pop());if(!xt[0])return"0";if(0>kt?--mt:(vt.c=xt,vt.e=mt,vt.s=bt,vt=He(vt,St,It,At,pt),xt=vt.c,_t=vt.r,mt=vt.e),ht=mt+It+1,kt=xt[ht],yt=pt/2,_t=_t||0>ht||null!=xt[ht+1],_t=4>At?(null!=kt||_t)&&(0==At||At==(0>vt.s?3:2)):kt>yt||kt==yt&&(4==At||_t||6==At&&1&xt[ht-1]||At==(0>vt.s?8:7)),1>ht||!xt[0])ct=_t?he("1",-It):"0";else{if(xt.length=ht,_t)// Rounding up may mean the previous digit has to be rounded up and so on.
for(--pt;++xt[--ht]>pt;)xt[ht]=0,ht||(++mt,xt=[1].concat(xt));// Determine trailing zeros.
for(yt=xt.length;!xt[--yt];);// E.g. [4, 11, 15] becomes 4bf.
for(kt=0,ct="";kt<=yt;ct+=we.charAt(xt[kt++]));ct=he(ct,mt)}// The caller will add the sign.
return ct}
1361882
def _stringify_number(v):
    '''
    
    '''
    if isinstance(v, (float, Decimal)):
        if math.isinf(v) and v > 0:
            v = 'Infinity'
        elif math.isinf(v) and v < 0:
            v = '-Infinity'
        else:
            v = '{:f}'.format(v)
    elif isinstance(v, BinarySize):
        v = '{:d}'.format(int(v))
    elif isinstance(v, int):
        v = '{:d}'.format(v)
    else:
        v = str(v)
    return v
339411
def set_str2(s, base, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        _set_from_whole_string,
        (s, base),
        context,
    )
861020
def String(length=None, **kwargs):
    """"""
    return Property(
        length=length,
        types=stringy_types,
        convert=to_string,
        **kwargs
    )
248481
function BigNumber( n, b ) {
            var c, e, i, num, len, str,
                x = this;

            // Enable constructor usage without new.
            if ( !( x instanceof BigNumber ) ) {

                // 'BigNumber() constructor call without new: {n}'
                if (ERRORS) raise( 26, 'constructor call without new', n );
                return new BigNumber( n, b );
            }

            // 'new BigNumber() base not an integer: {b}'
            // 'new BigNumber() base out of range: {b}'
            if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {

                // Duplicate.
                if ( n instanceof BigNumber ) {
                    x.s = n.s;
                    x.e = n.e;
                    x.c = ( n = n.c ) ? n.slice() : n;
                    id = 0;
                    return;
                }

                if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {
                    x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;

                    // Fast path for integers.
                    if ( n === ~~n ) {
                        for ( e = 0, i = n; i >= 10; i /= 10, e++ );
                        x.e = e;
                        x.c = [n];
                        id = 0;
                        return;
                    }

                    str = n + '';
                } else {
                    if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );
                    x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;
                }
            } else {
                b = b | 0;
                str = n + '';

                // Ensure return value is rounded to DECIMAL_PLACES as with other bases.
                // Allow exponential notation to be used with base 10 argument.
                if ( b == 10 ) {
                    x = new BigNumber( n instanceof BigNumber ? n : str );
                    return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );
                }

                // Avoid potential interpretation of Infinity and NaN as base 44+ values.
                // Any number in exponential form will fail due to the [Ee][+-].
                if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||
                  !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +
                    '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {
                    return parseNumeric( x, str, num, b );
                }

                if (num) {
                    x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;

                    if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) {

                        // 'new BigNumber() number type has more than 15 significant digits: {n}'
                        raise( id, tooManyDigits, n );
                    }

                    // Prevent later check for length on converted number.
                    num = false;
                } else {
                    x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;
                }

                str = convertBase( str, 10, b, x.s );
            }

            // Decimal point?
            if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );

            // Exponential form?
            if ( ( i = str.search( /e/i ) ) > 0 ) {

                // Determine exponent.
                if ( e < 0 ) e = i;
                e += +str.slice( i + 1 );
                str = str.substring( 0, i );
            } else if ( e < 0 ) {

                // Integer.
                e = str.length;
            }

            // Determine leading zeros.
            for ( i = 0; str.charCodeAt(i) === 48; i++ );

            // Determine trailing zeros.
            for ( len = str.length; str.charCodeAt(--len) === 48; );
            str = str.slice( i, len + 1 );

            if (str) {
                len = str.length;

                // Disallow numbers with over 15 significant digits if number type.
                // 'new BigNumber() number type has more than 15 significant digits: {n}'
                if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {
                    raise( id, tooManyDigits, x.s * n );
                }

                e = e - i - 1;

                 // Overflow?
                if ( e > MAX_EXP ) {

                    // Infinity.
                    x.c = x.e = null;

                // Underflow?
                } else if ( e < MIN_EXP ) {

                    // Zero.
                    x.c = [ x.e = 0 ];
                } else {
                    x.e = e;
                    x.c = [];

                    // Transform base

                    // e is the base 10 exponent.
                    // i is where to slice str to get the first element of the coefficient array.
                    i = ( e + 1 ) % LOG_BASE;
                    if ( e < 0 ) i += LOG_BASE;

                    if ( i < len ) {
                        if (i) x.c.push( +str.slice( 0, i ) );

                        for ( len -= LOG_BASE; i < len; ) {
                            x.c.push( +str.slice( i, i += LOG_BASE ) );
                        }

                        str = str.slice(i);
                        i = LOG_BASE - str.length;
                    } else {
                        i -= len;
                    }

                    for ( ; i--; str += '0' );
                    x.c.push( +str );
                }
            } else {

                // Zero.
                x.c = [ x.e = 0 ];
            }

            id = 0;
        }
1177594
function parseNumber( str ) {
	var v = parseFloat( str );
	if ( isnan( v ) ) {
		return new TypeError( 'invalid value. Unable to parse string as a number. Value: `' + str + '`.' );
	}
	return v;
}
9707
function int2Str36(num) {
    let baseIdx = d36.length;
    let result = [];
    let empty = null;
    if (num === 0) return '0';
    for (let i = 0; i < baseIdx; i++) {
        let d = d36[i];
        let c = 0;
        if (d <= num) {
            c = Math.trunc(num/d);
            num -= d * c;
            c = encodeCharCode2Int36(c);
            empty = encodeCharCode2Int36(0);
        } else {
            c = empty;
        }
        if (c) result.push(c);
    }
    return String.fromCharCode.apply(null, result);
}
1070828
function baseToString$1(value) {
  // Exit early for strings to avoid a performance hit in some environments.
  if (typeof value == 'string') {
    return value;
  }
  if (isArray$6(value)) {
    // Recursively convert values (susceptible to call stack limits).
    return arrayMap(value, baseToString$1) + '';
  }
  if (isSymbol$2(value)) {
    return symbolToString ? symbolToString.call(value) : '';
  }
  var result = value + '';
  return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
1060815
function encode_numeric(str) {
    var len = str.length;
    var bits = [];

    for (var i = 0; i < len; i += 3) {
        var s = str.substr(i, 3);
        var b = Math.ceil(s.length * 10 / 3);
        pushBits(bits, b, parseInt(s, 10));
    }

    var res = {};

    var d = [0, 0, 0, 1];
    pushBits(d, 14, len);
    res.data27 = d.concat(bits);

    if (len < 4096) {
        var d = [0, 0, 0, 1];
        pushBits(d, 12, len);
        res.data10 = d.concat(bits);
    }

    if (len < 1024) {
        var d = [0, 0, 0, 1];
        pushBits(d, 10, len);
        res.data1 = d.concat(bits);
    }

    return res;
}
447440
def number_to_lower_endian(n, base):
  """"""
  if n < base:
    return [n]
  return [n % base] + number_to_lower_endian(n // base, base)
168117
private Object convert(Object value, String type) {
        if (EnumRuleType.STRING.equals(type)) {
            if (!(value instanceof String)) {
                return String.valueOf(value);
            }
        } else if (EnumRuleType.DOUBLE.equals(type)) {
            if (!(value instanceof Double)) {
                if (value instanceof Number) {
                    return NumberUtils.convertNumberToTargetClass((Number) value, Double.class);
                } else {
                    return NumberUtils.parseNumber(value.toString(), Double.class);
                }
            }
        } else if (EnumRuleType.INTEGER.equals(type)) {
            if (!(value instanceof Integer)) {
                if (value instanceof Number) {
                    return NumberUtils.convertNumberToTargetClass((Number) value, Integer.class);
                } else {
                    return NumberUtils.parseNumber(value.toString(), Integer.class);
                }
            }
        }
        return value;
    }
67133
def _encode_numbers(self, obj):
        """"""

        # strict checks first - for speed
        if obj.__class__ is int:
            if abs(obj) > JAVASCRIPT_MAXINT:
                raise ValueError('Number out of range: {!r}'.format(obj))
            return str(obj)

        if obj.__class__ is float:
            if isnan(obj):
                raise ValueError('NaN is not supported')
            if isinf(obj):
                raise ValueError('Infinity is not supported')
            return repr(obj)

        # more in-depth class analysis last
        if isinstance(obj, int):
            obj = int(obj)
            if abs(obj) > JAVASCRIPT_MAXINT:
                raise ValueError('Number out of range: {!r}'.format(obj))
            return str(obj)

        if isinstance(obj, float):
            if isnan(obj):
                raise ValueError('NaN is not supported')
            if isinf(obj):
                raise ValueError('Infinity is not supported')
            return repr(obj)

        if isinstance(obj, Decimal):
            return '"' + str(obj) + '"'

        # for complex and other Numbers
        return self._encode(self.default(obj))
748160
function /*11.1.1.1 */$$core$$InitializeNumberFormat (numberFormat, locales, options) {
        var
        // This will be a internal properties object if we're not already initialized
            internal = $$core$$getInternalProperties(numberFormat),

        // Create an object whose props can be used to restore the values of RegExp props
            regexpState = $$core$$createRegExpRestore();

        // 1. If numberFormat has an [[initializedIntlObject]] internal property with
        // value true, throw a TypeError exception.
        if (internal['[[initializedIntlObject]]'] === true)
            throw new TypeError('`this` object has already been initialized as an Intl object');

        // Need this to access the `internal` object
        $$core$$defineProperty(numberFormat, '__getInternalProperties', {
            value: function () {
                // NOTE: Non-standard, for internal use only
                if (arguments[0] === $$core$$secret)
                    return internal;
            }
        });

        // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.
        internal['[[initializedIntlObject]]'] = true;

        var
        // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
        //    abstract operation (defined in 9.2.1) with argument locales.
            requestedLocales = $$core$$CanonicalizeLocaleList(locales);

        // 4. If options is undefined, then
        if (options === undefined)
            // a. Let options be the result of creating a new object as if by the
            // expression new Object() where Object is the standard built-in constructor
            // with that name.
            options = {};

        // 5. Else
        else
            // a. Let options be ToObject(options).
            options = $$core$$toObject(options);

        var
        // 6. Let opt be a new Record.
            opt = new $$core$$Record(),

        // 7. Let matcher be the result of calling the GetOption abstract operation
        //    (defined in 9.2.9) with the arguments options, "localeMatcher", "string",
        //    a List containing the two String values "lookup" and "best fit", and
        //    "best fit".
            matcher =  $$core$$GetOption(options, 'localeMatcher', 'string', new $$core$$List('lookup', 'best fit'), 'best fit');

        // 8. Set opt.[[localeMatcher]] to matcher.
        opt['[[localeMatcher]]'] = matcher;

        var
        // 9. Let NumberFormat be the standard built-in object that is the initial value
        //    of Intl.NumberFormat.
        // 10. Let localeData be the value of the [[localeData]] internal property of
        //     NumberFormat.
            localeData = $$core$$internals.NumberFormat['[[localeData]]'],

        // 11. Let r be the result of calling the ResolveLocale abstract operation
        //     (defined in 9.2.5) with the [[availableLocales]] internal property of
        //     NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]
        //     internal property of NumberFormat, and localeData.
            r = $$core$$ResolveLocale(
                    $$core$$internals.NumberFormat['[[availableLocales]]'], requestedLocales,
                    opt, $$core$$internals.NumberFormat['[[relevantExtensionKeys]]'], localeData
                );

        // 12. Set the [[locale]] internal property of numberFormat to the value of
        //     r.[[locale]].
        internal['[[locale]]'] = r['[[locale]]'];

        // 13. Set the [[numberingSystem]] internal property of numberFormat to the value
        //     of r.[[nu]].
        internal['[[numberingSystem]]'] = r['[[nu]]'];

        // The specification doesn't tell us to do this, but it's helpful later on
        internal['[[dataLocale]]'] = r['[[dataLocale]]'];

        var
        // 14. Let dataLocale be the value of r.[[dataLocale]].
            dataLocale = r['[[dataLocale]]'],

        // 15. Let s be the result of calling the GetOption abstract operation with the
        //     arguments options, "style", "string", a List containing the three String
        //     values "decimal", "percent", and "currency", and "decimal".
            s = $$core$$GetOption(options, 'style', 'string', new $$core$$List('decimal', 'percent', 'currency'), 'decimal');

        // 16. Set the [[style]] internal property of numberFormat to s.
        internal['[[style]]'] = s;

        var
        // 17. Let c be the result of calling the GetOption abstract operation with the
        //     arguments options, "currency", "string", undefined, and undefined.
            c = $$core$$GetOption(options, 'currency', 'string');

        // 18. If c is not undefined and the result of calling the
        //     IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with
        //     argument c is false, then throw a RangeError exception.
        if (c !== undefined && !$$core$$IsWellFormedCurrencyCode(c))
            throw new RangeError("'" + c + "' is not a valid currency code");

        // 19. If s is "currency" and c is undefined, throw a TypeError exception.
        if (s === 'currency' && c === undefined)
            throw new TypeError('Currency code is required when style is currency');

        // 20. If s is "currency", then
        if (s === 'currency') {
            // a. Let c be the result of converting c to upper case as specified in 6.1.
            c = c.toUpperCase();

            // b. Set the [[currency]] internal property of numberFormat to c.
            internal['[[currency]]'] = c;

            var
            // c. Let cDigits be the result of calling the CurrencyDigits abstract
            //    operation (defined below) with argument c.
                cDigits = $$core$$CurrencyDigits(c);
        }

        var
        // 21. Let cd be the result of calling the GetOption abstract operation with the
        //     arguments options, "currencyDisplay", "string", a List containing the
        //     three String values "code", "symbol", and "name", and "symbol".
            cd = $$core$$GetOption(options, 'currencyDisplay', 'string', new $$core$$List('code', 'symbol', 'name'), 'symbol');

        // 22. If s is "currency", then set the [[currencyDisplay]] internal property of
        //     numberFormat to cd.
        if (s === 'currency')
            internal['[[currencyDisplay]]'] = cd;

        var
        // 23. Let mnid be the result of calling the GetNumberOption abstract operation
        //     (defined in 9.2.10) with arguments options, "minimumIntegerDigits", 1, 21,
        //     and 1.
            mnid = $$core$$GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);

        // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.
        internal['[[minimumIntegerDigits]]'] = mnid;

        var
        // 25. If s is "currency", then let mnfdDefault be cDigits; else let mnfdDefault
        //     be 0.
            mnfdDefault = s === 'currency' ? cDigits : 0,

        // 26. Let mnfd be the result of calling the GetNumberOption abstract operation
        //     with arguments options, "minimumFractionDigits", 0, 20, and mnfdDefault.
            mnfd = $$core$$GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);

        // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.
        internal['[[minimumFractionDigits]]'] = mnfd;

        var
        // 28. If s is "currency", then let mxfdDefault be max(mnfd, cDigits); else if s
        //     is "percent", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault
        //     be max(mnfd, 3).
            mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits)
                        : (s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3)),

        // 29. Let mxfd be the result of calling the GetNumberOption abstract operation
        //     with arguments options, "maximumFractionDigits", mnfd, 20, and mxfdDefault.
            mxfd = $$core$$GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);

        // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.
        internal['[[maximumFractionDigits]]'] = mxfd;

        var
        // 31. Let mnsd be the result of calling the [[Get]] internal method of options
        //     with argument "minimumSignificantDigits".
            mnsd = options.minimumSignificantDigits,

        // 32. Let mxsd be the result of calling the [[Get]] internal method of options
        //     with argument "maximumSignificantDigits".
            mxsd = options.maximumSignificantDigits;

        // 33. If mnsd is not undefined or mxsd is not undefined, then:
        if (mnsd !== undefined || mxsd !== undefined) {
            // a. Let mnsd be the result of calling the GetNumberOption abstract
            //    operation with arguments options, "minimumSignificantDigits", 1, 21,
            //    and 1.
            mnsd = $$core$$GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);

            // b. Let mxsd be the result of calling the GetNumberOption abstract
            //     operation with arguments options, "maximumSignificantDigits", mnsd,
            //     21, and 21.
            mxsd = $$core$$GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);

            // c. Set the [[minimumSignificantDigits]] internal property of numberFormat
            //    to mnsd, and the [[maximumSignificantDigits]] internal property of
            //    numberFormat to mxsd.
            internal['[[minimumSignificantDigits]]'] = mnsd;
            internal['[[maximumSignificantDigits]]'] = mxsd;
        }
        var
        // 34. Let g be the result of calling the GetOption abstract operation with the
        //     arguments options, "useGrouping", "boolean", undefined, and true.
            g = $$core$$GetOption(options, 'useGrouping', 'boolean', undefined, true);

        // 35. Set the [[useGrouping]] internal property of numberFormat to g.
        internal['[[useGrouping]]'] = g;

        var
        // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of
        //     localeData with argument dataLocale.
            dataLocaleData = localeData[dataLocale],

        // 37. Let patterns be the result of calling the [[Get]] internal method of
        //     dataLocaleData with argument "patterns".
            patterns = dataLocaleData.patterns;

        // 38. Assert: patterns is an object (see 11.2.3)

        var
        // 39. Let stylePatterns be the result of calling the [[Get]] internal method of
        //     patterns with argument s.
            stylePatterns = patterns[s];

        // 40. Set the [[positivePattern]] internal property of numberFormat to the
        //     result of calling the [[Get]] internal method of stylePatterns with the
        //     argument "positivePattern".
        internal['[[positivePattern]]'] = stylePatterns.positivePattern;

        // 41. Set the [[negativePattern]] internal property of numberFormat to the
        //     result of calling the [[Get]] internal method of stylePatterns with the
        //     argument "negativePattern".
        internal['[[negativePattern]]'] = stylePatterns.negativePattern;

        // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.
        internal['[[boundFormat]]'] = undefined;

        // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to
        //     true.
        internal['[[initializedNumberFormat]]'] = true;

        // In ES3, we need to pre-bind the format() function
        if ($$core$$es3)
            numberFormat.format = $$core$$GetFormatNumber.call(numberFormat);

        // Restore the RegExp properties
        regexpState.exp.test(regexpState.input);

        // Return the newly initialised object
        return numberFormat;
    }
1130842
def autoconvert(string):
    """"""
    for fn in (boolify, int, float):
        try:
            return fn(string)
        except ValueError:
            pass
    return string
321995
def base10_integer_to_basek_string(k, x):
    """"""
    if not (2 <= k <= max_k_labeled):
        raise ValueError("k must be in range [2, %d]: %s"
                         % (max_k_labeled, k))
    return ((x == 0) and numerals[0]) or \
        (base10_integer_to_basek_string(k, x // k).\
         lstrip(numerals[0]) + numerals[x % k])
124172
def changebase(string, frm, to, minlen=0):
    
    if frm == to:
        return lpad(string, get_code_string(frm)[0], minlen)

    return encode(decode(string, frm), to, minlen)
840069
function baseFormat(data, strict) {
  const isArray = Array.isArray(data);

  if (!isArray && (data === null || typeof data !== 'object')) {
    throw new TypeError('data must be an Object or Array');
  }

  const records = [];

  if (isArray) {
    for (let i = 0, len = data.length; i < len; ++i) {
      records[i] = objectToRecord(data[i], strict);
    }
  } else {
    records.push(objectToRecord(data, strict));
  }

  return records.join('\n');
}