<commit_before>//     Backbone.js 1.1.2

//     (c) 2010-2014 <NAME>, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

(function(root, factory) {

  // Set up Backbone appropriately for the environment. Start with AMD.
  if (typeof define === 'function' && define.amd) {
    define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
      // Export global even in AMD case in case this script is loaded with
      // others that may still expect a global Backbone.
      root.Backbone = factory(root, exports, _, $);
    });

  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
  } else if (typeof exports !== 'undefined') {
    var _ = require('underscore');
    factory(root, exports, _);

  // Finally, as a browser global.
  } else {
    root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
  }

}(this, function(root, Backbone, _, $) {

  // Initial Setup
  // -------------

  // Save the previous value of the `Backbone` variable, so that it can be
  // restored later on, if `noConflict` is used.
  var previousBackbone = root.Backbone;

  // Create local references to array methods we'll want to use later.
  var array = [];
  var slice = array.slice;

  // Current version of the library. Keep in sync with `package.json`.
  Backbone.VERSION = '1.1.2';

  // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
  // the `$` variable.
  Backbone.$ = $;

  // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
  // to its previous owner. Returns a reference to this Backbone object.
  Backbone.noConflict = function() {
    root.Backbone = previousBackbone;
    return this;
  };

  // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
  // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
  // set a `X-Http-Method-Override` header.
  Backbone.emulateHTTP = false;

  // Turn on `emulateJSON` to support legacy servers that can't deal with direct
  // `application/json` requests ... this will encode the body as
  // `application/x-www-form-urlencoded` instead and will send the model in a
  // form param named `model`.
  Backbone.emulateJSON = false;

  // Backbone.Events
  // ---------------

  // A module that can be mixed in to *any object* in order to provide it with
  // custom events. You may bind with `on` or remove with `off` callback
  // functions to an event; `trigger`-ing an event fires all callbacks in
  // succession.
  //
  //     var object = {};
  //     _.extend(object, Backbone.Events);
  //     object.on('expand', function(){ alert('expanded'); });
  //     object.trigger('expand');
  //
  var Events = Backbone.Events = {

    // Bind an event to a `callback` function. Passing `"all"` will bind
    // the callback to all events fired.
    on: function(name, callback, context) {
      this._events = eventsApi(onApi, this._events || {}, name, callback, context, this);
      return this;
    },

    // Bind an event to only be triggered a single time. After the first time
    // the callback is invoked, it will be removed.
    once: function(name, callback, context) {
      name = onceMap(name, callback, _.bind(this.off, this));
      return this.on(name, callback, context);
    },

    // Remove one or many callbacks. If `context` is null, removes all
    // callbacks with that function. If `callback` is null, removes all
    // callbacks for the event. If `name` is null, removes all bound
    // callbacks for all events.
    off: function(name, callback, context) {
      if (!this._events) return this;
      this._events = eventsApi(offApi, this._events, name, callback, context);
      return this;
    },

    // Trigger one or many events, firing all bound callbacks. Callbacks are
    // passed the same arguments as `trigger` is, apart from the event name
    // (unless you're listening on `"all"`, which will cause your callback to
    // receive the true name of the event as the first argument).
    trigger: function(name) {
      if (!this._events) return this;
      var args = slice.call(arguments, 1);
      eventsApi(triggerApi, this, name, triggerApi, args);
      return this;
    },

    // Inversion-of-control versions of `on` and `once`. Tell *this* object to
    // listen to an event in another object ... keeping track of what it's
    // listening to.
    listenTo: function(obj, name, callback) {
      if (!obj) return this;
      var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
      var listeningTo = this._listeningTo || (this._listeningTo = {});
      var listenee = listeningTo[id] || (listeningTo[id] = {obj: obj, events: {}});
      obj.on(name, callback, this);
      listenee.events = eventsApi(onApi, listenee.events, name, callback);
      return this;
    },

    listenToOnce: function(obj, name, callback) {
      name = onceMap(name, callback, _.bind(this.stopListening, this, obj));
      return this.listenTo(obj, name, callback);
    },

    // Tell this object to stop listening to either specific events ... or
    // to every object it's currently listening to.
    stopListening: function(obj, name, callback) {
      var listeningTo = this._listeningTo;
      if (!listeningTo) return this;

      var listeneeIds = (obj) ? [obj._listenId] : _.keys(listeningTo);
      for (var i = 0, length = listeneeIds.length; i < length; i++) {
        var id = listeneeIds[i];
        var listenee = listeningTo[id];
        if (!listenee) break;
        listenee.obj.off(name, callback, this);
        var events = eventsApi(offApi, listenee.events, name, callback);
        if (!events) delete listeningTo[id];
      }
      if (_.isEmpty(listeningTo)) this._listeningTo = void 0;
      return this;
    }

  };

  // Regular expression used to split event strings.
  var eventSplitter = /\s+/;

  // Implement fancy features of the Events API such as multiple event
  // names `"change blur"` and jQuery-style event maps `{change: action}`
  // in terms of the existing API.
  var eventsApi = function(api, events, name, callback, context, ctx) {
    var i = 0, names, length;
    if (name && typeof name === 'object') {
      // Handle event maps.
      for (names = _.keys(name), length = names.length; i < length; i++) {
        events = api(events, names[i], name[names[i]], context, ctx);
      }
    } else if (name && eventSplitter.test(name)) {
      // Handle space separated event names.
      for (names = name.split(eventSplitter), length = names.length; i < length; i++) {
        events = api(events, names[i], callback, context, ctx);
      }
    } else {
      events = api(events, name, callback, context, ctx);
    }
    return events;
  };

  // Handles actually adding the event handler.
  var onApi = function(events, name, callback, context, ctx) {
    if (callback) {
      var handlers = events[name] || [];
      events[name] = handlers.concat({callback: callback, context: context, ctx: context || ctx});
    }
    return events;
  };

  // Handles removing any event handlers that are no longer wanted.
  var offApi = function(events, name, callback, context) {
    // Remove all callbacks for all events.
    if (!events || !name && !context && !callback) return;

    var names = name ? [name] : _.keys(events);
    for (var i = 0, length = names.length; i < length; i++) {
      name = names[i];

      // Bail out if there are no events stored.
      var handlers = events[name];
      if (!handlers) continue;

      // Find any remaining events.
      var remaining = [];
      if (callback || context) {
        for (var j = 0, k = handlers.length; j < k; j++) {
          var handler = handlers[j];
          if (
            callback && callback !== handler.callback &&
              callback !== handler.callback._callback ||
                context && context !== handler.context
          ) {
            remaining.push(handler);
          }
        }
      }

      // Replace events if there are any remaining.  Otherwise, clean up.
      if (remaining.length) {
        events[name] = remaining;
      } else {
        delete events[name];
      }
    }
    return _.isEmpty(events) ? void 0 : events;
  };

  var triggerApi = function(obj, name, sentinel, args) {
    if (obj._events) {
      if (sentinel !== triggerApi) args = [sentinel].concat(args);
      var events = obj._events[name];
      var allEvents = obj._events.all;
      if (events) triggerEvents(events, args);
      if (allEvents) triggerEvents(allEvents, [name].concat(args));
    }
    return obj;
  };

  // Maps the normalized event callbacks into onceWrappers.
  var onceMap = function(name, callback, offer) {
    return eventsApi(function(map, name, callback, offer) {
      if (callback) map[name] = onceWrap(name, callback, offer);
      return map;
    }, {}, name, callback, offer);
  };

  // Wraps an event callback, using the `offer` function to off the event
  // once it's been called.
  var onceWrap = function(name, callback, offer) {
    var once = _.once(function() {
      offer(name, once);
      callback.apply(this, arguments);
    });
    once._callback = callback;
    return once;
  };

  // A difficult-to-believe, but optimized internal dispatch function for
  // triggering events. Tries to keep the usual cases speedy (most internal
  // Backbone events have 3 arguments).
  var triggerEvents = function(events, args) {
    var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
    switch (args.length) {
      case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
      case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
      case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
      case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
      default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
    }
  };

  // Aliases for backwards compatibility.
  Events.bind   = Events.on;
  Events.unbind = Events.off;

  // Allow the `Backbone` object to serve as a global event bus, for folks who
  // want global "pubsub" in a convenient place.
  _.extend(Backbone, Events);

  // Backbone.Model
  // --------------
<commit_msg>Inline onceWrapper<commit_after>//     Backbone.js 1.1.2

//     (c) 2010-2014 <NAME>, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

(function(root, factory) {

  // Set up Backbone appropriately for the environment. Start with AMD.
  if (typeof define === 'function' && define.amd) {
    define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
      // Export global even in AMD case in case this script is loaded with
      // others that may still expect a global Backbone.
      root.Backbone = factory(root, exports, _, $);
    });

  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
  } else if (typeof exports !== 'undefined') {
    var _ = require('underscore');
    factory(root, exports, _);

  // Finally, as a browser global.
  } else {
    root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
  }

}(this, function(root, Backbone, _, $) {

  // Initial Setup
  // -------------

  // Save the previous value of the `Backbone` variable, so that it can be
  // restored later on, if `noConflict` is used.
  var previousBackbone = root.Backbone;

  // Create local references to array methods we'll want to use later.
  var array = [];
  var slice = array.slice;

  // Current version of the library. Keep in sync with `package.json`.
  Backbone.VERSION = '1.1.2';

  // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
  // the `$` variable.
  Backbone.$ = $;

  // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
  // to its previous owner. Returns a reference to this Backbone object.
  Backbone.noConflict = function() {
    root.Backbone = previousBackbone;
    return this;
  };

  // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
  // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
  // set a `X-Http-Method-Override` header.
  Backbone.emulateHTTP = false;

  // Turn on `emulateJSON` to support legacy servers that can't deal with direct
  // `application/json` requests ... this will encode the body as
  // `application/x-www-form-urlencoded` instead and will send the model in a
  // form param named `model`.
  Backbone.emulateJSON = false;

  // Backbone.Events
  // ---------------

  // A module that can be mixed in to *any object* in order to provide it with
  // custom events. You may bind with `on` or remove with `off` callback
  // functions to an event; `trigger`-ing an event fires all callbacks in
  // succession.
  //
  //     var object = {};
  //     _.extend(object, Backbone.Events);
  //     object.on('expand', function(){ alert('expanded'); });
  //     object.trigger('expand');
  //
  var Events = Backbone.Events = {

    // Bind an event to a `callback` function. Passing `"all"` will bind
    // the callback to all events fired.
    on: function(name, callback, context) {
      this._events = eventsApi(onApi, this._events || {}, name, callback, context, this);
      return this;
    },

    // Bind an event to only be triggered a single time. After the first time
    // the callback is invoked, it will be removed.
    once: function(name, callback, context) {
      name = onceMap(name, callback, _.bind(this.off, this));
      return this.on(name, callback, context);
    },

    // Remove one or many callbacks. If `context` is null, removes all
    // callbacks with that function. If `callback` is null, removes all
    // callbacks for the event. If `name` is null, removes all bound
    // callbacks for all events.
    off: function(name, callback, context) {
      if (!this._events) return this;
      this._events = eventsApi(offApi, this._events, name, callback, context);
      return this;
    },

    // Trigger one or many events, firing all bound callbacks. Callbacks are
    // passed the same arguments as `trigger` is, apart from the event name
    // (unless you're listening on `"all"`, which will cause your callback to
    // receive the true name of the event as the first argument).
    trigger: function(name) {
      if (!this._events) return this;
      var args = slice.call(arguments, 1);
      eventsApi(triggerApi, this, name, triggerApi, args);
      return this;
    },

    // Inversion-of-control versions of `on` and `once`. Tell *this* object to
    // listen to an event in another object ... keeping track of what it's
    // listening to.
    listenTo: function(obj, name, callback) {
      if (!obj) return this;
      var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
      var listeningTo = this._listeningTo || (this._listeningTo = {});
      var listenee = listeningTo[id] || (listeningTo[id] = {obj: obj, events: {}});
      obj.on(name, callback, this);
      listenee.events = eventsApi(onApi, listenee.events, name, callback);
      return this;
    },

    listenToOnce: function(obj, name, callback) {
      name = onceMap(name, callback, _.bind(this.stopListening, this, obj));
      return this.listenTo(obj, name, callback);
    },

    // Tell this object to stop listening to either specific events ... or
    // to every object it's currently listening to.
    stopListening: function(obj, name, callback) {
      var listeningTo = this._listeningTo;
      if (!listeningTo) return this;

      var listeneeIds = obj ? [obj._listenId] : _.keys(listeningTo);
      for (var i = 0, length = listeneeIds.length; i < length; i++) {
        var id = listeneeIds[i];
        var listenee = listeningTo[id];
        if (!listenee) break;
        listenee.obj.off(name, callback, this);
        var events = eventsApi(offApi, listenee.events, name, callback);
        if (!events) delete listeningTo[id];
      }
      if (_.isEmpty(listeningTo)) this._listeningTo = void 0;
      return this;
    }

  };

  // Regular expression used to split event strings.
  var eventSplitter = /\s+/;

  // Implement fancy features of the Events API such as multiple event
  // names `"change blur"` and jQuery-style event maps `{change: action}`
  // in terms of the existing API.
  var eventsApi = function(api, events, name, callback, context, ctx) {
    var i = 0, names, length;
    if (name && typeof name === 'object') {
      // Handle event maps.
      for (names = _.keys(name), length = names.length; i < length; i++) {
        events = api(events, names[i], name[names[i]], context, ctx);
      }
    } else if (name && eventSplitter.test(name)) {
      // Handle space separated event names.
      for (names = name.split(eventSplitter), length = names.length; i < length; i++) {
        events = api(events, names[i], callback, context, ctx);
      }
    } else {
      events = api(events, name, callback, context, ctx);
    }
    return events;
  };

  // Handles actually adding the event handler.
  var onApi = function(events, name, callback, context, ctx) {
    if (callback) {
      var handlers = events[name] || [];
      events[name] = handlers.concat({callback: callback, context: context, ctx: context || ctx});
    }
    return events;
  };

  // Handles removing any event handlers that are no longer wanted.
  var offApi = function(events, name, callback, context) {
    // Remove all callbacks for all events.
    if (!events || !name && !context && !callback) return;

    var names = name ? [name] : _.keys(events);
    for (var i = 0, length = names.length; i < length; i++) {
      name = names[i];

      // Bail out if there are no events stored.
      var handlers = events[name];
      if (!handlers) continue;

      // Find any remaining events.
      var remaining = [];
      if (callback || context) {
        for (var j = 0, k = handlers.length; j < k; j++) {
          var handler = handlers[j];
          if (
            callback && callback !== handler.callback &&
              callback !== handler.callback._callback ||
                context && context !== handler.context
          ) {
            remaining.push(handler);
          }
        }
      }

      // Replace events if there are any remaining.  Otherwise, clean up.
      if (remaining.length) {
        events[name] = remaining;
      } else {
        delete events[name];
      }
    }
    return _.isEmpty(events) ? void 0 : events;
  };

  var triggerApi = function(obj, name, sentinel, args) {
    if (obj._events) {
      if (sentinel !== triggerApi) args = [sentinel].concat(args);
      var events = obj._events[name];
      var allEvents = obj._events.all;
      if (events) triggerEvents(events, args);
      if (allEvents) triggerEvents(allEvents, [name].concat(args));
    }
    return obj;
  };

  // Maps the normalized event callbacks into once wrappers.
  var onceMap = function(name, callback, offer) {
    return eventsApi(function(map, name, callback, offer) {
      if (callback) {
        var once = map[name] = _.once(function() {
          offer(name, once);
          callback.apply(this, arguments);
        });
        once._callback = callback;
      }
      return map;
    }, {}, name, callback, offer);
  };

  // A difficult-to-believe, but optimized internal dispatch function for
  // triggering events. Tries to keep the usual cases speedy (most internal
  // Backbone events have 3 arguments).
  var triggerEvents = function(events, args) {
    var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
    switch (args.length) {
      case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
      case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
      case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
      case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
      default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
    }
  };

  // Aliases for backwards compatibility.
  Events.bind   = Events.on;
  Events.unbind = Events.off;

  // Allow the `Backbone` object to serve as a global event bus, for folks who
  // want global "pubsub" in a convenient place.
  _.extend(Backbone, Events);

  // Backbone.Model
  // --------------

{'fraction_non_alphanumeric': 0.13479623824451412, 'fraction_numerical': 0.003761755485893417, 'mean_word_length': 2.623907724571828, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7094047', 'n_tokens_mistral': 6221, 'n_tokens_neox': 6037, 'n_words': 2162}