Useful for debuging curried functions
483930
function setSrc(curried, src) {
  curried.toString = function() {
    return src.toString();
  };
  curried.src = src;
  return curried;
}
723227
def _templated(fn):
    
    @functools.wraps(fn)
    def inner(ctl):
        return [i.format(**ctl) for i in fn(ctl)]
    return inner
1158274
function _curry2 (fn) {
  return function f2 (a, b) {
    if (!arguments.length) {
      return f2
    }

    if (arguments.length === 1) {
      return function (_b) {
        return fn(a, _b)
      }
    }

    return fn(a, b)
  }
}
881752
function Function_(types) {
    var tuples = Z.reduce (function(tuples, t) {
      tuples.push (['$' + show (tuples.length + 1), K ([]), t]);
      return tuples;
    }, [], types);

    function format(outer, inner) {
      return when (tuples.length !== 2)
                  (parenthesize (outer))
                  (joinWith (outer (', '),
                             Z.map (function(tuple) {
                               return when (tuple[2].type === FUNCTION)
                                           (parenthesize (outer))
                                           (inner (tuple[0])
                                                  (show (tuple[2])));
                             }, init (tuples)))) +
             outer (' -> ') +
             inner ((last (tuples))[0])
                   (show ((last (tuples))[2]));
    }

    return _Type (FUNCTION,
                  '',
                  '',
                  types.length,
                  format,
                  [AnyFunction],
                  K (K (true)),
                  tuples);
  }
506398
function neoDebug (prefix, options)
{
	var copy = {};
	if (options)
	{
		for (var i in options)
			copy[i] = options[i];
	}

	copy.prefix = prefix;

	var index = String(_options.push(copy) - 1);
	_prevTimes.push(0);
	updateDebugFunction(index);
	function debug ()
	{
		var f = _functions[index];
		if (f !== disabled)
			f(arguments);
	}

	debug.update = function (options)
	{
		if (!options)
			return;

		var orig = _options[index];
		for (var i in options)
			orig[i] = options[i];

		updateDebugFunction(index);
	};

	return debug;
}
719403
def wrapply(func, *args, **kwargs):
    ''
    val = args[0]
    if val is None:
        return TypedWrapper(func, None)
    elif isinstance(val, TypedExceptionWrapper):
        tew = copy(val)
        tew.forwarded = True
        return tew
    elif isinstance(val, TypedWrapper):
        return val
    elif isinstance(val, Exception):
        return TypedWrapper(func, *args)

    try:
        return func(*args, **kwargs)
    except Exception as e:
        e.stacktrace = stacktrace()
        return TypedExceptionWrapper(func, *args, exception=e)
13449
def is_function_variadic(self):
        """"""
        assert self.kind == TypeKind.FUNCTIONPROTO

        return conf.lib.clang_isFunctionTypeVariadic(self)
181283
def isroutine(object):
    """"""
    return (isbuiltin(object)
            or isfunction(object)
            or ismethod(object)
            or ismethoddescriptor(object))
743684
function fn (deps, func, context) {
		if( isString(deps) ) {
			if( func === undefined ) {
				return definitions[deps];
			} else {
				return fn.define(deps, func, context);
			}
		} else {
			fn.run(deps, func, context);
		}
		return fn;
	}
179828
def _nargs(f) -> Optional[int]:
    '''
        
    '''
    if isinstance(f, Function):
        return f.nargs
    spec = inspect.getfullargspec(f)
    if spec.varargs is not None:
        return None
    return len(spec.args)
1073824
function curry(fn, obj) {
  // create a local copy of the function. don't apply anything yet
  // optionally bind an object to the `this` of the function.
  var newFunction = _.bind(fn, (obj || null));

  // curried functions always take one argument
  return function () {
    // create another copy of the function with the arguments applied
    var me = _.partial(newFunction, arguments);

    // take advantage of the fact that bind changes the method signature:
    // if we have no arguments left, run the method
    if (!me.length) return me();

    // otherwise, curry again and return that.
    return curry(me);
  };
}
1492
def print_yielded(func):
	
	print_all = functools.partial(map, print)
	print_results = compose(more_itertools.recipes.consume, print_all, func)
	return functools.wraps(func)(print_results)
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);
                };
              }
577000
def get_func_args(func):
    
    if isinstance(func, functools.partial):
        return _signature(func.func)
    if inspect.isfunction(func) or inspect.ismethod(func):
        return _signature(func)
    # Callable class
    return _signature(func.__call__)
610089
def stmt_lambdef_handle(self, original, loc, tokens):
        """"""
        if len(tokens) == 2:
            params, stmts = tokens
        elif len(tokens) == 3:
            params, stmts, last = tokens
            if "tests" in tokens:
                stmts = stmts.asList() + ["return " + last]
            else:
                stmts = stmts.asList() + [last]
        else:
            raise CoconutInternalException("invalid statement lambda tokens", tokens)
        name = self.stmt_lambda_name()
        body = openindent + self.stmt_lambda_proc("\n".join(stmts)) + closeindent
        if isinstance(params, str):
            self.stmt_lambdas.append(
                "def " + name + params + ":\n" + body,
            )
        else:
            params.insert(0, name)  # construct match tokens
            self.stmt_lambdas.append(
                "".join(self.name_match_funcdef_handle(original, loc, params))
                + body,
            )
        return name
1033509
function curry(fn, ...firstArgs) {
  return function(...secondArgs) {
    return fn.apply(null, firstArgs.concat(secondArgs));
  };
}
1361775
function _curry3 (fn) {
  return function f3 (a, b, c) {
    switch (arguments.length) {
      case 0:
        return f3
      case 1:
        return _curry2(function (_b, _c) {
          return fn(a, _b, _c)
        })
      case 2:
        return function (_c) {
          return fn(a, b, _c)
        }
      default:
        return fn(a, b, c)
    }
  }
}