<commit_before>define(function (require) {
    'use strict';
    var Backbone = require('backbone');
    var _ = require('underscore');

    Backbone.DRF = {
        idAttribute: 'id'
    };

    Backbone.DRF.Model = Backbone.Model.extend({
        idAttribute: Backbone.DRF.idAttribute,

        url: function () {
            // Models should define urlRoot. if that is not the case,
            // this method will try to get the base URL from the collection.
            var url = _.result(this, 'urlRoot') ||
                (this.collection && _.result(this.collection, 'url' ));

            url = addSlash(url) + this.id;

            return addSlash(url);
        }
    });

    Backbone.DRF.Collection = Backbone.Collection.extend({
        parse: function (data) {
            /**
            *  Return data.results if it exists
            *  Assigne the pagination attributes to the collection
            */
            this.count = data.count;
            this.next = data.next;
            this.previous = data.previous;
            return data && data.results || data;
        },

        getNextPage: function (options) {
            /**
            *  Method to retrieve the next page in the pagination
            *  and maintain the other filters.
            */
            if (!this.next) {
                return null;
            }

            var opts = options || {};
            var filters = this.next.split('?')[1];
            opts.data = filters;
            return this.fetch(opts);
        },

        getPreviousPage: function (options) {
            /**
            *  Method to retrieve the previous page in the
            *  pagination and maintain the other filters.
            */
            if (!this.previous) {
                return null;
            }
            var opts = options || {};
            var filters = this.previous.split('?')[1];
            opts.data = filters;
            return this.fetch(opts);
        }
    });

    var addSlash = function (str) {
        return str + ((str.length > 0 && str.charAt(str.length - 1) === '/') ? '' : '/');
    };
});
<commit_msg>add back behavior to handle new models<commit_after>define(function (require) {
    'use strict';
    var Backbone = require('backbone');
    var _ = require('underscore');

    Backbone.DRF = {
        idAttribute: 'id'
    };

    Backbone.DRF.Model = Backbone.Model.extend({
        idAttribute: Backbone.DRF.idAttribute,

        url: function () {
            // Models should define urlRoot. if that is not the case,
            // this method will try to get the base URL from the collection.
            var url = _.result(this, 'urlRoot') ||
                (this.collection && _.result(this.collection, 'url' ));

            if (!this.isNew()) {
                url = addSlash(url) + this.id;
            }

            return addSlash(url);
        }
    });

    Backbone.DRF.Collection = Backbone.Collection.extend({
        parse: function (data) {
            /**
            *  Return data.results if it exists
            *  Assigne the pagination attributes to the collection
            */
            this.count = data.count;
            this.next = data.next;
            this.previous = data.previous;
            return data && data.results || data;
        },

        getNextPage: function (options) {
            /**
            *  Method to retrieve the next page in the pagination
            *  and maintain the other filters.
            */
            if (!this.next) {
                return null;
            }

            var opts = options || {};
            var filters = this.next.split('?')[1];
            opts.data = filters;
            return this.fetch(opts);
        },

        getPreviousPage: function (options) {
            /**
            *  Method to retrieve the previous page in the
            *  pagination and maintain the other filters.
            */
            if (!this.previous) {
                return null;
            }
            var opts = options || {};
            var filters = this.previous.split('?')[1];
            opts.data = filters;
            return this.fetch(opts);
        }
    });

    var addSlash = function (str) {
        return str + ((str.length > 0 && str.charAt(str.length - 1) === '/') ? '' : '/');
    };
});

{'fraction_non_alphanumeric': 0.11940986629783311, 'fraction_numerical': 0.0018441678192715537, 'mean_word_length': 1.4376404494382022, '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': '655518', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1123, 'n_words': 310}