Returns the function to call (bound with the correct scope)
963559
function _getEventHandler (event, eventsHandler) {
    var scope = event.scope,
        eventHandler;
    if ("function" === typeof eventsHandler.dispatchEvent) {
        // Event dispatcher expected interface
        return eventsHandler.dispatchEvent.bind(eventsHandler);
    }
    if ("function" === typeof eventsHandler) {
        return eventsHandler.bind(scope);
    }
    // Composite with a specific event handler
    eventHandler = eventsHandler[event.type] || eventsHandler["*"] || _gpfEmptyFunc;
    return eventHandler.bind(eventsHandler.scope || eventsHandler);
}
254178
function getFunctionBody(methodName, block, argT) {
            var blockCall = types.CallExpression(block, [argT]);

            if (methodName === 'let') {
              return [types.ReturnStatement(blockCall)]; // return block(argT)
            }

            if (['takeIf', 'takeUnless'].includes(methodName)) {
              var isTakeIf = methodName === 'takeIf';
              return [types.ReturnStatement(types.ConditionalExpression(isTakeIf ? blockCall : types.UnaryExpression('!', blockCall), // condition
              argT, types.NullLiteral()))];
            }

            return [// ...
            types.ExpressionStatement(blockCall), // block(argT)
            types.ReturnStatement(argT) // return argT
            ];
          }
887145
def bind(self, func: Callable[[Any], Maybe]) -> Maybe:
        """"""

        value = self._value
        return func(value)
299118
function (fn, scope) {
        return function () {
            try {
                return fn.apply(scope, arguments);
            }
            catch (ex) {
                logger.error(ex);
                logger.error(ex.stack);
                logger.log('error bubbled up ' + ex);
            }
        };
    }
816660
def bind(self, func: Callable[[Any], IO]) -> IO:
        """"""

        filename, g = self._get_value()
        return ReadFile(filename, lambda s: g(s).bind(func))
417674
def _get_scope_with_symbol(self, name):
        """"""
        scope = self
        while True:
            parent = scope.get_enclosing_scope()
            if parent is None:
                return

            if name in parent.symbols:
                return parent

            scope = parent
471264
function functionBind(f, obj) {
  if (NATIVE_FUNCTION_BIND) {
    return NATIVE_FUNCTION_BIND.call(f, obj);
  }

  return function boundFunction_() {
    return f.apply(obj, arguments);
  };
}
1195139
def execute(func: types.FunctionType):
    
    spec = getfullargspec(func)
    default = spec.defaults
    arg_cursor = 0

    def get_item(name):
        nonlocal arg_cursor
        ctx = func.__globals__
        value = ctx.get(name, _undef)
        if value is _undef:
            try:
                value = default[arg_cursor]
                arg_cursor += 1
            except (TypeError, IndexError):
                raise ValueError(f"Current context has no variable `{name}`")
        return value

    return func(*(get_item(arg_name) for arg_name in spec.args))
823429
def bind(context, block=False):
    

    if block:
        def decorate(func):
            name = func.__name__.replace('__TK__block__', '')
            if name not in context:
                context[name] = func
            return context[name]

        return decorate

    def decorate(func):
        name = func.__name__
        if name not in context:
            context[name] = func
        return context[name]

    return decorate
1173104
function getHandler(fn) {
    if (isFunction(fn) && fn.actionHandler) {
        return function (req, res, next) {
            terminateMethods.map(function (method) {
                res[method] = getWrappedResponse(res[method]);
            });
            callHandler(fn, req, res, next);
        };
    } else {
        return fn;
    }
}
442634
def get_func(fullFuncName):
    """"""

    # Parse out the path, module, and function
    lastDot = fullFuncName.rfind(u".")
    funcName = fullFuncName[lastDot + 1:]
    modPath = fullFuncName[:lastDot]

    aMod = get_mod(modPath)
    aFunc = getattr(aMod, funcName)

    # Assert that the function is a *callable* attribute.
    assert callable(aFunc), u"%s is not callable." % fullFuncName

    # Return a reference to the function itself,
    # not the results of the function.
    return aFunc
758703
function generateRerenderCallback(scope) {
        return function () {
            var remodel = scope.remodel || function () { return true; };
            return $q.when(remodel(scope))
                .then(function () {
                    return scope.rerenderComponent();
                });
        };
    }
1175817
function bindInternal4(func, thisContext) {
    return function (a, b, c, d) {
      return func.call(thisContext, a, b, c, d);
    };
  }
1146703
def handle(dispatcher, *accept_args, **accept_kwargs):
    
    def bind_function_later(f):
        bind_function(f, dispatcher, *accept_args, **accept_kwargs)
        return f
    return bind_function_later
762844
function getCaller (offset) {
  /* eslint-disable handle-callback-err */
  if (typeof offset !== 'number') offset = 1
  var old = Error.prepareStackTrace
  var err = new Error()
  Error.prepareStackTrace = function (err, stack) {
    return stack
  }
  var fname = err.stack[1 + offset].getFileName()
  Error.prepareStackTrace = old
  return fname
}
139344
def free_function(
            self,
            name=None,
            function=None,
            return_type=None,
            arg_types=None,
            header_dir=None,
            header_file=None,
            recursive=None):
        

        return (
            self._find_single(
                scopedef.scopedef_t._impl_matchers[namespace_t.free_function],
                name=name,
                function=function,
                decl_type=self._impl_decl_types[namespace_t.free_function],
                return_type=return_type,
                arg_types=arg_types,
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive)
        )
349860
def _get_code_w_scope(data, position, obj_end, opts):
    """"""
    code, position = _get_string(data, position + 4, obj_end, opts)
    scope, position = _get_object(data, position, obj_end, opts)
    return Code(code, scope), position