<commit_before>// ==========================================================================
// Project:  Ember Runtime
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*globals ember_assert */

require('ember-metal/core'); // Ember.Logger
require('ember-metal/watching'); // Ember.watch.flushPending
require('ember-metal/observer'); // Ember.beginPropertyChanges, Ember.endPropertyChanges
require('ember-metal/utils'); // Ember.guidFor
require('ember-metal/array'); // Ember.ArrayUtils

// ..........................................................
// HELPERS
//

var slice = Array.prototype.slice;
var forEach = Ember.ArrayUtils.forEach;

// invokes passed params - normalizing so you can pass target/func,
// target/string or just func
/** @private */
function invoke(target, method, args, ignore) {

  if (method===undefined) {
    method = target;
    target = undefined;
  }

  if ('string'===typeof method) method = target[method];
  if (args && ignore>0) {
    args = args.length>ignore ? slice.call(args, ignore) : null;
  }

  // Unfortunately in some browsers we lose the backtrace if we rethrow the existing error,
  // so in the event that we don't have an `onerror` handler we don't wrap in a try/catch
  if ('function' === typeof Ember.onerror) {
    try {
      // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
      return method.apply(target || this, args || []);
    } catch (error) {
      Ember.onerror(error);
    }
  } else {
    // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
    return method.apply(target || this, args || []);
  }
}


// ..........................................................
// RUNLOOP
//

var timerMark; // used by timers...

/** @private */
var K = function() {};

/** @private */
var RunLoop = function(prev) {
  var self;

  if (this instanceof RunLoop) {
    self = this;
  } else {
    self = new K();
  }

  self._prev = prev || null;
  self.onceTimers = {};

  return self;
};

K.prototype = RunLoop.prototype;

