<commit_before>import Ember from "ember";

function factory(obj) {
    return obj.get("constructor.ClassMixin.ownerConstructor");
}

function attrs(obj) {
    var all = [];
    factory(obj).eachComputedProperty(function (key, meta) {
        if (meta.isAttribute) {
            all.push(key);
        }
    });
    return all;
}

function clone(obj) {
    var copy = {};
    factory(obj).eachComputedProperty(function (key, meta) {
        if (meta.isAttribute) {
            copy[key] = obj.get(key);
        }
    });
    return copy;
}

var attr = function() {
    var meta = {isAttribute: true};
    return function(key, value) {
        var data = this.get("_data") || {};
        var dirty = this.get("_dirty") || {};
        if (arguments.length === 2) {
            if (!this.get("isDirty") && !this.get("isPrimed")) {
                var oldState = clone(this);
                this.set("_oldState", oldState);
            }
            var primed = value === "" && data[key] === undefined;
            if(!primed) {
                this.set("isPrimed", true);
                dirty["%@:isDirty".fmt(key)] = true;
                data[key] = value;
            }
        }
        return data[key];
    }.property("_data").meta(meta);
};

var Model = Ember.Object.extend({
    init: function() {
        this._super();
        this._reset();
        this._setup();
        this.set("_data", clone(this));
        this.set("_oldState", clone(this));
    },
    rollback: function() {
        var oldState = this.get("_oldState");
        for(var key in oldState){
            this.set(key, oldState[key]);
        }<commit_msg>[REFACTOR] removing Function.prototype.property<commit_after>import Ember from "ember";

function factory(obj) {
    return obj.get("constructor.ClassMixin.ownerConstructor");
}

function attrs(obj) {
    var all = [];
    factory(obj).eachComputedProperty(function (key, meta) {
        if (meta.isAttribute) {
            all.push(key);
        }
    });
    return all;
}

function clone(obj) {
    var copy = {};
    factory(obj).eachComputedProperty(function (key, meta) {
        if (meta.isAttribute) {
            copy[key] = obj.get(key);
        }
    });
    return copy;
}

var attr = function() {
    var meta = {isAttribute: true};
    return Ember.computed(function(key, value) {
        var data = this.get("_data") || {};
        var dirty = this.get("_dirty") || {};
        if (arguments.length === 2) {
            if (!this.get("isDirty") && !this.get("isPrimed")) {
                var oldState = clone(this);
                this.set("_oldState", oldState);
            }
            var primed = value === "" && data[key] === undefined;
            if(!primed) {
                this.set("isPrimed", true);
                dirty["%@:isDirty".fmt(key)] = true;
                data[key] = value;
            }
        }
        return data[key];
    }).property("_data").meta(meta);
};

var Model = Ember.Object.extend({
    init: function() {
        this._super();
        this._reset();
        this._setup();
        this.set("_data", clone(this));
        this.set("_oldState", clone(this));
    },
    rollback: function() {
        var oldState = this.get("_oldState");
        for(var key in oldState){
            this.set(key, oldState[key]);
        }
{'fraction_non_alphanumeric': 0.16536144578313253, 'fraction_numerical': 0.0006024096385542169, 'mean_word_length': 1.981149012567325, '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': '566455', 'n_tokens_mistral': 1020, 'n_tokens_neox': 1006, 'n_words': 198}