<commit_before>
var progressWidth = 500;
var lock = false;
var test_start = null;
var test_down_results = [];
var test_up_results = [];

var test_interval = null;
var test_fail = false;
var xreq;
var ko_test_results;
    /*
    [
        {
            kind: upload || download
            ,id: 39812 
            ,items: [
                {
                    friendlySize: 1.00MB
                    ,bytes: 1048576
                    ,ms: 1000
                    ,mbps: 99.00Mbps
                }
            ]
        }
    ]
    */

function addTest(kind) {
    var t = {
        kind: kind
        ,id = Date.now()
        ,items: []
    };
    ko_test_results.unshift(t);
    return t.id;
}

function addTestResult(kind, testid, timespan, numbytes) {
    for(var i in ko_test_results) {
        if(i != testid) { continue; }
        var fb_pf = "bytes";
        if(numbytes > 1024) fb_pf = "KB";
        if(numbytes > 1048576) fb_pf = "MB";
        if(numbytes > 1073741824) fb_pf = "GB";
        
        ko_test_results[i].items.unshift({
            friendlySizeM: ((numbytes/({"bytes": 1, KB: 1024, MB: 1048576, GB: 1073741824})[fb_pf]).toPrecision(3).toString() + fb_pf)<commit_msg>fix: syntax error, should have been : instead of =.<commit_after>
var progressWidth = 500;
var lock = false;
var test_start = null;
var test_down_results = [];
var test_up_results = [];

var test_interval = null;
var test_fail = false;
var xreq;
var ko_test_results;
    /*
    [
        {
            kind: upload || download
            ,id: 39812 
            ,items: [
                {
                    friendlySize: 1.00MB
                    ,bytes: 1048576
                    ,ms: 1000
                    ,mbps: 99.00Mbps
                }
            ]
        }
    ]
    */

function addTest(kind) {
    var t = {
        kind: kind
        ,id: Date.now()
        ,items: []
    };
    ko_test_results.unshift(t);
    return t.id;
}

function addTestResult(kind, testid, timespan, numbytes) {
    for(var i in ko_test_results) {
        if(i != testid) { continue; }
        var fb_pf = "bytes";
        if(numbytes > 1024) fb_pf = "KB";
        if(numbytes > 1048576) fb_pf = "MB";
        if(numbytes > 1073741824) fb_pf = "GB";
        
        ko_test_results[i].items.unshift({
            friendlySizeM: ((numbytes/({"bytes": 1, KB: 1024, MB: 1048576, GB: 1073741824})[fb_pf]).toPrecision(3).toString() + fb_pf)
{'fraction_non_alphanumeric': 0.12546277252159604, 'fraction_numerical': 0.057589469354175235, 'mean_word_length': 1.684326710816777, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6089563', 'n_tokens_mistral': 942, 'n_tokens_neox': 798, 'n_words': 183}