Finally, we're going to add a first run behavior here. We'll wrap the user-defined function into a
357716
function _initial_runner(response, manager){
	    // I can't just remove the callback from the register
	    // after the first run because it would be reconstituted
	    // every time it was reset (established).
	    if( anchor.initial_reset_p ){
		anchor.initial_reset_p = false;
		anchor.initial_reset_callback(response, manager);
		//ll('unregister: ' + anchor.unregister('reset', 'first_run'));
	    }
	}
1118415
function wrapFunctions(name, obj, protoLevel, hooks, state, rules){
  if (!(obj && (util.isObject(obj) || util.isFunction(obj)))){
    return;
  }

  if (obj.__concurix_blacklisted || (obj.constructor && obj.constructor.__concurix_blacklisted)) {
    return;
  }

  if (obj.__concurix_wrapped_obj__ || !Object.isExtensible(obj)){
    return;
  }

  tagObject(obj, '__concurix_wrapped_obj__');


  protoLevel = protoLevel ? protoLevel : 0;
  util.iterateOwnProperties(obj, function(key){
    var desc = Object.getOwnPropertyDescriptor(obj, key);

    // We got a property that wasn't a property.
    if (desc == null) {
      return;
    }

    // ignore properties that cannot be set
    if (!desc.configurable || !desc.writable || desc.set){
      return;
    }

    // ignore blacklisted properties
    if (desc.value && desc.value.__concurix_blacklisted) {
      return;
    }

    // if we are supposed to skip a function, blacklist it so we don't wrap it.
    if( !rules.wrapKey(key) ){
      blacklist(obj[key]);
      return;
    }

    if ( util.isFunction(desc.value) && !wrap.isWrapper(obj[key]) && rules.wrapKey(key) ) {
      //console.log('wrapping ', key, ' for ', name, state.modInfo.top);
      obj[key] = wrap(obj[key])
                  .before(hooks.beforeHook)
                  .after(hooks.afterHook)
                  .module(name)
                  .state(state)
                  .nameIfNeeded(key)
                  .getProxy();
    } else if (util.isObject(desc.value) && !wrap.isWrapper(obj[key]) && rules.wrapKey(key)) {
      // to save cycles do not go up through the prototype chain for object-type properties
      wrapFunctions(name, desc.value, 0, hooks, state, rules);
    }
  });
  // protoLevel is how deep you want to traverse the prototype chain.
  // protoLevel = -1 - this will go all the way up excluding Object.prototype
  if (protoLevel != 0){
    protoLevel--;
    var proto = Object.getPrototypeOf(obj);
    wrapFunctions(name, proto, protoLevel, hooks, state, rules);
  }
}
1063129
void wrapAndRun (Runnable runnable) { // PM90834 added method
      if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINEST)) { 
          logger.entering(CLASS_NAME,"wrapAndRun",runnable);
      }

      try {
          this.popContextData();

          if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
              logger.logp(Level.FINEST, CLASS_NAME, "wrapAndRun", "run with context class loader: " + Thread.currentThread().getContextClassLoader());
          }

          runnable.run();
      } finally {
          try {
              this.resetContextData();
          }finally {
              if (runnable instanceof CompleteRunnable) {
                  asyncContext.notifyITransferContextCompleteState();
              }

              if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINEST)) { 
                  logger.exiting(CLASS_NAME,"wrapAndRun",runnable);
              }
          }
      }
  }
1106558
function wrapMethod(app,fn){
    //Override original express method
    return function(){
        let args = Array.prototype.slice.call(arguments)
        //Check if any middleware argument is a generator function
        for( let i=0; i<args.length; i++ ){
            //Wrap this if necessary
            args[i] = controllerWrapper(args[i])
        }
        
        //Call original method handler
        return fn.apply(app,args)
    }
}
756701
def first_invoke(func1, func2):
	
	def wrapper(*args, **kwargs):
		func1()
		return func2(*args, **kwargs)
	return wrapper
