<commit_before>/* Global define */
(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['jquery'], factory);
  } else if (typeof exports === 'object') {
    module.exports = factory(require('jquery'));
  } else {
    root.Tour = factory(root.jQuery);
  }
}(this, function ($) {

  // var mock = faux.get('conversations/1/show').success(200, {});
  // var mock = faux.get(/conversations\/[0-9]+\/show/).success(200, {});
  // var mock = faux.get(function () { // builds a URL using some computation }).success(200, {});
  // mock.success(200, function () { // builds a response using some computation });
  // mock.error(200, function () { // builds a response using some computation });
  // mock.delay(2000);
  // mock.restore();

  var mocks = [], oajax = $.ajax;

  var wrap = function (xhr, response, callback) {
    // TODO: Add the headers to original XHR object (such as status, e.g. 200)
    return function () {
      if (callback) {
        if (typeof response === 'function') {
          callback(response(xhr), xhr);
        } else {
          callback(response, xhr);
        }
      }
    };
  };

  var hasProp = {}.hasOwnProperty;

  $.ajax = function () {
    var callback, i, len, mock, mocked, response, xhr;

    xhr = arguments[0];

    for (i = 0, len = mocks.length; i < len; i++) {
      mock = mocks[i];
      mocked = mock.match(xhr);
      if (mocked) break;
    }

    if (mocked) {
      response = mock.scope.error ? mock.scope.error : mock.scope.success;
      callback = mock.scope.error ? xhr.error : xhr.success;
      setTimeout(wrap(xhr, response, callback), mock.scope.delay);
    } else {
      oajax.apply(this, arguments);
    }
  };

  function Mock() {
    this.scope = {
      delay: 0
    };
  }

  Mock.prototype = {

    delay: function(delay) {
      this.scope.delay = parseInt(delay, 10) || 0;
      return this;
    },

    error: function(error) {
      this.scope.error = error;
      return this;
    },

    get: function(url) {
      this.scope.type = 'get';
      this.scope.url = url;
      return this;
    },

    post: function(url, data) {
      this.scope.type = 'post';
      this.scope.url = url;
      this.scipe.data = data || {};
      return this;
    },

    match: function(xhr) {
      var url, urlMatch, dataMatch;

      if (this.scope.restored) {<commit_msg>fix typo<commit_after>/* Global define */
(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['jquery'], factory);
  } else if (typeof exports === 'object') {
    module.exports = factory(require('jquery'));
  } else {
    root.Tour = factory(root.jQuery);
  }
}(this, function ($) {

  // var mock = faux.get('conversations/1/show').success(200, {});
  // var mock = faux.get(/conversations\/[0-9]+\/show/).success(200, {});
  // var mock = faux.get(function () { // builds a URL using some computation }).success(200, {});
  // mock.success(200, function () { // builds a response using some computation });
  // mock.error(200, function () { // builds a response using some computation });
  // mock.delay(2000);
  // mock.restore();

  var mocks = [], oajax = $.ajax;

  var wrap = function (xhr, response, callback) {
    // TODO: Add the headers to original XHR object (such as status, e.g. 200)
    return function () {
      if (callback) {
        if (typeof response === 'function') {
          callback(response(xhr), xhr);
        } else {
          callback(response, xhr);
        }
      }
    };
  };

  var hasProp = {}.hasOwnProperty;

  $.ajax = function () {
    var callback, i, len, mock, mocked, response, xhr;

    xhr = arguments[0];

    for (i = 0, len = mocks.length; i < len; i++) {
      mock = mocks[i];
      mocked = mock.match(xhr);
      if (mocked) break;
    }

    if (mocked) {
      response = mock.scope.error ? mock.scope.error : mock.scope.success;
      callback = mock.scope.error ? xhr.error : xhr.success;
      setTimeout(wrap(xhr, response, callback), mock.scope.delay);
    } else {
      oajax.apply(this, arguments);
    }
  };

  function Mock() {
    this.scope = {
      delay: 0
    };
  }

  Mock.prototype = {

    delay: function(delay) {
      this.scope.delay = parseInt(delay, 10) || 0;
      return this;
    },

    error: function(error) {
      this.scope.error = error;
      return this;
    },

    get: function(url) {
      this.scope.type = 'get';
      this.scope.url = url;
      return this;
    },

    post: function(url, data) {
      this.scope.type = 'post';
      this.scope.url = url;
      this.scope.data = data;
      return this;
    },

    match: function(xhr) {
      var url, urlMatch, dataMatch;

      if (this.scope.restored) {
{'fraction_non_alphanumeric': 0.1678292115831748, 'fraction_numerical': 0.013105051786091735, 'mean_word_length': 2.3183730715287516, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4684830', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1526, 'n_words': 379}