<commit_before>var pvc_PercentValue = pvc.PercentValue = function(pct) {
    this.percent = pct;
};

pvc_PercentValue.prototype.resolve = function(total) {
    return this.percent * total;
};

pvc_PercentValue.prototype.divide = function(divisor) {
    return new pvc_PercentValue(this.percent / divisor);
};

pvc_PercentValue.divide = function(value, divisor) {
    return (value instanceof pvc_PercentValue)
        ? value.divide(divisor)
        : (value / divisor);
};

pvc_PercentValue.parse = function(value) {
    if(value != null && value !== '') {
        switch(typeof value) {
            case 'number': return value;
            case 'string':
                var match = value.match(/^(.+?)\s*(%)?$/);
                if(match) {
                    var n = +match[1];
                    if(!isNaN(n)) {
                        if(match[2])
                            if(n >= 0) return new pvc_PercentValue(n / 100);
                        else
                            return n;
                    }
                }
                break;

            case 'object':
                if(value instanceof pvc_PercentValue) return value;
                break;
        }

        if(pvc.debug) pvc.log(def.format("Invalid margins component '{0}'", [''+value]));
    }
};

pvc_PercentValue.resolve = function(value, total) {
    return (value instanceof pvc_PercentValue) ? value.resolve(total) : value;
};<commit_msg>[CDF-354] - CCC - Percent value parsing bug<commit_after>var pvc_PercentValue = pvc.PercentValue = function(pct) {
    this.percent = pct;
};

pvc_PercentValue.prototype.resolve = function(total) {
    return this.percent * total;
};

pvc_PercentValue.prototype.divide = function(divisor) {
    return new pvc_PercentValue(this.percent / divisor);
};

pvc_PercentValue.divide = function(value, divisor) {
    return (value instanceof pvc_PercentValue)
        ? value.divide(divisor)
        : (value / divisor);
};

pvc_PercentValue.parse = function(value) {
    if(value != null && value !== '') {
        switch(typeof value) {
            case 'number': return value;
            case 'string':
                var match = value.match(/^(.+?)\s*(%)?$/);
                if(match) {
                    var n = +match[1];
                    if(!isNaN(n)) {
                        if(!match[2]) return n;
                        if(n >= 0) return new pvc_PercentValue(n / 100);
                    }
                }
                break;

            case 'object':
                if(value instanceof pvc_PercentValue) return value;
                break;
        }

        if(pvc.debug) pvc.log(def.format("Invalid margins component '{0}'", [''+value]));
    }
};

pvc_PercentValue.resolve = function(value, total) {
    return (value instanceof pvc_PercentValue) ? value.resolve(total) : value;
};
{'fraction_non_alphanumeric': 0.13070976809557272, 'fraction_numerical': 0.0059732958538299364, 'mean_word_length': 1.8699596774193548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2004849', 'n_tokens_mistral': 867, 'n_tokens_neox': 808, 'n_words': 168}