<commit_before>(function(){
    var Bokeh
    if (this.Bokeh){
	Bokeh = this.Bokeh;
    }else{
	Bokeh = {};
	this.Bokeh = Bokeh;
    }
    Bokeh.Collections = {}
    Bokeh.register_collection = function(key, value){
	Bokeh.Collections[key] = value;
	value.bokeh_key = key;
    }

    //BokehView
    //Regular backbone view, except, it gets assigned an id.
    //this id can be used to auto-create html ids, and pull out
    //d3, and jquery nodes based on those dom elements

    var BokehView = Backbone.View.extend({
	initialize : function(options){
	    var self = this;
	    if (!_(options).has('id')){
		self.id = _.uniqueId('BokehView');
	    }
	},
	tag_id : function(tag){
	    return "tag" + "-" + this.id;
	},
	tag_el : function(tag){
	    return $("#" + this.tag_id());
	},
	tag_d3 : function(tag){
	    return d3.select("#" + this.tag_id());
	},
    });


    //ObjectArrayDataSource (may want general data source later)
    var HasReference = Backbone.Model.extend({
	type : null,
	ref : function(){
	    return {'type' : this.type,
		    'id' : this.id};
	}
    });

    var ObjectArrayDataSource = HasReference.extend({	
    });

    //hasparent
    //display_options can be passed down to children
    //defaults for display_options should be placed 
    //in a class var display_defaults
    //the get function, will resolve an instances defaults first
    //then check the parents actual val, and finally check class defaults.
    //display options cannot go into defaults

    var HasParent = HasReference.extend({
	initialize : function(attrs, options){
	    var self = this;
	    if (!_.isNullOrUndefined(attrs['parent'])){
		self.parent_id = attrs['parent']['id'];
		self.parent_type = attrs['parent']['type'];
		self.parent = self.get_parent();
	    }
	},
	get_parent : function(){
	    var self = this;
	    return Bokeh.Collections[self.parent_type].get(self.parent_id);
	},
	get : function(attr){
	    var self = this
	    if (_.has(self.attributes, attr)){
		return self.attributes[attr];
	    }else if (
		!_.isUndefined(self.parent) &&
		_.indexOf(self.parent.parent_properties, attr) >= 0 && 
		    !_.isUndefined(self.parent.get(attr))){
		return self.parent.get(attr);
	    }else if (_.has(self.display_defaults, attr)){
		return self.display_defaults[attr];
	    }
	},
	display_defaults: {}
    });


    //Component
    var Component = HasParent.extend({
	initialize : function(attrs, options){
	    var self =  this;
	    if (!_(attrs).has('id')){
		self.id = _.uniqueId('BokehView');
	    }
	},
	defaults : {
	    parent : null
	},
	display_defaults : {
	    width : 200,
	    height : 200,
	    position : 0,
	},
	default_view : null
    });

    
    //Plot
    var Plot = Component.extend({
	type : Plot,<commit_msg>moved id code into HasReference Class<commit_after>(function(){
    var Bokeh
    if (this.Bokeh){
	Bokeh = this.Bokeh;
    }else{
	Bokeh = {};
	this.Bokeh = Bokeh;
    }
    Bokeh.Collections = {}
    Bokeh.register_collection = function(key, value){
	Bokeh.Collections[key] = value;
	value.bokeh_key = key;
    }

    //BokehView
    //Regular backbone view, except, it gets assigned an id.
    //this id can be used to auto-create html ids, and pull out
    //d3, and jquery nodes based on those dom elements

    var BokehView = Backbone.View.extend({
	initialize : function(options){
	    var self = this;
	    if (!_(options).has('id')){
		self.id = _.uniqueId('BokehView');
	    }
	},
	tag_id : function(tag){
	    return "tag" + "-" + this.id;
	},
	tag_el : function(tag){
	    return $("#" + this.tag_id());
	},
	tag_d3 : function(tag){
	    return d3.select("#" + this.tag_id());
	},
    });

    //HasReference
    //Backbone model, which can output a reference (combination of type, and id)
    //also auto creates an id on init, if one isn't passed in.
    var HasReference = Backbone.Model.extend({
	type : null,
	initialize : function(attrs, options){
	    var self = this;
	    if (!_(attrs).has('id')){
		self.id = _.uniqueId(self.type);
	    }
	},
	ref : function(){
	    return {'type' : this.type,
		    'id' : this.id};
	}
    });

    //ObjectArrayDataSource (may want general data source later)
    var ObjectArrayDataSource = HasReference.extend({	
    });

    //hasparent
    //display_options can be passed down to children
    //defaults for display_options should be placed 
    //in a class var display_defaults
    //the get function, will resolve an instances defaults first
    //then check the parents actual val, and finally check class defaults.
    //display options cannot go into defaults

    var HasParent = HasReference.extend({
	initialize : function(attrs, options){
	    var self = this;
	    if (!_.isNullOrUndefined(attrs['parent'])){
		self.parent_id = attrs['parent']['id'];
		self.parent_type = attrs['parent']['type'];
		self.parent = self.get_parent();
	    }
	},
	get_parent : function(){
	    var self = this;
	    return Bokeh.Collections[self.parent_type].get(self.parent_id);
	},
	get : function(attr){
	    var self = this
	    if (_.has(self.attributes, attr)){
		return self.attributes[attr];
	    }else if (
		!_.isUndefined(self.parent) &&
		_.indexOf(self.parent.parent_properties, attr) >= 0 && 
		    !_.isUndefined(self.parent.get(attr))){
		return self.parent.get(attr);
	    }else if (_.has(self.display_defaults, attr)){
		return self.display_defaults[attr];
	    }
	},
	display_defaults: {}
    });


    //Component
    var Component = HasParent.extend({
	defaults : {
	    parent : null
	},
	display_defaults : {
	    width : 200,
	    height : 200,
	    position : 0,
	},
	default_view : null
    });

    
    //Plot
    var Plot = Component.extend({
	type : Plot,
{'fraction_non_alphanumeric': 0.14333391884770771, 'fraction_numerical': 0.0038643948708940805, 'mean_word_length': 2.834343434343434, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5647998', 'n_tokens_mistral': 1956, 'n_tokens_neox': 1839, 'n_words': 481}