<commit_before>// Raven.js
//
// Originally based on the Arecibo JavaScript client.
//
// Requires:
//     * TraceKit
//     * parseUri (included in the full and minified distribution files)

;(function(window, undefined){
    // Save a reference to the global object (`window` in the browser, `global`
    // on the server).
    'use strict';

    var Raven;
    window.Raven = Raven = {};

    var self = Raven;

    Raven.VERSION = '@VERSION';

    function each(obj, callback) {
        var i, j;

        if (obj.length === undefined) {
            for (i in obj) {
                if (obj.hasOwnProperty(i)) {
                    callback.call(null, i, obj[i]);
                }
            }
        } else {
            for (i = 0, j = obj.length; i < j; i++) {
                callback.call(null, i, obj[i]);
            }
        }
    }

    // Create the XHR object.
    function createCORSRequest(method, url) {
        var xhr = new XMLHttpRequest();
        if ("withCredentials" in xhr) {
            // XHR for Chrome/Firefox/Opera/Safari.
            xhr.open(method, url, true);
        } else if (typeof XDomainRequest != "undefined") {
            // XDomainRequest for IE.
            xhr = new XDomainRequest();
            xhr.open(method, url);
        } else {
            // CORS not supported.
            xhr = null;
        }
        return xhr;
    }

    var globalOptions = {
        secretKey: undefined,  // The global key if not using project auth
        publicKey: undefined,  // Leave as undefined if not using project auth
        servers: [],
        projectId: 1,
        logger: 'javascript',
        site: undefined,
        dataCallback: null,
        signatureUrl: undefined,
        fetchHeaders: false,  // Generates a synchronous request to your server
        ignoreErrors: [],
        ignoreUrls: []
    };

    Raven.config = function(config) {
        var servers = [];

        if (typeof(config) === 'string') {
            if (config.indexOf('http') === 0) {
                // new-style DSN configuration
                config = Raven.parseDSN(config);
            } else {
                throw 'Base64 encoded config is no longer supported - use DSN';
            }
        }

        each(config, function(key, option) {
            globalOptions[key] = option;
        });

        // Expand server base URLs into API URLs
        each(globalOptions.servers, function(i, server) {
            // Add a trailing slash if one isn't provided
            if (server.slice(-1) !== '/') {
                server += '/';
            }
            servers.push(server + 'api/' + globalOptions.projectId + '/store/');
        });
        globalOptions.servers = servers;
    };

    Raven.install = function() {
        TraceKit.report.subscribe(handleStackInfo);
    };

    Raven.parseDSN = function(dsn) {
        var uri = parseUri(dsn),
            path_idx = uri.path.lastIndexOf('/'),
            project_id,
            path;

        if (path_idx === -1) {
            project_id = uri.path.substr(1);
            path = '';
        } else {
            path = uri.path.substr(1, path_idx);
            project_id = uri.path.substr(path_idx + 1);
        }

        return {<commit_msg>Return this so .install() can be chained<commit_after>// Raven.js
//
// Originally based on the Arecibo JavaScript client.
//
// Requires:
//     * TraceKit
//     * parseUri (included in the full and minified distribution files)

;(function(window, undefined){
    // Save a reference to the global object (`window` in the browser, `global`
    // on the server).
    'use strict';

    var Raven;
    window.Raven = Raven = {};

    var self = Raven;

    Raven.VERSION = '@VERSION';

    function each(obj, callback) {
        var i, j;

        if (obj.length === undefined) {
            for (i in obj) {
                if (obj.hasOwnProperty(i)) {
                    callback.call(null, i, obj[i]);
                }
            }
        } else {
            for (i = 0, j = obj.length; i < j; i++) {
                callback.call(null, i, obj[i]);
            }
        }
    }

    // Create the XHR object.
    function createCORSRequest(method, url) {
        var xhr = new XMLHttpRequest();
        if ("withCredentials" in xhr) {
            // XHR for Chrome/Firefox/Opera/Safari.
            xhr.open(method, url, true);
        } else if (typeof XDomainRequest != "undefined") {
            // XDomainRequest for IE.
            xhr = new XDomainRequest();
            xhr.open(method, url);
        } else {
            // CORS not supported.
            xhr = null;
        }
        return xhr;
    }

    var globalOptions = {
        secretKey: undefined,  // The global key if not using project auth
        publicKey: undefined,  // Leave as undefined if not using project auth
        servers: [],
        projectId: 1,
        logger: 'javascript',
        site: undefined,
        dataCallback: null,
        signatureUrl: undefined,
        fetchHeaders: false,  // Generates a synchronous request to your server
        ignoreErrors: [],
        ignoreUrls: []
    };

    Raven.config = function(config) {
        var servers = [];

        if (typeof(config) === 'string') {
            if (config.indexOf('http') === 0) {
                // new-style DSN configuration
                config = Raven.parseDSN(config);
            } else {
                throw 'Base64 encoded config is no longer supported - use DSN';
            }
        }

        each(config, function(key, option) {
            globalOptions[key] = option;
        });

        // Expand server base URLs into API URLs
        each(globalOptions.servers, function(i, server) {
            // Add a trailing slash if one isn't provided
            if (server.slice(-1) !== '/') {
                server += '/';
            }
            servers.push(server + 'api/' + globalOptions.projectId + '/store/');
        });
        globalOptions.servers = servers;

        return this;
    };

    Raven.install = function() {
        TraceKit.report.subscribe(handleStackInfo);
    };

    Raven.parseDSN = function(dsn) {
        var uri = parseUri(dsn),
            path_idx = uri.path.lastIndexOf('/'),
            project_id,
            path;

        if (path_idx === -1) {
            project_id = uri.path.substr(1);
            path = '';
        } else {
            path = uri.path.substr(1, path_idx);
            project_id = uri.path.substr(path_idx + 1);
        }

        return {
{'fraction_non_alphanumeric': 0.12127692072705056, 'fraction_numerical': 0.0030548342752405684, 'mean_word_length': 1.544889234356782, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5779283', 'n_tokens_mistral': 1876, 'n_tokens_neox': 1802, 'n_words': 504}