<commit_before>//     Jasq v0.2.0 - AMD dependency injector integrated with Jasmine

//     https://github.com/biril/jasq
//     Licensed and freely distributed under the MIT License
//     Copyright (c) 2013 <NAME>

/*jshint browser:true */
/*global define:false, require:false */

define(function () {

    "use strict";

    var
        // Helpers
        noOp = function () {},
        isString = function (s) {
            return Object.prototype.toString.call(s) === "[object String]";
        },
        isFunction = function (f) {
            return Object.prototype.toString.call(f) === "[object Function]";
        },
        isStrictlyObject = function (o) {
            return Object.prototype.toString.call(o) === "[object Object]";
        },
        each = function (obj, iterator) {
            var i, l, key;
            if (!obj) { return; }
            if (Array.prototype.forEach && obj.forEach === Array.prototype.forEach) {
                obj.forEach(iterator);
                return;
            }
            if (obj.length === +obj.length) {
                for (i = 0, l = obj.length; i < l; i++) { iterator(obj[i], i, obj); }
                return;
            }
            for (key in obj) {
                if (obj.hasOwnProperty(key)) { iterator(obj[key], key, obj); }
            }
        },
        clone = function (obj) {
            var clone = {};
            each(obj, function (v, k) { clone[k] = v; });
            return clone;
        },

        // Generate a context-id for given `suiteDescription` / `specDescription` pair
        createContextId = (function () {
            var uid = 0;
            return function (suiteDescription, specDescription) {
                return suiteDescription + " " + specDescription + " " + (uid++);
            };
        }()),

        // Re-configure require for context of given id, getting a loader-function. All requirejs
        // options (except for the context itself) are copied over from the default context `_`
        configRequireForContext = function (contextId) {
            var c = {}, _require = null;
            each(require.s.contexts._.config, function (val, key) {
                if (key !== "deps") { c[key] = val; }
            });
            c.context = contextId;
            return require.config(c);
        },

        // Check if given `descibe` / `xdescribe` args are such that should be handled by jasq
        //  `describe` / `xdescribe` instead of Jasmine's native versions. This would be the case
        //  if the arguments are
        //   * 1. suite description (string)
        //   * 2. module name (string)
        //   * 3. spec definitions (function)
        isArgsForJasqDescribe = function (args) {
            return isString(args[0]) && isString(args[1]) && isFunction(args[2]);
        },

        // Check if given `it` / `xit` args are such that should be handled by jasq `it` / `xit`
        //  instead of Jasmine's native versions. This would be the case if the arguments are
        //   * 1. spec description (string)
        //   * 2. spec config (hash)
        isArgsForJasqIt = function (args) {
            return isString(args[0]) && isStrictlyObject(args[1]);
        },

        // Get the 'path' of given suite. A suite's path is defined as an array of suite
        //  descriptions where
        //  * `path[0]`: descr. of the top-level suite == (n-1)th parent of current suite
        //  * `path[1]`: descr. of (n-2)th parent of current suite
        //  * `path[path.length - 1]`: descr. of current suite
        getSuitePath = function (suite) {
            var suitePath = [];
            while (suite) {
                suitePath.unshift(suite.description);
                suite = suite.parentSuite;
            }
            return suitePath;
        },

        // A mapping of suites to modules. When mapped to a suite, a module will be made available
        //  to all specs defined within _that_ (or any _nested_) suite. Suites are identified by
        //  path (see `getSuitePath`), modules are identified by name
        suitesToModules = (function () {
            var m = [],
                areEqualSuitePaths = function (p1, p2) {
                    for (var i = Math.max(p1.length, p2.length) - 1; i >= 0; --i) {
                        if (p1[i] !== p2[i]) { return false; }
                    }
                    return true;
                },
                findSuite = function (suitePath, opts) {
                    isFunction(opts) && (opts = { onFound: opts });
                    opts.onFound || (opts.onFound = noOp);
                    opts.onNotFound || (opts.onNotFound = noOp);
                    for (var i = m.length - 1; i >= 0; --i) {
                        if (areEqualSuitePaths(m[i].suitePath, suitePath)) {
                            return opts.onFound(i);
                        }
                    }
                    return opts.onNotFound();
                };

            return {
                add: function (suitePath, moduleName) {
                    return findSuite(suitePath, {
                        onFound: function () {
                            throw "Cannot add mapping - suite '" + suitePath + "' already has module '" + moduleName + "' mapped to it";
                        },
                        onNotFound: function () {
                            m.push({ suitePath: suitePath, moduleName: moduleName });
                        }
                    });
                },
                remove: function (suitePath, failHard) {
                    return findSuite(suitePath, {
                        onFound: function (i) {
                            return m.splice(i, 1);
                        },
                        onNotFound: function () {
                            if (failHard) {
                                throw "Cannot remove mapping - suite '" + suitePath + "'' not present in mappings";
                            }
                        }<commit_msg>Rename unfortunately named 'opts' to 'callbacks'<commit_after>//     Jasq v0.2.0 - AMD dependency injector integrated with Jasmine

//     https://github.com/biril/jasq
//     Licensed and freely distributed under the MIT License
//     Copyright (c) 2013 <NAME>

/*jshint browser:true */
/*global define:false, require:false */

define(function () {

    "use strict";

    var
        // Helpers
        noOp = function () {},
        isString = function (s) {
            return Object.prototype.toString.call(s) === "[object String]";
        },
        isFunction = function (f) {
            return Object.prototype.toString.call(f) === "[object Function]";
        },
        isStrictlyObject = function (o) {
            return Object.prototype.toString.call(o) === "[object Object]";
        },
        each = function (obj, iterator) {
            var i, l, key;
            if (!obj) { return; }
            if (Array.prototype.forEach && obj.forEach === Array.prototype.forEach) {
                obj.forEach(iterator);
                return;
            }
            if (obj.length === +obj.length) {
                for (i = 0, l = obj.length; i < l; i++) { iterator(obj[i], i, obj); }
                return;
            }
            for (key in obj) {
                if (obj.hasOwnProperty(key)) { iterator(obj[key], key, obj); }
            }
        },
        clone = function (obj) {
            var clone = {};
            each(obj, function (v, k) { clone[k] = v; });
            return clone;
        },

        // Generate a context-id for given `suiteDescription` / `specDescription` pair
        createContextId = (function () {
            var uid = 0;
            return function (suiteDescription, specDescription) {
                return suiteDescription + " " + specDescription + " " + (uid++);
            };
        }()),

        // Re-configure require for context of given id, getting a loader-function. All requirejs
        // options (except for the context itself) are copied over from the default context `_`
        configRequireForContext = function (contextId) {
            var c = {}, _require = null;
            each(require.s.contexts._.config, function (val, key) {
                if (key !== "deps") { c[key] = val; }
            });
            c.context = contextId;
            return require.config(c);
        },

        // Check if given `descibe` / `xdescribe` args are such that should be handled by jasq
        //  `describe` / `xdescribe` instead of Jasmine's native versions. This would be the case
        //  if the arguments are
        //   * 1. suite description (string)
        //   * 2. module name (string)
        //   * 3. spec definitions (function)
        isArgsForJasqDescribe = function (args) {
            return isString(args[0]) && isString(args[1]) && isFunction(args[2]);
        },

        // Check if given `it` / `xit` args are such that should be handled by jasq `it` / `xit`
        //  instead of Jasmine's native versions. This would be the case if the arguments are
        //   * 1. spec description (string)
        //   * 2. spec config (hash)
        isArgsForJasqIt = function (args) {
            return isString(args[0]) && isStrictlyObject(args[1]);
        },

        // Get the 'path' of given suite. A suite's path is defined as an array of suite
        //  descriptions where
        //  * `path[0]`: descr. of the top-level suite == (n-1)th parent of current suite
        //  * `path[1]`: descr. of (n-2)th parent of current suite
        //  * `path[path.length - 1]`: descr. of current suite
        getSuitePath = function (suite) {
            var suitePath = [];
            while (suite) {
                suitePath.unshift(suite.description);
                suite = suite.parentSuite;
            }
            return suitePath;
        },

        // A mapping of suites to modules. When mapped to a suite, a module will be made available
        //  to all specs defined within _that_ (or any _nested_) suite. Suites are identified by
        //  path (see `getSuitePath`), modules are identified by name
        suitesToModules = (function () {
            var m = [],
                areEqualSuitePaths = function (p1, p2) {
                    for (var i = Math.max(p1.length, p2.length) - 1; i >= 0; --i) {
                        if (p1[i] !== p2[i]) { return false; }
                    }
                    return true;
                },
                findSuite = function (suitePath, callbacks) {
                    isFunction(callbacks) && (callbacks = { onFound: callbacks });
                    callbacks.onFound || (callbacks.onFound = noOp);
                    callbacks.onNotFound || (callbacks.onNotFound = noOp);
                    for (var i = m.length - 1; i >= 0; --i) {
                        if (areEqualSuitePaths(m[i].suitePath, suitePath)) {
                            return callbacks.onFound(i);
                        }
                    }
                    return callbacks.onNotFound();
                };

            return {
                add: function (suitePath, moduleName) {
                    return findSuite(suitePath, {
                        onFound: function () {
                            throw "Cannot add mapping - suite '" + suitePath + "' already has module '" + moduleName + "' mapped to it";
                        },
                        onNotFound: function () {
                            m.push({ suitePath: suitePath, moduleName: moduleName });
                        }
                    });
                },
                remove: function (suitePath, failHard) {
                    return findSuite(suitePath, {
                        onFound: function (i) {
                            return m.splice(i, 1);
                        },
                        onNotFound: function () {
                            if (failHard) {
                                throw "Cannot remove mapping - suite '" + suitePath + "'' not present in mappings";
                            }
                        }
{'fraction_non_alphanumeric': 0.11581804721559595, 'fraction_numerical': 0.005757999506457185, 'mean_word_length': 1.390483680692096, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '7066411', 'n_tokens_mistral': 3244, 'n_tokens_neox': 3090, 'n_words': 949}