Call a common method on all the plugins, if it exists. The return
        value of each call becomes the replaces the first argument in the given
        argument list to pass to the next.

        Useful to utilize plugins as sets of filters.
776734
def pipe(self, methodname, first_arg, *args, **kwargs):
        

        for plugin in self._plugins:
            method = getattr(plugin, methodname, None)
            if method is None:
                continue
            r = method(first_arg, *args, **kwargs)
            if r is not None:
                first_arg = r
        return r
1352145
def invoke(self, method, *args):
        
        def inv(value, *ar):
            if (
                _(method).isFunction() or
                _(method).isLambda() or
                _(method).isMethod()
            ):
                return method(value, *args)
            else:
                return getattr(value, method)(*args)
        return self._wrap(self._clean.map(inv))
1084335
def replace_argument(self, name, *args, **kwargs):
        
        new_arg = self.argument_class(name, *args, **kwargs)
        for index, arg in enumerate(self.args[:]):
            if new_arg.name == arg.name:
                del self.args[index]
                self.args.append(new_arg)
                break
        return self
674780
function _filter (x, callback) {
  // figure out what number of arguments the callback function expects
  const args = maxArgumentCount(callback)

  return filter(x, function (value, index, array) {
    // invoke the callback function with the right number of arguments
    if (args === 1) {
      return callback(value)
    } else if (args === 2) {
      return callback(value, [index + 1])
    } else { // 3 or -1
      return callback(value, [index + 1], array)
    }
  })
}
878248
def call_with_asked_args(callback, args):
    
    # FIXME: support default args
    # FIXME: support kwargs
    # co_varnames contains both args and local variables, in order. 
    # We only pick the local variables
    asked_arg_names = callback.__code__.co_varnames[:callback.__code__.co_argcount]
    asked_arg_values = []
    missing_args = []
    for asked_arg_name in asked_arg_names:
        if asked_arg_name in args:
            asked_arg_values.append(args[asked_arg_name])
        else:
            missing_args.append(asked_arg_name)
    if missing_args:
        raise TypeError(
            '{}() missing required positional argument: {}'.format(
                callback.__code__.co_name,
                ', '.join(missing_args)
            )
        )
    return callback(*asked_arg_values)
953262
def _callOnOrganizerPlugins(self, methodName, *args):
        
        for observer in self.getOrganizerPlugins():
            method = getattr(observer, methodName, None)
            if method is not None:
                method(*args)
            else:
                warn(
                    "IOrganizerPlugin now has the %s method, %s "
                    "did not implement it" % (methodName, observer.__class__,),
                    category=PendingDeprecationWarning)
296138
def execute_plugin(method)
      Polipus::Plugin.plugins.each do |k, p|
        next unless p.respond_to?(method)
        @logger.info { "Running plugin method #{method} on #{k}" }
        ret_val = p.send(method, self)
        instance_eval(&ret_val) if ret_val.is_a? Proc
      end
    end
505117
public MethodCall with(String name1, Object arg1, String name2, Object arg2, String name3, Object arg3, String name4, Object arg4) {
    args.put(name1, arg1);
    if (name2 != null) {
      args.put(name2, arg2);
      if (name3 != null) {
        args.put(name3, arg3);
        if (name4 != null) {
          args.put(name4, arg4);
        }
      }
    }
    return this;
  }
972269
def reload_all_plugins(self, *args):
        
        for manifest in self._manifests[:]:
            if self.get_plugin(manifest["name"]) is not None:
                self.reload_plugin(manifest["name"], *args)
649226
def _multiple_callbacks(callbacks, *args, **kwargs):
    
    if isinstance(callbacks, list):
        for cb in callbacks:
            cb(*args, **kwargs)
        return
    if callbacks:
        callbacks(*args, **kwargs)
954875
def consume_arguments(self, argument_list):
        
        while True:
            argument_count = len(argument_list)
            for parameter in self.values():
                argument_list = parameter.consume_arguments(argument_list)
            if len(argument_list) == argument_count:
                return argument_list
704071
def replace(self, parameters=_void, return_annotation=_void):
        

        if parameters is _void:
            parameters = self.parameters.values()

        if return_annotation is _void:
            return_annotation = self._return_annotation

        return type(self)(parameters, return_annotation=return_annotation)
418408
function (target, methodName, args) {
    return perform(target, function (target) {
        return target.apply(methodName, args);
    }, function (target) {
        return target[methodName].apply(target, args);
    });
}
1278569
def method_args(self, context, **kwargs):
        
        try:
            _args = self.conf[context].copy()
        except KeyError:
            _args = kwargs
        else:
            _args.update(kwargs)
        return _args
652956
def filter(self, object, *args, **kw):
    '''
    
    '''
    for plugin in self.plugins:
      object = plugin.handle(object, *args, **kw)
      if object is None:
        return object
    return object
624192
function (callback, context, args) {
  var arg1, arg2, arg3
  arg1 = args[0]
  arg2 = args[1]
  arg3 = args[2]
  switch (args.length) {
    case 0:
      callback.call(context); return
    case 1:
      callback.call(context, arg1); return
    case 2:
      callback.call(arg1, arg2); return
    case 3:
      callback.call(context, arg1, arg2, arg3); return
    default:
      callback.apply(context, args); return
  }
}
954287
def find_or_build_all(cls, list_of_kwargs):
        
        return cls.add_all([cls.first(**kwargs) or cls.new(**kwargs)
                            for kwargs in list_of_kwargs], commit=False)