Vel factory function
165842
def create(buffer_capacity: int, buffer_initial_size: int, frame_stack_compensation: bool = False,
           frame_history: int = 1):
    
    return CircularReplayBufferFactory(
        buffer_capacity=buffer_capacity,
        buffer_initial_size=buffer_initial_size,
        frame_stack_compensation=frame_stack_compensation,
        frame_history=frame_history
    )
859149
def func_factory(p, method: str) -> callable:
    

    def callback(pretty: bool = False):
        res = getattr(p, method)
        dump = partial(json.dumps, indent=4) if pretty else partial(json.dumps)
        click.echo(dump(res))

    return callback
392031
def create(input_width, input_height, input_channels=1, output_dim=512):
    
    def instantiate(**_):
        return NatureCnn(
            input_width=input_width, input_height=input_height, input_channels=input_channels,
            output_dim=output_dim
        )

    return ModelFactory.generic(instantiate)
716333
function MuxFactory(options) {

    function Class (receiveProps) {
        Ctor.call(this, options, receiveProps)
    }
    Class.prototype = Object.create(Mux.prototype)
    return Class
}
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
  })
}
52271
function construct (constructor, args) {
  function Factory () {
    return constructor.apply(this, args);
  }

  Factory.prototype = constructor.prototype;

  return new Factory();
}
1286017
function(v, returnNew) {
      var
      tx = this.x,
      ty = this.y,
      vx = v.x,
      vy = v.y,
      x = tx < vx ? tx : vx,
      y = ty < vy ? ty : vy;

      if (returnNew) {
        return new Vec2(x, y);
      } else {
        return this.set(x, y);
      }
    }
39917
def _basis_spline_factory(coef, degree, knots, der, ext):
        """"""
        return functools.partial(interpolate.splev, tck=(knots, coef, degree), der=der, ext=ext)
938659
def instantiate_from_data(self, object_data):
        
        if isinstance(object_data, dict) and 'name' in object_data:
            name = object_data['name']
            module = importlib.import_module(name)
            return self.resolve_and_call(module.create, extra_env=object_data)
        if isinstance(object_data, dict) and 'factory' in object_data:
            factory = object_data['factory']
            module = importlib.import_module(factory)
            params = self.resolve_parameters(module.create, extra_env=object_data)
            return GenericFactory(module.create, params)
        elif isinstance(object_data, dict):
            return {k: self.instantiate_from_data(v) for k, v in object_data.items()}
        elif isinstance(object_data, list):
            return [self.instantiate_from_data(x) for x in object_data]
        elif isinstance(object_data, Variable):
            return object_data.resolve(self.parameters)
        else:
            return object_data
746213
public static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim, Random r) {
    double[] data = new double[dim];
    for(int i = 0; i < dim; i++) {
      data[i] = r.nextDouble();
    }
    return factory.newNumberVector(data);
  }
654453
function factory() {
        var utilx = {};

        $forEach(objectKeys($), function (key1) {
            if (!pHasOwn.call(utilx, 'methods')) {
                defineProperty(utilx, 'methods', assign({
                    value: []
                }, propNotEnumerable));
            }

            defineProperty(utilx, key1, assign({
                value: $[key1]
            }, propNotEnumerable));

            if (isPlainObject($[key1])) {
                if (!pHasOwn.call(utilx[key1], 'methods')) {
                    defineProperty(utilx[key1], 'methods', assign({
                        value: []
                    }, propNotEnumerable));
                }

                $forEach(objectKeys($[key1]), function (key2) {
                    defineProperty(utilx[key1], key2, assign({
                        value: $[key1][key2]
                    }, propNotEnumerable));

                    if (isPlainObject($[key1][key2])) {
                        if (!pHasOwn.call(utilx[key1][key2], 'methods')) {
                            defineProperty(utilx[key1][key2], 'methods', assign({
                                value: []
                            }, propNotEnumerable));
                        }

                        $forEach(objectKeys($[key1][key2]), function (key3) {
                            defineProperty(utilx[key1][key2], key3, assign({
                                value: $[key1][key2][key3]
                            }, propNotEnumerable));

                            $push(utilx[key1][key2].methods, key3);
                        });
                    } else {
                        $push(utilx[key1].methods, key2);
                    }
                });
            } else {
                $push(utilx.methods, key1);
            }
        });

        defineProperties(utilx.Number, {
            POSITIVE_ZERO: propConstant,

            NEGATIVE_ZERO: propConstant,

            UNSAFE_INTEGER: propConstant,

            WORD8: propConstant,

            UWORD8: propConstant,

            WORD16: propConstant,

            UWORD16: propConstant,

            WORD32: propConstant,

            UWORD32: propConstant,

            MAX_UINT32: propConstant,

            MAX_INT32: propConstant,

            MIN_INT32: propConstant,

            MAX_UINT16: propConstant,

            MAX_INT16: propConstant,

            MIN_INT16: propConstant,

            MAX_UINT8: propConstant,

            MAX_INT8: propConstant,

            MIN_INT8: propConstant,

            MAX_SAFE_INTEGER: propConstant,

            MIN_SAFE_INTEGER: propConstant,

            MAX_VALUE: propConstant,

            MIN_VALUE: propConstant,

            EPSILON: propConstant,

            NaN: propConstant,

            POSITIVE_INFINITY: propConstant,

            NEGATIVE_INFINITY: propConstant
        });

        return utilx;
    }
328912
function factory(key, state, ctx) {
  return enter

  function enter() {
    var context = ctx || this
    var current = context[key]

    context[key] = !state

    return exit

    function exit() {
      context[key] = current
    }
  }
}
1228278
function typeFactory(test) {
  return type

  function type(node) {
    return Boolean(node && node.type === test)
  }
}
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
        );
      }
    }
1140913
def _walk_factory(self, dep_predicate):
    """"""
    walk = None
    if dep_predicate:
      walk = self.DepPredicateWalk(dep_predicate)
    else:
      walk = self.NoDepPredicateWalk()
    return walk
323166
function recreateFactory (name, dependencies, create) {
  const f = factory(name, dependencies, create)
  f.recreateOnConfigChange = true
  return f
}
443225
function factory() {
      var sequence = new ctor();

      // Every sequence needs a reference to its parent in order to work.
      sequence.parent = this;

      // If a custom init function was supplied, call it now.
      if (sequence.init) {
        sequence.init.apply(sequence, arguments);
      }

      return sequence;
    }