<commit_before>define(function(require, exports) {
    'use strict';
    var geometryTypeWidget = require('widgets/geometryType-widget');
    var warningWidget = require('widgets/warning');

    var widgetsRegister = {};

    /**
     * Register a new widget
     * @param widget
     */
    var registerWidget = function(widget) {
        var name = widget.name;

        if (!widgetsRegister.hasOwnProperty(name)) {
            widgetsRegister[name] = [];
        }
        widgetsRegister[name].push(widget);
    };

    /**
     * Get the list of widgets registered with that type
     * @param widgetType
     * @return Array of widgets
     */
    var getWidgets = function(widgetType) {
        var widgets = [];
        if (widgetsRegister.hasOwnProperty(widgetType)) {
            widgets = widgetsRegister[widgetType];
        }

        return widgets;
    };

    /**
     * Invoke the initialize function of an Array of widgets
     * @param widgets
     */
    var initializeWidgets = function(widgets) {
        var args = Array.prototype.slice.call(arguments, 1);

        for (var i = 0, len = widgets.length; i < len; i++) {
            widgets[i].initialize.apply(null, args);
        }
    };

    /**
     * Invoke the serialize function of an Array of widgets
     * @param widgets
     * @return the value of merging the calls, null if no serialize is implemented
     */
    var serializeWidgets = function(widgets) {
        var args = Array.prototype.slice.call(arguments, 1);
        var result;
        var value, repr;
        var valueWithError;
        var values = [];
        var i, len;

        for (i = 0, len = widgets.length; i < len; i++) {
            valueWithError = widgets[i].serialize.apply(null, args);
            if (valueWithError.serialize === true) {
                values.push(valueWithError);
            }
        }

        switch (values.length) {
            case 0:
                result = null;
            break;
            case 1:
                result = {
                    value: values[0].value,
                    repr: values[0].repr
                };
            break;
            default:
                value = {};
                repr = '';
                for (i = 0, len = values.length; i < len; i++) {
                    $.extend(value, values[i].value);
                    repr += values[i].repr;
                }

                result = {
                    value: value,
                    repr: repr
                };
        }

        return result;
    };

    // Register default widgets
    registerWidget(warningWidget);
    registerWidget(geometryTypeWidget);

    // Public interface
    return {
        registerWidget: registerWidget,
        getWidgets: getWidgets,
        initializeWidgets: initializeWidgets,
        serializeWidgets: serializeWidgets
    };

});
<commit_msg>Remove references to geometryType-widget<commit_after>define(function(require, exports) {
    'use strict';
    var warningWidget = require('widgets/warning');

    var widgetsRegister = {};

    /**
     * Register a new widget
     * @param widget
     */
    var registerWidget = function(widget) {
        var name = widget.name;

        if (!widgetsRegister.hasOwnProperty(name)) {
            widgetsRegister[name] = [];
        }
        widgetsRegister[name].push(widget);
    };

    /**
     * Get the list of widgets registered with that type
     * @param widgetType
     * @return Array of widgets
     */
    var getWidgets = function(widgetType) {
        var widgets = [];
        if (widgetsRegister.hasOwnProperty(widgetType)) {
            widgets = widgetsRegister[widgetType];
        }

        return widgets;
    };

    /**
     * Invoke the initialize function of an Array of widgets
     * @param widgets
     */
    var initializeWidgets = function(widgets) {
        var args = Array.prototype.slice.call(arguments, 1);

        for (var i = 0, len = widgets.length; i < len; i++) {
            widgets[i].initialize.apply(null, args);
        }
    };

    /**
     * Invoke the serialize function of an Array of widgets
     * @param widgets
     * @return the value of merging the calls, null if no serialize is implemented
     */
    var serializeWidgets = function(widgets) {
        var args = Array.prototype.slice.call(arguments, 1);
        var result;
        var value, repr;
        var valueWithError;
        var values = [];
        var i, len;

        for (i = 0, len = widgets.length; i < len; i++) {
            valueWithError = widgets[i].serialize.apply(null, args);
            if (valueWithError.serialize === true) {
                values.push(valueWithError);
            }
        }

        switch (values.length) {
            case 0:
                result = null;
            break;
            case 1:
                result = {
                    value: values[0].value,
                    repr: values[0].repr
                };
            break;
            default:
                value = {};
                repr = '';
                for (i = 0, len = values.length; i < len; i++) {
                    $.extend(value, values[i].value);
                    repr += values[i].repr;
                }

                result = {
                    value: value,
                    repr: repr
                };
        }

        return result;
    };

    // Register default widgets
    registerWidget(warningWidget);

    // Public interface
    return {
        registerWidget: registerWidget,
        getWidgets: getWidgets,
        initializeWidgets: initializeWidgets,
        serializeWidgets: serializeWidgets
    };

});

{'fraction_non_alphanumeric': 0.10474516695957821, 'fraction_numerical': 0.003163444639718805, 'mean_word_length': 1.5658250676284942, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5485987', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1469, 'n_words': 387}