<commit_before>// s4 javascript utils (drive utils)
// author: <NAME>, http://ondrejsika.com

function s4Upload(uri, file, callback, error, async) {
    if (async === undefined) async = true;
    var xhr = new XMLHttpRequest();
    var fd = new FormData();
    xhr.open("POST", uri, async);
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            callback(xhr.responseText);
        }
        if (xhr.readyState == 4 && xhr.status != 200) {
            error(xhr.status, xhr.responseText, xhr)
        }
    }
    fd.append('file', file);
    xhr.send(fd);
}


function s4MultiUpload(uri, files, callback, loopInterval) {
    if (loopInterval == undefined) loopInterval = 300;
    var responses = []; 
    for (i = 0; i < files.length; i++) {
        console.log("a", i, files[i]);
        s4Upload(uri, files[i], function(data){
            responses.push(data);
            console.log(responses);
        }, function(a, b, c) {
            console.warn(a, b, c);
        }); 
    };  
    loop = setInterval(function(){
        console.log(responses.length, files.length);
        if (responses.length >= files.length) {
            callback(responses);
            clearInterval(loop);
        }   
    }, loopInterval);
}<commit_msg>rm end line spaces<commit_after>// s4 javascript utils (drive utils)
// author: <NAME>, http://ondrejsika.com

function s4Upload(uri, file, callback, error, async) {
    if (async === undefined) async = true;
    var xhr = new XMLHttpRequest();
    var fd = new FormData();
    xhr.open("POST", uri, async);
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            callback(xhr.responseText);
        }
        if (xhr.readyState == 4 && xhr.status != 200) {
            error(xhr.status, xhr.responseText, xhr)
        }
    }
    fd.append('file', file);
    xhr.send(fd);
}


function s4MultiUpload(uri, files, callback, loopInterval) {
    if (loopInterval == undefined) loopInterval = 300;
    var responses = [];
    for (i = 0; i < files.length; i++) {
        console.log("a", i, files[i]);
        s4Upload(uri, files[i], function(data){
            responses.push(data);
            console.log(responses);
        }, function(a, b, c) {
            console.warn(a, b, c);
        });
    };
    loop = setInterval(function(){
        console.log(responses.length, files.length);
        if (responses.length >= files.length) {
            callback(responses);
            clearInterval(loop);
        }
    }, loopInterval);
}
{'fraction_non_alphanumeric': 0.15491866769945778, 'fraction_numerical': 0.012393493415956624, 'mean_word_length': 2.282083862770013, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7580209', 'n_tokens_mistral': 842, 'n_tokens_neox': 812, 'n_words': 187}