<commit_before>/*
 * Copyright (c) 2011 <NAME>, <http://letterblock.com/>
 * Available under the MIT or GPL v2 license. You do not need to reproduce 
 * the full license text here.
 */
(function($){
  var origTrigger = $.fn.trigger;
  $.fn.trigger = function(type){
    origTrigger.apply(this,arguments);
    if(type.doneWithHandlers){ type.doneWithHandlers(); }; 
    return this;
  }

  var Pencil = function(type){
    $.Event.call(this,type);
    this._dfr = new $.Deferred();
    this._waitingFor = [true];
  }
  Pencil.prototype = new $.Event('');

  Pencil.prototype.waitFor = function(promise){
    this._waitingFor.push(promise);
  };
  Pencil.prototype.doneWithHandlers = function(){
    if(this.isDefaultPrevented()){
      this._dfr.reject();
    } else {
      $.when.apply($,this._waitingFor).then(this._dfr.resolve,this._dfr.reject);
    }
  };
  Pencil.prototype.then = function(){ return this._dfr.then.apply(this._dfr,arguments); };
  Pencil.prototype.done = function(){ return this._dfr.done.apply(this._dfr,arguments); };
  Pencil.prototype.fail = function(){ return this._dfr.fail.apply(this._dfr,arguments); };
  Pencil.prototype.isResolved = function(){ return this._dfr.isResolved.apply(this._dfr,arguments); };
  Pencil.prototype.isRejected = function(){ return this._dfr.isRejected.apply(this._dfr,arguments); };

  $.Pencil = Pencil;
})(jQuery);<commit_msg>Make Pencil pseudo-promise also implement the promise() method<commit_after>/*
 * Copyright (c) 2011 <NAME>, <http://letterblock.com/>
 * Available under the MIT or GPL v2 license. You do not need to reproduce 
 * the full license text here.
 */
(function($){
  var origTrigger = $.fn.trigger;
  $.fn.trigger = function(type){
    origTrigger.apply(this,arguments);
    if(type.doneWithHandlers){ type.doneWithHandlers(); }; 
    return this;
  }

  var Pencil = function(type){
    $.Event.call(this,type);
    this._dfr = new $.Deferred();
    this._waitingFor = [true];
  }
  Pencil.prototype = new $.Event('');

  Pencil.prototype.waitFor = function(promise){
    this._waitingFor.push(promise);
  };
  Pencil.prototype.doneWithHandlers = function(){
    if(this.isDefaultPrevented()){
      this._dfr.reject();
    } else {
      $.when.apply($,this._waitingFor).then(this._dfr.resolve,this._dfr.reject);
    }
  };
  Pencil.prototype.then = function(){ return this._dfr.then.apply(this._dfr,arguments); };
  Pencil.prototype.done = function(){ return this._dfr.done.apply(this._dfr,arguments); };
  Pencil.prototype.fail = function(){ return this._dfr.fail.apply(this._dfr,arguments); };
  Pencil.prototype.isResolved = function(){ return this._dfr.isResolved.apply(this._dfr,arguments); };
  Pencil.prototype.isRejected = function(){ return this._dfr.isRejected.apply(this._dfr,arguments); };
  Pencil.prototype.promise = function(){ return this._dfr.promise(); };

  $.Pencil = Pencil;
})(jQuery);
{'fraction_non_alphanumeric': 0.16614745586708204, 'fraction_numerical': 0.003461405330564209, 'mean_word_length': 4.09700176366843, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2831865', 'n_tokens_mistral': 967, 'n_tokens_neox': 940, 'n_words': 170}