<commit_before>/**
 * @author: <NAME>
 * */

if(!String.prototype.uncapitalize){
	String.prototype.uncapitalize = function () {
		return this.charAt(0).toLowerCase() + this.slice(1);
	};
}

var SeaORM = (function (angular) {
	"use strict";
	var Models = {},
	
	prefixedURL = function (settings, declaration){
		var prefix = settings.urlPrefix,
			url = '';
		if(declaration.url){
			url = declaration.url;
		} else {
			url = typeof settings.url === 'function' ? settings.url(declaration.name): settings.url;
		}
		return prefix + url;
	},
	
	addProperty = function (obj, name) {
        if (typeof obj[name] === 'undefined') {
            Object.defineProperty(obj, name, {
                get: function () {
                	return obj.get(name);
                },
                set: function (value) {
                	obj.set(name, value);
                },
                enumerable: true,
                configurable: false
            });
        }
    },
		
	SeaModel = (function () {
		var _private = {},
		object_id = 1;
	
		var SeaModel = function (declaration, resource, data) {
			var self = this;
			
			Object.defineProperty(self, '_id', { value: object_id++, writable: false, enumerable: false, configurable: false });
			Object.defineProperty(self, '_resource', { value: resource, writable: false, enumerable: false, configurable: false });
			
			_private[this._id] = {
				fields: angular.extend({ id:0 }, declaration.fields),
				resourceObject: null
			};
			
			Object.defineProperty(self, 'isNew', {
				get: function () { return _private[self._id].fields.id == 0; }, enumerable: false, configurable: false
			});

			Object.defineProperty(self, 'isLoaded', {
				get: function () { return _private[self._id].fields.id != 0 && _private[self._id].resourceObject !== null; }, enumerable: false, configurable: false
			});
			
			Object.defineProperty(self, 'modelName', { value: declaration.name, writable: false, enumerable: false, configurable: false });
			
			for (var field in _private[this._id].fields) {
				if(typeof _private[this._id].fields[field] == 'function'){
					_private[this._id].fields[field] = declaration.fields[field]();
				}
				addProperty(this, field);
			}
			
			for (var method in declaration.methods) {
				if(typeof declaration.methods[method] === 'function') {
					this.constructor.prototype[method] = declaration.methods[method];
				}
			}
			
			if(typeof data === 'object'){
				self.setFields(data);
			} else if(typeof data === 'number' && parseInt(data)) {
				self.set('id', parseInt(data));
			}
		};
		
		SeaModel.prototype.toJS = function () {
			var js = {};
			for(var field in _private[this._id].fields) {
				if (typeof _private[this._id].fields[field] === "object") {
					js[field] = _private[this._id].fields[field].toJS();
				} else {
					js[field] = _private[this._id].fields[field];
				}
			}
			return js;
		};
		
		SeaModel.prototype.toJSON = function () {
			return JSON.stringify(this.toJS());
		};
		
		SeaModel.prototype.get = function (field) {
			if (typeof field === 'string' && _private[this._id].fields[field] !== undefined) {
				if (typeof _private[this._id].fields[field] === "object") {
					return _private[this._id].fields[field].get();
				}
				return _private[this._id].fields[field];
			}
			return angular.copy(_private[this._id].fields);
		};
		
		SeaModel.prototype.set = function (field, value) {
			if(typeof field === 'string' && _private[this._id].fields[field] !== undefined) {
				if (typeof _private[this._id].fields[field] === "object") {
					_private[this._id].fields[field].set(value);
					if(this.isLoaded) _private[this._id].resourceObject[field] = _private[this._id].fields[field].toJS();<commit_msg>bug fixes<commit_after>/**
 * @author: <NAME>
 * */

if(!String.prototype.uncapitalize){
	String.prototype.uncapitalize = function () {
		return this.charAt(0).toLowerCase() + this.slice(1);
	};
}

var SeaORM = (function (angular) {
	"use strict";
	var Models = {},
	
	prefixedURL = function (settings, declaration){
		var prefix = settings.urlPrefix,
			url = '';
		if(declaration.url){
			url = declaration.url;
		} else {
			url = typeof settings.url === 'function' ? settings.url(declaration.name): settings.url;
		}
		return prefix + url;
	},
	
	addProperty = function (obj, name) {
        if (typeof obj[name] === 'undefined') {
            Object.defineProperty(obj, name, {
                get: function () {
                	return obj.get(name);
                },
                set: function (value) {
                	obj.set(name, value);
                },
                enumerable: true,
                configurable: false
            });
        }
    },
		
	SeaModel = (function () {
		var _private = {},
		object_id = 1;
	
		var SeaModel = function (declaration, resource, data) {
			var self = this;
			
			Object.defineProperty(self, '_id', { value: object_id++, writable: false, enumerable: false, configurable: false });
			Object.defineProperty(self, '_resource', { value: resource, writable: false, enumerable: false, configurable: false });
			
			_private[this._id] = {
				fields: angular.extend({ id:0 }, declaration.fields),
				resourceObject: null
			};
			
			Object.defineProperty(self, 'isNew', {
				get: function () { return _private[self._id].fields.id == 0; }, enumerable: false, configurable: false
			});

			Object.defineProperty(self, 'isLoaded', {
				get: function () { return _private[self._id].fields.id != 0 && _private[self._id].resourceObject !== null; }, enumerable: false, configurable: false
			});
			
			Object.defineProperty(self, 'modelName', { value: declaration.name, writable: false, enumerable: false, configurable: false });
			
			for (var field in _private[this._id].fields) {
				if(typeof _private[this._id].fields[field] == 'function'){
					_private[this._id].fields[field] = declaration.fields[field]();
				}
				addProperty(this, field);
			}
			
			for (var method in declaration.methods) {
				if(typeof declaration.methods[method] === 'function') {
					this.constructor.prototype[method] = declaration.methods[method];
				}
			}
			
			if(typeof data === 'object'){
				self.setFields(data);
			} else if(typeof data === 'number' && parseInt(data)) {
				self.set('id', parseInt(data));
			}
		};
		
		SeaModel.prototype.toJS = function () {
			var js = {};
			for(var field in _private[this._id].fields) {
				if (_private[this._id].fields[field] != null && typeof _private[this._id].fields[field] === "object") {
					js[field] = _private[this._id].fields[field].toJS();
				} else {
					js[field] = _private[this._id].fields[field];
				}
			}
			return js;
		};
		
		SeaModel.prototype.toJSON = function () {
			return JSON.stringify(this.toJS());
		};
		
		SeaModel.prototype.get = function (field) {
			if (typeof field === 'string' && _private[this._id].fields[field] !== undefined) {
				if (_private[this._id].fields[field] != null && typeof _private[this._id].fields[field] === "object") {
					return _private[this._id].fields[field].get();
				}
				return _private[this._id].fields[field];
			}
			return angular.copy(_private[this._id].fields);
		};
		
		SeaModel.prototype.set = function (field, value) {
			if(typeof field === 'string' && _private[this._id].fields[field] !== undefined) {
				if (_private[this._id].fields[field] != null && typeof _private[this._id].fields[field] === "object") {
					_private[this._id].fields[field].set(value);
					if(this.isLoaded) _private[this._id].resourceObject[field] = _private[this._id].fields[field].toJS();
{'fraction_non_alphanumeric': 0.16583047266965936, 'fraction_numerical': 0.0015843675732770002, 'mean_word_length': 3.0945945945945947, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4270742', 'n_tokens_mistral': 2754, 'n_tokens_neox': 2328, 'n_words': 464}