<commit_before>(function (clique, Backbone, _, d3, cola) {
    "use strict";

    var prefill,
        fill,
        strokeWidth;

    prefill = function (cmap) {
        return function (d) {
            if (d.key === this.focused) {
                return "pink";
            } else if (d.root) {
                return "gold";
            } else {
                return cmap(d);
            }
        };
    };

    fill = function (cmap) {
        return function (d) {
            this.model.adapter.getMutator({
                _id: {
                    $oid: d.key
                }
            }).clearTransient("root");

            if (d.key === this.focused) {
                return "pink";
            } else {
                return cmap(d);
            }
        };
    };

    strokeWidth = function (d) {
        return this.selected.has(d.key) ? "2px" : "0px";
    };

    clique.view.Cola = Backbone.View.extend({
        initialize: function (options) {
            var cmap;

            clique.util.require(this.model, "model");
            clique.util.require(this.el, "el");

            options = options || {};

            this.nodeRadius = function (d) {
                var r = options.nodeRadius || 7.5;
                return d.data && d.data.grouped ? 2*r : r;
            };

            this.transitionTime = 500;

            cmap = d3.scale.category10();
            this.colormap = function (d) {
                return cmap((d.data || {}).type || "no type");
            };

            this.prefill = prefill(this.colormap);
            this.fill = fill(this.colormap);

            this.cola = cola.d3adaptor()
                .linkDistance(options.linkDistance || 100)
                .avoidOverlaps(true)
                .size([this.$el.width(), this.$el.height()])
                .start();

            this.selection = new clique.model.Selection();
            this.linkSelection = new clique.model.Selection();

            this.$el.html(clique.template.cola());
            this.listenTo(this.model, "change", _.debounce(this.render, 100));
            this.listenTo(this.selection, "focused", function (focused) {
                this.focused = focused;
                this.renderNodes();
            });
            this.listenTo(this.linkSelection, "focused", _.debounce(function (focused) {
                d3.select(this.el)
                    .selectAll(".handle")
                    .classed("focused", false)
                    .filter(function (d) {
                        return d.key === focused;
                    })
                    .classed("focused", true);
            }, 100));
            this.listenTo(this.linkSelection, "added", _.debounce(function (key) {
                d3.select(this.el)
                    .selectAll(".handle")
                    .filter(function (d) {
                        return d.key === key;
                    })
                    .classed("selected", true);
            }, 100));
            this.listenTo(this.linkSelection, "removed", _.debounce(function (key) {
                d3.select(this.el)
                    .selectAll(".handle")
                    .filter(function (d) {
                        return d.key === key;
                    })
                    .classed("selected", false);
            }, 100));

            this.selected = new clique.util.Set();
            this.listenTo(this.selection, "added", function (key) {
                this.selected.add(key);
            });
            this.listenTo(this.selection, "removed", function (key) {
                this.selected.remove(key);
            });
        },

        renderNodes: function (cfg) {
            var that = this;

            if (cfg && cfg.cancel) {
                this.nodes.interrupt();
            }

            this.nodes
                .style("fill", _.bind(this.prefill, this))
                .style("stroke", "blue")
                .style("stroke-width", _.bind(strokeWidth, this))
                .filter(function (d) {
                    return d.root;
                })
                .transition()
                .delay(this.transitionTime)
                .each("interrupt", function () {
                    d3.select(this)
                        .style("fill", _.bind(that.fill, that));
                })
                .duration(1500)<commit_msg>Fixing rendering issue from debouncing incorrectly<commit_after>(function (clique, Backbone, _, d3, cola) {
    "use strict";

    var prefill,
        fill,
        strokeWidth;

    prefill = function (cmap) {
        return function (d) {
            if (d.key === this.focused) {
                return "pink";
            } else if (d.root) {
                return "gold";
            } else {
                return cmap(d);
            }
        };
    };

    fill = function (cmap) {
        return function (d) {
            this.model.adapter.getMutator({
                _id: {
                    $oid: d.key
                }
            }).clearTransient("root");

            if (d.key === this.focused) {
                return "pink";
            } else {
                return cmap(d);
            }
        };
    };

    strokeWidth = function (d) {
        return this.selected.has(d.key) ? "2px" : "0px";
    };

    clique.view.Cola = Backbone.View.extend({
        initialize: function (options) {
            var cmap;

            clique.util.require(this.model, "model");
            clique.util.require(this.el, "el");

            options = options || {};

            this.nodeRadius = function (d) {
                var r = options.nodeRadius || 7.5;
                return d.data && d.data.grouped ? 2*r : r;
            };

            this.transitionTime = 500;

            cmap = d3.scale.category10();
            this.colormap = function (d) {
                return cmap((d.data || {}).type || "no type");
            };

            this.prefill = prefill(this.colormap);
            this.fill = fill(this.colormap);

            this.cola = cola.d3adaptor()
                .linkDistance(options.linkDistance || 100)
                .avoidOverlaps(true)
                .size([this.$el.width(), this.$el.height()])
                .start();

            this.selection = new clique.model.Selection();
            this.linkSelection = new clique.model.Selection();

            this.$el.html(clique.template.cola());
            this.listenTo(this.model, "change", _.debounce(this.render, 100));
            this.listenTo(this.selection, "focused", function (focused) {
                this.focused = focused;
                this.renderNodes();
            });
            this.listenTo(this.linkSelection, "removed", function (key) {
                d3.select(this.el)
                    .selectAll(".handle")
                    .filter(function (d) {
                        return d.key === key;
                    })
                .classed("selected", false);
            });
            this.listenTo(this.linkSelection, "added", function (key) {
                d3.select(this.el)
                    .selectAll(".handle")
                    .filter(function (d) {
                        return d.key === key;
                    })
                .classed("selected", true);
            });
            this.listenTo(this.linkSelection, "focused", function (focused) {
                d3.select(this.el)
                    .selectAll(".handle")
                    .classed("focused", false)
                    .filter(function (d) {
                        return d.key === focused;
                    })
                .classed("focused", true);
            });

            this.selected = new clique.util.Set();
            this.listenTo(this.selection, "added", function (key) {
                this.selected.add(key);
            });
            this.listenTo(this.selection, "removed", function (key) {
                this.selected.remove(key);
            });
        },

        renderNodes: function (cfg) {
            var that = this;

            if (cfg && cfg.cancel) {
                this.nodes.interrupt();
            }

            this.nodes
                .style("fill", _.bind(this.prefill, this))
                .style("stroke", "blue")
                .style("stroke-width", _.bind(strokeWidth, this))
                .filter(function (d) {
                    return d.root;
                })
                .transition()
                .delay(this.transitionTime)
                .each("interrupt", function () {
                    d3.select(this)
                        .style("fill", _.bind(that.fill, that));
                })
                .duration(1500)
{'fraction_non_alphanumeric': 0.13423279213354677, 'fraction_numerical': 0.007203292933912646, 'mean_word_length': 1.1791230692575985, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5289729', 'n_tokens_mistral': 2454, 'n_tokens_neox': 2246, 'n_words': 425}