RunLoop.prototype = {
  end: function() {
    this.flush();
  },

  prev: function() {
    return this._prev;
  },

  // ..........................................................
  // Delayed Actions
  //

  schedule: function(queueName, target, method) {
    var queues = this._queues, queue;
    if (!queues) queues = this._queues = {};
    queue = queues[queueName];
    if (!queue) queue = queues[queueName] = [];

    var args = arguments.length>3 ? slice.call(arguments, 3) : null;
    queue.push({ target: target, method: method, args: args });
    return this;
  },

  flush: function(queueName) {
    var queues = this._queues, queueNames, idx, len, queue, log;

    if (!queues) return this; // nothing to do

    function iter(item) {
      invoke(item.target, item.method, item.args);
    }

    Ember.watch.flushPending(); // make sure all chained watchers are setup

    if (queueName) {
      while (this._queues && (queue = this._queues[queueName])) {
        this._queues[queueName] = null;

        log = Ember.LOG_BINDINGS && queueName==='sync';
        if (log) Ember.Logger.log('Begin: Flush Sync Queue');

        // the sync phase is to allow property changes to propogate.  don't
        // invoke observers until that is finished.
        if (queueName === 'sync') Ember.beginPropertyChanges();
        forEach(queue, iter);
        if (queueName === 'sync') Ember.endPropertyChanges();

        if (log) Ember.Logger.log('End: Flush Sync Queue');

      }

    } else {
      queueNames = Ember.run.queues;
      len = queueNames.length;
      do {
        this._queues = null;
        for(idx=0;idx<len;idx++) {
          queueName = queueNames[idx];
          queue = queues[queueName];

          log = Ember.LOG_BINDINGS && queueName==='sync';
          if (log) Ember.Logger.log('Begin: Flush Sync Queue');

          if (queueName === 'sync') Ember.beginPropertyChanges();
          if (queue) forEach(queue, iter);
          if (queueName === 'sync') Ember.endPropertyChanges();

          if (log) Ember.Logger.log('End: Flush Sync Queue');

        }<commit_msg>temporarily remove deferring observers<commit_after>// ==========================================================================
// Project:  Ember Runtime
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*globals ember_assert */

require('ember-metal/core'); // Ember.Logger
require('ember-metal/watching'); // Ember.watch.flushPending
require('ember-metal/observer'); // Ember.beginPropertyChanges, Ember.endPropertyChanges
require('ember-metal/utils'); // Ember.guidFor
require('ember-metal/array'); // Ember.ArrayUtils

// ..........................................................
// HELPERS
//

var slice = Array.prototype.slice;
var forEach = Ember.ArrayUtils.forEach;

// invokes passed params - normalizing so you can pass target/func,
// target/string or just func
/** @private */
function invoke(target, method, args, ignore) {

  if (method===undefined) {
    method = target;
    target = undefined;
  }

  if ('string'===typeof method) method = target[method];
  if (args && ignore>0) {
    args = args.length>ignore ? slice.call(args, ignore) : null;
  }

  // Unfortunately in some browsers we lose the backtrace if we rethrow the existing error,
  // so in the event that we don't have an `onerror` handler we don't wrap in a try/catch
  if ('function' === typeof Ember.onerror) {
    try {
      // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
      return method.apply(target || this, args || []);
    } catch (error) {
      Ember.onerror(error);
    }
  } else {
    // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
    return method.apply(target || this, args || []);
  }
}


// ..........................................................
// RUNLOOP
//

var timerMark; // used by timers...

/** @private */
var K = function() {};

/** @private */
var RunLoop = function(prev) {
  var self;

  if (this instanceof RunLoop) {
    self = this;
  } else {
    self = new K();
  }

  self._prev = prev || null;
  self.onceTimers = {};

  return self;
};

K.prototype = RunLoop.prototype;

RunLoop.prototype = {
  end: function() {
    this.flush();
  },

  prev: function() {
    return this._prev;
  },

  // ..........................................................
  // Delayed Actions
  //

  schedule: function(queueName, target, method) {
    var queues = this._queues, queue;
    if (!queues) queues = this._queues = {};
    queue = queues[queueName];
    if (!queue) queue = queues[queueName] = [];

    var args = arguments.length>3 ? slice.call(arguments, 3) : null;
    queue.push({ target: target, method: method, args: args });
    return this;
  },

  flush: function(queueName) {
    var queues = this._queues, queueNames, idx, len, queue, log;

    if (!queues) return this; // nothing to do

    function iter(item) {
      invoke(item.target, item.method, item.args);
    }

    Ember.watch.flushPending(); // make sure all chained watchers are setup

    if (queueName) {
      while (this._queues && (queue = this._queues[queueName])) {
        this._queues[queueName] = null;

        log = Ember.LOG_BINDINGS && queueName==='sync';
        if (log) Ember.Logger.log('Begin: Flush Sync Queue');

        // the sync phase is to allow property changes to propogate.  don't
        // invoke observers until that is finished.
        //if (queueName === 'sync') Ember.beginPropertyChanges();
        forEach(queue, iter);
        //if (queueName === 'sync') Ember.endPropertyChanges();

        if (log) Ember.Logger.log('End: Flush Sync Queue');

      }

    } else {
      queueNames = Ember.run.queues;
      len = queueNames.length;
      do {
        this._queues = null;
        for(idx=0;idx<len;idx++) {
          queueName = queueNames[idx];
          queue = queues[queueName];

          log = Ember.LOG_BINDINGS && queueName==='sync';
          if (log) Ember.Logger.log('Begin: Flush Sync Queue');

          //if (queueName === 'sync') Ember.beginPropertyChanges();
          if (queue) forEach(queue, iter);
          //if (queueName === 'sync') Ember.endPropertyChanges();

          if (log) Ember.Logger.log('End: Flush Sync Queue');

        }
{'fraction_non_alphanumeric': 0.2103325279024278, 'fraction_numerical': 0.005062708549073754, 'mean_word_length': 2.4684756584197927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5307939', 'n_tokens_mistral': 2627, 'n_tokens_neox': 2493, 'n_words': 681}