Internal function that returns an efficient (for current engines) version of the passed-in callback, to be repeatedly applied in other Underscore functions.
775005
function(func, context, argCount) {
                if (context === void 0) return func;
                switch (argCount == null ? 3 : argCount) {
                  case 1: return function(value) {
                    return func.call(context, value);
                  };
                  case 2: return function(value, other) {
                    return func.call(context, value, other);
                  };
                  case 3: return function(value, index, collection) {
                    return func.call(context, value, index, collection);
                  };
                  case 4: return function(accumulator, value, index, collection) {
                    return func.call(context, accumulator, value, index, collection);
                  };
                }
                return function() {
                  return func.apply(context, arguments);
                };
              }
378204
function (fn) { var cache = {}  // barrier-enabled impl, eliminates redundant fetches
                                                    // in this version, any subsequent calls join at barrier (which opens when result is fetched)
        switch (_.numArgs (fn)) {
            case 1:
                return function (then) {             
                    if (!cache.already) {
                        fn.call (this, (cache = _.barrier ())) }
                    cache (then) }
            case 2:
                cache = {}
                return function (value, then) {    
                    if (!(value in cache)) {
                        fn.call (this, value, (cache[value] = _.barrier ())) }
                    cache[value] (then) }
            default:
                throw new Error ('_.cps.memoize: unsupported number of arguments') } }
268185
def inline_callbacks(original, debug=False):
    
    f = eliot_friendly_generator_function(original)
    if debug:
        f.debug = True
    return inlineCallbacks(f)
905652
def get_function_call_repr(fn, args, kwargs):
    """"""

    result = get_full_name(fn) + "("
    first = True
    for v in args:
        if first:
            first = False
        else:
            result += ","
        result += repr(v)
    for k, v in kwargs.items():
        if first:
            first = False
        else:
            result += ","
        result += str(k) + "=" + repr(v)
    result += ")"
    return result
597877
def cached_method(func):
    
    @functools.wraps(func)
    def wrapper(self, *args):
        if not hasattr(self, "_cache"):
            self._cache = {}
        key = _argstring((func.__name__,) + args)
        if key not in self._cache:
            self._cache[key] = func(self, *args)
        return self._cache[key]
    return wrapper
160627
function callback_(fn, obj) {
  var args = [];
  for (var i = 2, c = arguments.length; i < c; i++) {
    args.push(arguments[i]);
  }
  return function() {
    fn.apply(obj, args);
  };
}
196180
function(inParams, inCallbackFunctionName) {
		if (enyo.isString(inParams)) {
			return inParams.replace("=?", "=" + inCallbackFunctionName);
		} else {
			var params = enyo.mixin({}, inParams);
			params[this.callbackName] = inCallbackFunctionName;
			return enyo.Ajax.objectToQuery(params);
		}
	}
711584
function(callbacks, args) {
            if (!callbacks.length) {
                return typeof done === 'function' ? done() : true;
            }

            var callback = callbacks.shift();
            callback.apply(context, args);

            // Is the callback synchronous ?
            if (callback.length === nbArguments) {
                iterator(callbacks, args, done);
            }
        }
430865
def decorate(func, caller):
    
    evaldict = func.__globals__.copy()
    evaldict['_call_'] = caller
    evaldict['_func_'] = func
    fun = FunctionMaker.create(
        func, "return _call_(_func_, %(shortsignature)s)",
        evaldict, __wrapped__=func)
    if hasattr(func, '__qualname__'):
        fun.__qualname__ = func.__qualname__
    return fun
131087
function processTokens(tokens, callback) {
    "use strict";
    var processFunctions = underscore.map(tokens, function (word) {
        return function (cb) {
            tokenizeWord(word, cb);
        };
    });
    async.parallel(
        processFunctions,
        function (error, results) {
            if (error) {
                callback(error, null);
            } else {
                var normalizedTokens = [];
                results.forEach(function (tokens) {
                    normalizedTokens = normalizedTokens.concat(tokens);
                });
                normalizedTokens.sort();
                normalizedTokens = underscore.uniq(normalizedTokens, true);
                callback(null, normalizedTokens);
            }
        }
    );
}
824344
function _cacheFunction(func, data, vars, relPath) {
  func.engine = this.className;
  if (vars) app.views.callbacks[relPath] = func;
}
769089
function(methodName) {
                    var origMethod = that[methodName],
                        ret;

                    that[methodName] = function() {
                        args = _simplifyArray(Array.prototype.slice.call(arguments, 0));
                        ret = origMethod.apply(that, arguments);
           
                        that._trace({
                            method: methodName,
                            args: args
                        });
                 
                        return ret;
                    };
            }
313337
function getCallBack(onTimeOut){
        /*global callbackName, callback, scr, options;*/
        return function(){
            try {
                if( onTimeOut ){
                    options.onfailure && options.onfailure();
                }else{
                    callback.apply(window, arguments);
                    clearTimeout(timer);
                }
                window[callbackName] = null;
                delete window[callbackName];
            } catch (exception) {
            } finally {
                baidu.sio._removeScriptTag(scr);
            }
        }
    }
135081
def lazy_result(f):
    """"""
    @wraps(f)
    def decorated(ctx, param, value):
        return LocalProxy(lambda: f(ctx, param, value))
    return decorated
1212031
def return_locals(func):
    ''''''

    @functools.wraps(func)
    def wrap(*args, **kwargs):
        frames = []

        def tracer(frame, event, arg): # pragma: no cover
            # coverage does not work in this function because the tracer
            # is deactivated here
            frames.append(frame)
            sys.settrace(old_tracer)
            if old_tracer is not None:
                return old_tracer(frame, event, arg)

        old_tracer = sys.gettrace()
        # tracer is activated on next call, return or exception
        sys.settrace(tracer)
        try:
            func(*args, **kwargs)
        finally:
            sys.settrace(old_tracer)
        assert len(frames) == 1
        argspec = inspect.getargspec(func)
        argnames = list(argspec.args)
        if argspec.varargs is not None:
            argnames.append(argspec.varargs)
        if argspec.keywords is not None:
            argnames.append(argspec.keywords)
        return {name: value for name, value in frames.pop(0).f_locals.items()
                if name not in argnames}

    return wrap
1013311
function(foo, self) {
        return function() {
            var arg, tmp, args = [];
            for (var i = 0, l = arguments.length; i < l; i++) {
                arg = arguments[i];
                if (_isFunction(arg)) {
                    if (arg.tryWrap) {
                        arg = arg.tryWrap;
                    } else {
                        tmp = cat(arg);
                        arg.tryWrap = tmp;
                        arg = tmp;
                    }
                }
                args.push(arg);
            }
            return foo.apply(self || this, args);
        };
    }
434817
function wrapper(matcherName, legacyMatcher){
      return function(util, customEqualityTesters){
        return { 
          compare: function(actual, expected){
            var scope = {actual: actual}, message, result;
            
            result = legacyMatcher.call(scope, expected)
            
            message = scope.message && scope.message()[result ? 1 : 0];
            return {
              pass:result,
              message : message
            }
          }
        }
      }
    }