<commit_before>/*jslint */
/*indent: 4, maxerr: 50 */

var jelly = jelly || (function () {
    'use strict';
    var MODULE = 'module',
        TRAIT = 'trait',
        factories = {},
        cache = {},
        plugins = {},
        def = {},
        dependencyStack = [];

    function inArray(needle, haystack) {
        var i;
        for (i = 0; i < haystack.length; i += 1) {
            if (needle === haystack[i]) {
                return true;
            }
        }
        return false;
    }

    function include(target, ns, type, args) {
        var rv, i, factory;

        if ((typeof ns) === 'function') {
            factory = {
                type: type,
                impl: ns
            };
        } else {
            if (!factories[ns]) {
                throw {
                    name: 'TypeNotFoundError',
                    message : 'the type "' + ns + '"is not registered'
                };
            }

            factory = factories[ns];
        }

        if (type && factory.type !== type) {
            throw {
                name: 'TypeInitializationError',
                message : ns + ' cannot be initialized as ' + type
            };
        }

        if (inArray(ns, dependencyStack)) {
            dependencyStack.push(ns);
            throw new Error('cyclic dependency found: ' + dependencyStack.join('->'));
        }
        dependencyStack.push(ns);
        def = {};

        rv = factory.impl(target);

        if (!rv) {
            rv = target;
        }

        if (plugins[ns]) {
            for (i = 0; i < plugins[ns].length; i += 1) {
                plugins[ns][i](rv);
            }
        }

        dependencyStack.pop();

        if ((typeof rv.initialize) ===  'function') {
            if (args) {
                rv.initialize.apply(rv, args);
            } else {
                rv.initialize();
            }
        }
        return rv;
    }

    function use(ns) {
        var target,
            rv,
            i;

        if (!cache[ns]) {
            target = {};
            cache[ns] = include(target, ns, MODULE);
        }

        return cache[ns];
    }

    def.module = function (ns, callback) {
        if (callback) {
            factories[ns] = {
                type: MODULE,
                impl : callback
            };
        } else {
            return use(ns);
        }

    };

    def.trait = function (ns, callback) {
        factories[ns] = {
            type: TRAIT,
            impl : callback
        };
    };

    def.include = function (target, name, args) {
        var tgt = target,
            n = name;

        if ((typeof tgt) === 'string') {
            tgt = use(tgt);
        }

        return include(tgt, n, TRAIT, args);
    };

    def.reset = function () {
        cache = {};
    };

    def.plugin = function (name, fn) {
        if (!plugins[name]) {
            plugins[name] = [];
        }

        plugins[name].push(fn);
    };

    return def;
}());<commit_msg>refactoring: changed variable name<commit_after>/*jslint */
/*indent: 4, maxerr: 50 */

var jelly = jelly || (function () {
    'use strict';
    var MODULE = 'module',
        TRAIT = 'trait',
        factories = {},
        cache = {},
        plugins = {},
        def = {},
        dependencyStack = [];

    function inArray(needle, haystack) {
        var i;
        for (i = 0; i < haystack.length; i += 1) {
            if (needle === haystack[i]) {
                return true;
            }
        }
        return false;
    }

    function include(target, name, type, args) {
        var result, i, factory;

        if (!factories[name]) {
            throw {
                name: 'TypeNotFoundError',
                message : 'the type "' + name + '"is not registered'
            };
        }

        factory = factories[name];

        if (type && factory.type !== type) {
            throw {
                name: 'TypeInitializationError',
                message : name + ' cannot be initialized as ' + type
            };
        }

        if (inArray(name, dependencyStack)) {
            dependencyStack.push(name);
            throw new Error('cyclic dependency found: ' + dependencyStack.join('->'));
        }
        dependencyStack.push(name);
        def = {};

        result = factory.impl(target);

        if (!result) {
            result = target;
        }

        if (plugins[name]) {
            for (i = 0; i < plugins[name].length; i += 1) {
                plugins[name][i](result);
            }
        }

        dependencyStack.pop();

        if ((typeof result.initialize) ===  'function') {
            if (args) {
                result.initialize.apply(result, args);
            } else {
                result.initialize();
            }
        }
        return result;
    }

    function use(name) {
        var target,
            i;

        if (!cache[name]) {
            target = {};
            cache[name] = include(target, name, MODULE);
        }

        return cache[name];
    }

    def.module = function (name, callback) {
        if (callback) {
            factories[name] = {
                type: MODULE,
                impl : callback
            };
        } else {
            return use(name);
        }

    };

    def.trait = function (name, callback) {
        factories[name] = {
            type: TRAIT,
            impl : callback
        };
    };

    def.include = function (target, name, args) {
        var tgt = target;

        if ((typeof tgt) === 'string') {
            tgt = use(tgt);
        }

        return include(tgt, name, TRAIT, args);
    };

    def.reset = function () {
        cache = {};
    };

    def.plugin = function (name, fn) {
        if (!plugins[name]) {
            plugins[name] = [];
        }

        plugins[name].push(fn);
    };

    return def;
}());
{'fraction_non_alphanumeric': 0.13652572592969944, 'fraction_numerical': 0.0023773136355917813, 'mean_word_length': 1.2192916352675207, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5343064', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1607, 'n_words': 392}