Calls function passing app as first argument
429911
def with_app(f):
    """"""
    @wraps(f)
    def decorator(*args, **kwargs):
        app = create_app()
        configure_extensions(app)
        configure_views(app)
        return f(app=app, *args, **kwargs)
    return decorator
964770
def _run_lambda_function(event, context, app, config):  # pragma: no cover
    """"""
    args = event.get('args', [])
    kwargs = event.get('kwargs', {})

    # first attempt to invoke the function passing the lambda event and context
    try:
        ret = app(*args, event=event, context=context, **kwargs)
    except TypeError:
        # try again without passing the event and context
        ret = app(*args, **kwargs)
    return ret
237471
function $wrapped( ...args ) {
      const wrappedArgs = args.slice();

      args.forEach( ( arg, i ) => {
        if ( typeof arg === 'function' ) {
          wrappedArgs[i] = wrapCallback( args[i], origin );
        }
      } );

      return method.call( this, ...wrappedArgs );
    }
805079
function app() {
    if (arguments.length > 0) {
        if (typeof arguments[0] !== 'object') {
            throw new TypeError('Argument format must be a object');
        }
        //Validate options provided
        validateOptions(arguments[0]);
    }

    return function(req, res, done) {
        //0. Check directory exists
        checkFolderExists(options.dir);

        currentDate = new Date();

        function logRequest() {

            fomart = ':method :statusCode :url :date :response-time\n';
            fomart = fomart.replace(':method', req.method);
            fomart = fomart.replace(':url', formatUrl(req));
            fomart = fomart.replace(':statusCode', res.statusCode);
            fomart = fomart.replace(':date', formatDate(new Date()));
            fomart = fomart.replace(':response-time', responseTime(res));
            fs.appendFile(path.join(options.dir, options.file), fomart, 'utf8', function(err) {
                if (err) throw err;
            });
        }

        //1. Log Response Start
        onHeaders(res, logTime);


        //2. log when response finished
        onFinished(res, logRequest);

        done();
    }
}
140599
function () {
    // If this function was not given any arguments, we have nothing to do
    // here.
    if (arguments.length > 0) {
      // Convert `arguments` to an array
      var args = Array.prototype.slice.call(arguments, 0)
      Array.prototype.push.apply(passed_args, args)
    }
    self._iterate_stack(++index, req, passed_args, not_handled_fn)
  }
1203624
def _ondemand(f):
    
    name = f.__name__

    def func(self, *args, **kwargs):
        if not args and not kwargs:
            if hasattr(self, '_%s' % name):
                return getattr(self, '_%s' % name)

            a = f(self, *args, **kwargs)
            setattr(self, '_%s' % name, a)
            return a
        else:
            return f(self, *args, **kwargs)
    func.__name__ = name
    return func
719907
def visit_FunctionCall(self, node):
        """"""
        call = self.memory[node.identifier.name]._node
        args = [self.visit(parameter) for parameter in node.parameters]

        if isinstance(call, AST):
            current_scope = self.memory.stack.current.current
            memory_functions = {
                key: current_scope[key]
                for key in current_scope
                if isinstance(current_scope[key], Function)
            }

            self.memory.append_frame()
            for i, arg in enumerate(args):
                self.memory[i] = arg

            for function in memory_functions:
                self.memory[function] = memory_functions[function]

            function_result = self.visit(call)

            self.memory.pop_frame()
            return function_result
        else:
            return bind_type(call(*args))
314831
function(context, args, stack) {
		var name = args[0],
			template = args[1];
		if (template)
			firstPass(template, context, stack); // traverse tag template with frstPass
	}
1179612
function run(appName, command, callback) {
    commons.get(format('/%s/apps/%s/run/', deis.version, appName), callback);
  }
95931
function (arg1, arg2, arg3) {
    if (arguments.length < 2 || arguments.length > 3) throw 'Invalid number of arguments for get function.';
    if (typeof arg1 !== 'string') throw 'First argument of get function must be a route string.';
    if (typeof arg2 !== 'function') throw 'Second argument of get function must be a function.';
    
    _gets.push({
      path: arg1,
      handler: arg2,
      priority: arg3 ? arg3 : 0
    });
  }
