Creates a trivial factory that always return the provided function.
18338
public static Function.Factory factory(final Function fun)
    {
        return new Function.Factory()
        {
            public Function create(String ksName, String cfName)
            {
                return fun;
            }
        };
    }
269739
function factory(original) {
  replacement.locator = original.locator

  return replacement

  /* Replacer for tokeniser or visitor. */
  function replacement(node) {
    var self = this
    var result = original.apply(self, arguments)
    var marker = result && result.type ? result : node
    var data

    try {
      data = jsYAML.safeLoad(marker.value)
      data = data && data.remark

      if (data) {
        self.setOptions(data)
      }
    } catch (error) {
      self.file.fail(error.message, marker)
    }

    return result
  }
}
189433
function factory(fn){
    if (typeof fn != 'function')
      fn = getter(fn);

    var result = function(value){
      return fn(value);
    };
    /** @cut */ result = devInfoResolver.patchFactory(result);
    result.factory = FACTORY;

    return result;
  }
109600
def functions_factory(cls, coef, domain, kind, **kwargs):
        
        basis_polynomial = cls._basis_polynomial_factory(kind)
        return basis_polynomial(coef, domain)
902939
def functionFactory(in_code, name, defaults, globals_, imports):
    """"""
    def generatedFunction():
        pass
    generatedFunction.__code__ = marshal.loads(in_code)
    generatedFunction.__name__ = name
    generatedFunction.__defaults = defaults
    generatedFunction.__globals__.update(pickle.loads(globals_))
    for key, value in imports.items():
        imported_module = __import__(value)
        scoop.logger.debug("Dynamically loaded module {0}".format(value))
        generatedFunction.__globals__.update({key: imported_module})
    return generatedFunction
661608
static function factory($name = 'default') {
        $class = get_called_class();
        if (!isset(self::$instances[$class][$name])) {
            self::$instances[$class][$name] = new $class($name);
        }

        return self::$instances[$class][$name];
    }
1181372
public static <E> OptionalFunction<Selection<Constructor<?>>, E> instantiate(Object... args) {
    return OptionalFunction.of(selection -> factory.createInvoker(selection.result()).withArgs(args));
  }
954926
public static function factory()
    {
        $static = get_called_class();

        return function (
                $callableParameter,
                $scopeType,
                $namespace,
                array $parameterScopedVariableMap,
                array $parameterExpressions,
                array $bodyExpressions = null
        ) use ($static) {
            return new $static(
                    $callableParameter,
                    $scopeType,
                    $namespace,
                    $parameterScopedVariableMap,
                    $parameterExpressions,
                    $bodyExpressions);
        };
    }
1362413
def factory(opts, **kwargs):
        '''
        
        '''
        # FIXME for now, just UXD
        # Obviously, this makes the factory approach pointless, but we'll extend later
        import salt.transport.ipc
        return salt.transport.ipc.IPCMessageClient(opts, **kwargs)
614018
public FaceletTaglibFunctionType<WebFacelettaglibraryDescriptor> getOrCreateFunction()
   {
      List<Node> nodeList = model.get("function");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FaceletTaglibFunctionTypeImpl<WebFacelettaglibraryDescriptor>(this, "function", model, nodeList.get(0));
      }
      return createFunction();
   }
155235
function makeRequireFunction() {
    const Module = this.constructor;
    const self = this;

    function require(path) {
        try {
            exports.requireDepth += 1;
            return self.require(path);
        } finally {
            exports.requireDepth -= 1;
        }
    }

    function resolve(request) {
        return Module._resolveFilename(request, self);
    }

    require.resolve = resolve;

    require.main = process.mainModule;

    // Enable support to add extra extension types.
    require.extensions = Module._extensions;

    require.cache = Module._cache;

    return require;
}
585541
def factory():
        """"""
        if not TransCache.SINGLETON or TransCache._cache_is_expired():
            TransCache.SINGLETON = TransCache()
            TransCache.SINGLETON_CREATION_DATETIME = timezone.now()

        return TransCache.SINGLETON
137912
public FaceletTaglibFunctionType<FaceletTaglibType<T>> getOrCreateFunction()
   {
      List<Node> nodeList = childNode.get("function");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FaceletTaglibFunctionTypeImpl<FaceletTaglibType<T>>(this, "function", childNode, nodeList.get(0));
      }
      return createFunction();
   }
636863
def _make_function(instr, queue, stack, body, context):
    
    assert stack, "Empty stack before MAKE_FUNCTION."
    prev = stack[-1]
    expect(prev, instrs.LOAD_CONST, "before MAKE_FUNCTION")

    stack.append(instr)

    if is_lambda_name(prev.arg):
        return

    return context.update(
        make_function_context=MakeFunctionContext(
            closure=isinstance(instr, instrs.MAKE_CLOSURE),
        )
    )
1135268
function unitFactory (name, valueStr, unitStr) {
  const dependencies = ['config', 'Unit', 'BigNumber']

  return factory(name, dependencies, ({ config, Unit, BigNumber }) => {
    // Note that we can parse into number or BigNumber.
    // We do not parse into Fractions as that doesn't make sense: we would lose precision of the values
    // Therefore we dont use Unit.parse()
    const value = config.number === 'BigNumber'
      ? new BigNumber(valueStr)
      : parseFloat(valueStr)

    const unit = new Unit(value, unitStr)
    unit.fixPrefix = true
    return unit
  })
}
1057475
@Nonnull
	public static <T1, T2, R> LObjIntObjFunctionBuilder<T1, T2, R> objIntObjFunction() {
		return new LObjIntObjFunctionBuilder();
	}
583960
@NonNull
  public static CreateFunctionStart createFunction(@NonNull String functionName) {
    return new DefaultCreateFunction(CqlIdentifier.fromCql(functionName));
  }