Vel factory function
559438
def create(backbone: ModelFactory, vmin: float, vmax: float, atoms: int, initial_std_dev: float = 0.4,
           factorized_noise: bool = True, input_block: typing.Optional[ModelFactory] = None):
    
    if input_block is None:
        input_block = IdentityFactory()

    return QDistributionalModelFactory(
        input_block=input_block, backbone=backbone,
        vmin=vmin,
        vmax=vmax,
        atoms=atoms,
        initial_std_dev=initial_std_dev,
        factorized_noise=factorized_noise
    )
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
515342
def _op_factory(func, kwargs, opname, bands, rgb_op=False):
    

    def f(arr):
        # Avoid mutation by copying
        newarr = arr.copy()
        if rgb_op:
            # apply func to array's first 3 bands, assumed r,g,b
            # additional band(s) are untouched
            newarr[0:3] = func(newarr[0:3], **kwargs)
        else:
            # apply func to array band at a time
            for b in bands:
                newarr[b - 1] = func(arr[b - 1], **kwargs)
        return newarr

    f.__name__ = str(opname)
    return f
431001
function(bb, v)
{
    var x = min(max(bb.l, v.x), bb.r);
    var y = min(max(bb.b, v.y), bb.t);
    return new Vect(x, y);
}
1140913
def _walk_factory(self, dep_predicate):
    """"""
    walk = None
    if dep_predicate:
      walk = self.DepPredicateWalk(dep_predicate)
    else:
      walk = self.NoDepPredicateWalk()
    return walk
18338
public static Function.Factory factory(final Function fun)
    {
        return new Function.Factory()
        {
            public Function create(String ksName, String cfName)
            {
                return fun;
            }
        };
    }
695865
public static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim) {
    return randomVector(factory, dim, new Random());
  }
929394
def construct(cls, faker, path_to_factories=None):
        
        factory = faker.__class__()

        if path_to_factories is not None and os.path.isdir(path_to_factories):
            for filename in os.listdir(path_to_factories):
                if os.path.isfile(filename):
                    cls._resolve(path_to_factories, filename)

        return factory
649773
function buildVerror(code, stdOut, stdErr) {
  return new VError({
    name: stdOut,
    info: {
      code: code,
      stdout: stdOut,
      stderr: stdErr
    }
  }, stdOut + stdErr);
}
205330
function factory(type) {
  point.displayName = type

  return point

  /* Get a point in `node.position` at a bound `type`. */
  function point(node) {
    var point = (node && node.position && node.position[type]) || {}

    return {
      line: point.line || null,
      column: point.column || null,
      offset: isNaN(point.offset) ? null : point.offset
    }
  }
}
375795
function createFactory() {
  return function Stamp(options) {
    var descriptor = Stamp.compose || {};
    // Next line was optimized for most JS VMs. Please, be careful here!
    var obj = {__proto__: descriptor.methods}; // jshint ignore:line

    merge(obj, descriptor.deepProperties);
    assign(obj, descriptor.properties);
    Object.defineProperties(obj, descriptor.propertyDescriptors || {});

    if (!descriptor.initializers || descriptor.initializers.length === 0) return obj;

    if (options === undefined) options = {};
    var inits = descriptor.initializers;
    var length = inits.length;
    for (var i = 0; i < length; i += 1) {
      var initializer = inits[i];
      if (isFunction(initializer)) {
        var returnedValue = initializer.call(obj, options,
          {instance: obj, stamp: Stamp, args: slice.apply(arguments)});
        obj = returnedValue === undefined ? obj : returnedValue;
      }
    }

    return obj;
  };
}
365911
function(factory, options) {
			this.base(options);
			this.factory = factory;
			this.callback(this.callbacks.init);	
			this.callback(this.callbacks.create);
		}
200103
function(bb, v)
{
    var ix = Math.abs(bb.r - bb.l);
    var modx = (v.x - bb.l) % ix;
    var x = (modx > 0) ? modx : modx + ix;
    
    var iy = Math.abs(bb.t - bb.b);
    var mody = (v.y - bb.b) % iy;
    var y = (mody > 0) ? mody : mody + iy;
    
    return new Vect(x + bb.l, y + bb.b);
}
1048089
function(vec2, returnNew) {
      var x,y;
      if ('number' !== typeof vec2) { //.x !== undef) {
        x = vec2.x;
        y = vec2.y;

      // Handle incoming scalars
      } else {
        x = y = vec2;
      }

      if (!returnNew) {
        return this.set(this.x * x, this.y * y);
      } else {
        return new Vec2(
          this.x * x,
          this.y * y
        );
      }
    }
955645
function factory(BaseClass, mapFunction) {
  function subject(value) {
    if (typeof mapFunction === 'function') {
      value = mapFunction.apply(undefined, arguments);
    } else if (typeof mapFunction !== 'undefined') {
      value = mapFunction;
    }
    subject.onNext(value);
    return value;
  }
  
  for (var key in BaseClass.prototype) {
    subject[key] = BaseClass.prototype[key];
  }

  BaseClass.apply(subject, [].slice.call(arguments, 2));

  return subject;
}
245555
def decorator(caller, _func=None):
    """"""
    if _func is not None:  # return a decorated function
        # this is obsolete behavior; you should use decorate instead
        return decorate(_func, caller)
    # else return a decorator function
    if inspect.isclass(caller):
        name = caller.__name__.lower()
        callerfunc = get_init(caller)
        doc = 'decorator(%s) converts functions/generators into ' \
            'factories of %s objects' % (caller.__name__, caller.__name__)
        fun = getfullargspec(callerfunc).args[1]  # second arg
    elif inspect.isfunction(caller):
        if caller.__name__ == '<lambda>':
            name = '_lambda_'
        else:
            name = caller.__name__
        callerfunc = caller
        doc = caller.__doc__
        fun = getfullargspec(callerfunc).args[0]  # first arg
    else:  # assume caller is an object with a __call__ method
        name = caller.__class__.__name__.lower()
        callerfunc = caller.__call__.__func__
        doc = caller.__call__.__doc__
        fun = getfullargspec(callerfunc).args[1]  # second arg
    evaldict = callerfunc.__globals__.copy()
    evaldict['_call_'] = caller
    evaldict['_decorate_'] = decorate
    return FunctionMaker.create(
        '%s(%s)' % (name, fun),
        'return _decorate_(%s, _call_)' % fun,
        evaldict, call=caller, doc=doc, module=caller.__module__,
        __wrapped__=caller)
648077
def create(model_config, model, vec_env, algo, env_roller,
           parallel_envs, number_of_steps,
           experience_replay=1, stochastic_experience_replay=True):
    
    settings = BufferedMixedPolicyIterationReinforcerSettings(
        experience_replay=experience_replay,
        stochastic_experience_replay=stochastic_experience_replay,
        number_of_steps=number_of_steps
    )

    return BufferedMixedPolicyIterationReinforcerFactory(
        settings,
        env_factory=vec_env,
        model_factory=model,
        parallel_envs=parallel_envs,
        env_roller_factory=env_roller,
        algo=algo,
        seed=model_config.seed
    )