<commit_before>window.multigraph.util.namespace("window.multigraph.core", function (ns) {
    "use strict";

    var Multigraph = new window.jermaine.Model( "Multigraph", function () {

        this.hasMany("graphs").which.validatesWith(function (graph) {
            return graph instanceof ns.Graph;
        });

        this.hasA("div"); // the actual div element

        this.respondsTo("initializeGeometry", function (width, height, graphicsContext) {
            var i;
            for (i=0; i < this.graphs().size(); ++i) {
                this.graphs().at(i).initializeGeometry(width, height, graphicsContext);
            }
        });

        this.respondsTo("registerCommonDataCallback", function (callback) {
            var i, j,
                graphs = this.graphs(),
                data;
            for (i=0; i < graphs.size(); ++i) {
                data = graphs.at(i).data();
                for (j=0; j<data.size(); ++j) {
                    data.at(j).onReady(callback);
                }
            }
        });

    });

    Multigraph.createGraph = function (obj) {
        var div = obj.div;
        if (!obj.driver) {
            obj.driver = "canvas";
        }
        if (typeof(div) === "string") {
            // if div is a string, assume it's an id, and convert
            // it to the div element itself
            div = $("#" + div)[0];
        }
        if (!obj.errorHandler || typeof(obj.errorHandler) !== "function") {
            obj.errorHandler = Multigraph.createDefaultErrorHandler(div);
        }
        if (obj.driver === "canvas") {
            return Multigraph.createCanvasGraph(div, obj.mugl, obj.errorHandler);
        } else if (obj.driver === "raphael") {
            return Multigraph.createRaphaelGraph(div, obj.mugl, obj.errorHandler);
        } else if (obj.driver === "logger") {
            return Multigraph.createLoggerGraph(div, obj.mugl);
        }
        throw new Error("invalid graphic driver '" + obj.driver + "' specified to Multigraph.createGraph");
    };

    Multigraph.createDefaultErrorHandler = function (div) {
        return function (e) {
            var errorMessages,
                i;

            $(div).append($("<ol>", {"text" : e.message, "style" : "z-index:100; border:1px solid black; background-color : #CCC; white-space: pre-wrap; text-align: left;"}));

            if (e.stack && typeof(e.stack) === "string") {
                errorMessages = e.stack.split(/\n/);<commit_msg>tweaks the default errorHandler function<commit_after>window.multigraph.util.namespace("window.multigraph.core", function (ns) {
    "use strict";

    var Multigraph = new window.jermaine.Model( "Multigraph", function () {

        this.hasMany("graphs").which.validatesWith(function (graph) {
            return graph instanceof ns.Graph;
        });

        this.hasA("div"); // the actual div element

        this.respondsTo("initializeGeometry", function (width, height, graphicsContext) {
            var i;
            for (i=0; i < this.graphs().size(); ++i) {
                this.graphs().at(i).initializeGeometry(width, height, graphicsContext);
            }
        });

        this.respondsTo("registerCommonDataCallback", function (callback) {
            var i, j,
                graphs = this.graphs(),
                data;
            for (i=0; i < graphs.size(); ++i) {
                data = graphs.at(i).data();
                for (j=0; j<data.size(); ++j) {
                    data.at(j).onReady(callback);
                }
            }
        });

    });

    Multigraph.createGraph = function (obj) {
        var div = obj.div;
        if (!obj.driver) {
            obj.driver = "canvas";
        }
        if (typeof(div) === "string") {
            // if div is a string, assume it's an id, and convert
            // it to the div element itself
            div = $("#" + div)[0];
        }
        if (!obj.errorHandler || typeof(obj.errorHandler) !== "function") {
            obj.errorHandler = Multigraph.createDefaultErrorHandler(div);
        }
        if (obj.driver === "canvas") {
            return Multigraph.createCanvasGraph(div, obj.mugl, obj.errorHandler);
        } else if (obj.driver === "raphael") {
            return Multigraph.createRaphaelGraph(div, obj.mugl, obj.errorHandler);
        } else if (obj.driver === "logger") {
            return Multigraph.createLoggerGraph(div, obj.mugl);
        }
        throw new Error("invalid graphic driver '" + obj.driver + "' specified to Multigraph.createGraph");
    };

    Multigraph.createDefaultErrorHandler = function (div) {
        return function (e) {
            var errorMessages,
                i;

            $(div).css("overflow", "auto");
            $(div).append($("<ol>", {"text" : e.message, "style" : "z-index:100; border:1px solid black; background-color : #CCC; white-space: pre-wrap; text-align: left;"}));

            if (e.stack && typeof(e.stack) === "string") {
                errorMessages = e.stack.split(/\n/);
{'fraction_non_alphanumeric': 0.14953271028037382, 'fraction_numerical': 0.0031815470272419963, 'mean_word_length': 1.9380841121495327, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6681867', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1389, 'n_words': 317}