Invoke callbacks on all objects (i.e. layers) from the top to
        the bottom, returning when the first one returns True.  If none
        returns True, then make the callback on our 'native' layer.
433203
def make_ui_callback(self, name, *args, **kwdargs):
        
        if hasattr(self, 'objects'):
            # Invoke callbacks on all our layers that have the UI mixin
            num = len(self.objects) - 1
            while num >= 0:
                obj = self.objects[num]
                if isinstance(obj, UIMixin) and obj.ui_isActive():
                    res = obj.make_ui_callback(name, *args, **kwdargs)
                    if res:
                        return res
                num -= 1

        if self.ui_active:
            return super(UIMixin, self).make_callback(name, *args, **kwdargs)
576150
function (collection, callback) {
        var index,
            iterable = collection,
            result = iterable;

        if (!iterable) {
            return result;
        }

        if (!sofa.Util.objectTypes[typeof iterable]) {
            return result;
        }

        for (index in iterable) {
            if (Object.prototype.hasOwnProperty.call(iterable, index)) {
                if (callback(iterable[index], index, collection) === false) {
                    return result;
                }
            }
        }
        return result;
    }
481920
def _run_callbacks(kind, *args) #:nodoc:
      options = args.last # Last callback arg MUST be a Hash

      send("_#{kind}").each do |callback, conditions|
        invalid = conditions.find do |key, value|
          value.is_a?(Array) ? !value.include?(options[key]) : (value != options[key])
        end

        callback.call(*args) unless invalid
      end
    end
37460
def callback(self):
        ''''''
        self._callback(*self._args, **self._kwargs)
        self._last_checked = time.time()
880967
function callHandler(callback, context, args) {
  switch (args.length) {
    case 0: return callback.call(context);
    case 1: return callback.call(context, args[0]);
    case 2: return callback.call(context, args[0], args[1]);
    case 3: return callback.call(context, args[0], args[1], args[2]);
    default: return callback.apply(context, args);
  }
}
233516
def add_callback(self, cb):
        
        if ((cb in self.callbacks) is False):
            self.callbacks.append(cb)
1336010
function _detect(eachFn, arr, iterator, mainCallback) {
  eachFn(arr, function (x, index, callback) {
    iterator(x, function (v, result) {
      if (v) {
        mainCallback(result || x);
        mainCallback = async.noop;
      } else {
        callback();
      }
    });
  }, function () {
    mainCallback();
  });
}
202631
function(callback, context) {
      var objects = this.getObjects(),
          i = objects.length;
      while (i--) {
        callback.call(context, objects[i], i, objects);
      }
      return this;
    }
807368
function each(object, callback) {
		if (!object) { return true; }
		if (object.forEach) { return object.forEach(callback); }
		if (object instanceof Array) {
			var	length	= array ? array.length : 0;
			for(var index = 0; index < length; index++) {
				callback(array[index], index);
			}
		}else{
			for(var key in object) {
				if (!object.hasOwnProperty(key)) { continue; }
				callback(object[key], key);
			}
		}
		return false;
	}
560503
def EveryNCallback(self):
        """"""
        # print('ncall ', self.n_callbacks)
        if self.do_callbacks:
            if self.n_callbacks >= self.callback_step:
                # print('n_callbacks', self.n_callbacks)
                for func, func_dict in self.callback_funcs:
                    func(func_dict)
                    print('func:::', func)

                self.latest_callback_index +=1
                if self.latest_callback_index >= len(self.callback_function_list):
                    # print('done with callbacks')
                    self.do_callbacks = False
                else:
                    out = self.callback_function_list[self.latest_callback_index]
                    callback_time = out[0]
                    self.callback_step = int(callback_time/expt_settings.callback_resolution)
                    # print('updatin callback step', self.callback_step)
                    self.callback_funcs = out[1]

        self.n_callbacks += 1
        #print('n_callbacks', self.n_callbacks)
        return 0
1259875
function() {
			this.initialized = true;
			var list = this._initcallbacks;
			if (list) {
				while (list.length) {
					list.shift()();
				}
				this._initcallbacks = null;
			}
		}
1156075
def push_scope(self, callback=None):  # noqa
        

        if callback is not None:
            with self.push_scope() as scope:
                callback(scope)
            return None

        client, scope = self._stack[-1]
        new_layer = (client, copy.copy(scope))
        self._stack.append(new_layer)

        return _ScopeManager(self)
65233
function(callback, ctx){
      var k = 0;

      // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
      var O = Object(this);

      var len = O.length >>> 0; 

      if ( typeof callback !== "function" ) {
        throw new TypeError( callback + " is not a function" );
      }

      // 7. Repeat, while k < len
      while( k < len ) {

        var kValue;

        if ( k in O ) {

          kValue = O[ k ];

          callback.call( ctx, kValue, k, O );
        }
        k++;
      }
    }
268450
function (callback) {
    var cb = this.lambda(callback)
    // iterate from chain
    if (this.__results) {
      for (var i = 0, l = this.__results.length; i < l; i++) cb.call(this, this.__results[i], i)
    }
    // otherwise iterate the entire collection
    else {
      this.all(function(r) {
        for (var i = 0, l = r.length; i < l; i++) cb.call(this, r[i], i)
      })
    }
    return this
  }
930628
function(callbacks) {
    callbacks = callbacks || { };

    var empty = function() { },
        onComplete = callbacks.onComplete || empty,
        onChange = callbacks.onChange || empty,
        _this = this;

    fabric.util.animate({
      startValue: this.get('angle'),
      endValue: this._getAngleValueForStraighten(),
      duration: this.FX_DURATION,
      onChange: function(value) {
        _this.setAngle(value);
        onChange();
      },
      onComplete: function() {
        _this.setCoords();
        onComplete();
      },
      onStart: function() {
        _this.setActive(false);
      }
    });

    return this;
  }
815893
function bindCallbacks( o, callbacks, args ) {
		var prop = QUnit.objectType( o );
		if ( prop ) {
			if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
				return callbacks[ prop ].apply( callbacks, args );
			} else {
				return callbacks[ prop ]; // or undefined
			}
		}
	}
649226
def _multiple_callbacks(callbacks, *args, **kwargs):
    
    if isinstance(callbacks, list):
        for cb in callbacks:
            cb(*args, **kwargs)
        return
    if callbacks:
        callbacks(*args, **kwargs)