548006
private void firstInnerTableStart(Options opt) {
	w.print(linePrefix + linePrefix + "<tr>" + opt.shape.extraColumn() +
		"<td><table border=\"0\" cellspacing=\"0\" " +
		"cellpadding=\"1\">" + linePostfix);
    }
865958
function once(fn/*: Function*/) /*: Function*/ {
    if (typeof fn !== 'function') {
        throw new TypeError('Expected a function');
    }
    return function(...args) {
        let result;
        if (fn) {
            result = fn.apply(this, args);
            fn = undefined;
        }
        return result;
    }
}
928537
private function _initialize()
    {
        $params = $this->getParameters();
        if ($params !== null) {
            for ($i = 0, $_i = count($params); $i < $_i; $i++) {
                if (self::FUNCTION_KEY == $params[$i]->getName()) {
                    $this->function = (string) $params[$i]->getValue();
                    break;
                }
            }
        }
    }
1065295
function functionWrapperFunction () {
        // call original function - catching errors for logging
        try {
            var res = functionObj.apply(this, arguments)
        }
        catch (error) {
            var err = error
        }
        // if log client then do logging
        if (options.logClient) {
            // get number of arguments
            var argsLength = arguments.length
            // copy of arguments
            var args = []
            // create copy of arguments
            for (var i=0; i < argsLength; i++) {
                args[i] = arguments[i]
            }
            // log call
            options.logClient.log('functionCall', {
                functionName: functionName,
                args: args,
                res: err || res,
                isError: (err ? true : false),
                moduleCallId: (this ? this.moduleCallId : undefined),
                requestId: (this ? this.requestId : undefined),
            })
        }
        // if result was an error then throw original error
        if (err) {
            throw err
        }
        // otherwise return original result
        else {
            return res
        }
    }
820342
function once (fn) {
  var called = false;
  return function () {
    if (!called) {
      called = true;
      fn.apply(this, arguments);
    }
  }
}
1117098
def run_once(f):
    ''' 
    
    '''
    def wrapper(*args, **kwargs):
        if not wrapper.has_run:
            wrapper.result = f(*args, **kwargs)
            wrapper.has_run = True
        return wrapper.result
    wrapper.has_run = False
    return wrapper
830526
function firstToResult(left, first) {
  if(isFunction(first)) {
    return function(x) {
      const m = first(x)

      if(!isSameType(First, m)) {
        throw new TypeError('firstToResult: First returning function required for second argument')
      }

      return applyTransform(left, m)
    }
  }

  if(isSameType(First, first)) {
    return applyTransform(left, first)
  }

  throw new TypeError('firstToResult: First or First returning function required for second argument')
}
940246
def _chain(first_func, *funcs) -> Callable:
    
    @wraps(first_func)
    def wrapper(*args, **kwargs):
        result = first_func(*args, **kwargs)
        for func in funcs:
            result = func(result)
        return result
    return wrapper
815555
function (func) {
		if (!(this instanceof Deferred)) {
			return new Deferred();
		}
		this._doneFuncs = [];
		this._failFuncs = [];
		this._resultArgs = null;
		this._status = '';
		// Check for option `function` -- call it with this as context and as first
		// parameter, as specified in jQuery API.
		if (func) {
			func.call(this, this);
		}
	}
205074
function wrap(inherits, key, method, publicStatic) {
    return function () {
      if (!hOP.call(this, SUPER)) {
        // define it once in order to use
        // fast assignment every other time
        define(this, SUPER, null, publicStatic);
      }
      var
        previous = this[SUPER],
        current = (this[SUPER] = inherits[key]),
        result = method.apply(this, arguments)
      ;
      this[SUPER] = previous;
      return result;
    };
  }
767116
function first (callback) {
        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        function firstCallback (result) {
          callback(result);
          unbind('start', firstCallback);
        }

        bind('start', firstCallback);
        bind('stop', unbind.bind(null, 'end', firstCallback));

        return self;
      }
871637
def call(self, func, *args, **kwargs):
        
        wrapped = self.wrap(func)
        return wrapped(*args, **kwargs)