279525
function formatArgs(firstArg, ...args) {
  if (typeof firstArg === 'function') {
    firstArg = firstArg();
  }
  if (typeof firstArg === 'string') {
    args.unshift(`deck.gl ${firstArg}`);
  } else {
    args.unshift(firstArg);
    args.unshift('deck.gl');
  }
  return args;
}
953055
function Argument(handler, options, desc) {
  if (!options.hasOwnProperty('scope')) {
    options.scope = 'global';
  }
  this._parent = null;
  this._name = null;
  this._options = options;
  this._desc = desc;
  this._handler = handler;
  return this;
}
991878
def _call_function(name, returner=None, **kwargs):
    '''
    
    '''
    argspec = salt.utils.args.get_function_argspec(__salt__[name])

    # func_kw is initialized to a dictionary of keyword arguments the function to be run accepts
    func_kw = dict(zip(argspec.args[-len(argspec.defaults or []):],  # pylint: disable=incompatible-py3-code
                   argspec.defaults or []))

    # func_args is initialized to a list of positional arguments that the function to be run accepts
    func_args = argspec.args[:len(argspec.args or []) - len(argspec.defaults or [])]
    arg_type, kw_to_arg_type, na_type, kw_type = [], {}, {}, False
    for funcset in reversed(kwargs.get('func_args') or []):
        if not isinstance(funcset, dict):
            # We are just receiving a list of args to the function to be run, so just append
            # those to the arg list that we will pass to the func.
            arg_type.append(funcset)
        else:
            for kwarg_key in six.iterkeys(funcset):
                # We are going to pass in a keyword argument. The trick here is to make certain
                # that if we find that in the *args* list that we pass it there and not as a kwarg
                if kwarg_key in func_args:
                    kw_to_arg_type[kwarg_key] = funcset[kwarg_key]
                    continue
                else:
                    # Otherwise, we're good and just go ahead and pass the keyword/value pair into
                    # the kwargs list to be run.
                    func_kw.update(funcset)
    arg_type.reverse()
    for arg in func_args:
        if arg in kw_to_arg_type:
            arg_type.append(kw_to_arg_type[arg])
    _exp_prm = len(argspec.args or []) - len(argspec.defaults or [])
    _passed_prm = len(arg_type)
    missing = []
    if na_type and _exp_prm > _passed_prm:
        for arg in argspec.args:
            if arg not in func_kw:
                missing.append(arg)
    if missing:
        raise SaltInvocationError('Missing arguments: {0}'.format(', '.join(missing)))
    elif _exp_prm > _passed_prm:
        raise SaltInvocationError('Function expects {0} parameters, got only {1}'.format(
            _exp_prm, _passed_prm))

    mret = __salt__[name](*arg_type, **func_kw)
    if returner is not None:
        returners = salt.loader.returners(__opts__, __salt__)
        if returner in returners:
            returners[returner]({'id': __opts__['id'], 'ret': mret,
                                 'fun': name, 'jid': salt.utils.jid.gen_jid(__opts__)})

    return mret
197957
function Args() {
    if (argv._.length >= 1) {
        try {
            // Attempt to parse 1st argument as JSON string
            _.extend(this, JSON.parse(argv._[0]));
        } catch (err) {
            // Pass, we must be in the console so don't worry about it
        }
    }
}
112712
function callMethod(target, parseArgs, args) {

    // The first argument should be a function or an array.
    var func = args[0],
        funcArgs = [],
        modifiedArgs = [];

    // Handles [func, arg1, arg2, arg3], ...
    if (isArray(func) && isFunction(func[0])) {
        funcArgs = func.splice(1);
        func = func[0];
        modifiedArgs = args.splice(1);

    } else if (isFunction(func)) {
        funcArgs = args.splice(1);

    } else {
        errorManager.illegalArgument(args,
            'first argument must be a function');
    }

    // The source properties will be added here.
    var Scope = function() {};

    // Ensure the function has access to the target's current properties,
    // so that it can make function calls for example.
    Scope.prototype = target;

    // Apply with scope.
    var scope = new Scope();
    fastApply(func, scope, funcArgs);

    // Copy the non-prototype properties to source.
    var source = {};
    for (var key in scope) {
        if (scope.hasOwnProperty(key)) {
            source[key] = scope[key];
        }
    }

    // Reconstruct the method args with the new source object.
    modifiedArgs.unshift(source);

    return parseArgs(modifiedArgs);
}
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);
                };
              }
1308471
function(context, args, stack) {
		if (context.env.data.isServer)
			return;
		firstPass(args[0], context, stack); // traverse client template with frstPass
	}