/*
Make deep copy of template by invoking valueGenerator functions as you copy.
Repeat for instructed amount, and place it in instructed location.
Arg:
- instruction(Array)
- templates(Array)
193224
function createResponseData(instruction, templates){
  instruction.map(function(inst){
    if(!templates[inst.key]){return log.templateNotSpecified(inst.key);}
    var data = [];
    for(var j=0;j<inst.amount;j++){
      data.push(cloneAndInvoke(templates[inst.key]));
    }
    inst.location.splice.apply(inst.location, [inst.index, 1].concat(data));
  });
}
1133736
@Override
    public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) {

        int flags = 0;
        if (ins instanceof InvokeInstruction) {
            flags = ValueNumber.RETURN_VALUE;
        } else if (ins instanceof ArrayInstruction) {
            flags = ValueNumber.ARRAY_VALUE;
        } else if (ins instanceof ConstantPushInstruction) {
            flags = ValueNumber.CONSTANT_VALUE;
        }

        // Get the input operands to this instruction.
        ValueNumber[] inputValueList = popInputValues(numWordsConsumed);

        // See if we have the output operands in the cache.
        // If not, push default (fresh) values for the output,
        // and add them to the cache.
        ValueNumber[] outputValueList = getOutputValues(inputValueList, numWordsProduced, flags);

        if (VERIFY_INTEGRITY) {
            checkConsumedAndProducedValues(ins, inputValueList, outputValueList);
        }

        // Push output operands on stack.
        pushOutputValues(outputValueList);
    }
1259411
function template(t,e,n){"use strict";
// reset cache every 32M
33554432<template.$&&(template._={},template.$=0);var a,l="function"==typeof t,s=l?e:t,i=l?n:e,p=template._,r=p.hasOwnProperty(s),h=r?p[s]:p[s]=template.parse(s),u=h.chunks,c=h.values;if(
// add str length only if not known
r||(template.$+=s.length),l)s="function"+(1e5*Math.random()|0),a=[s,"with(this)return "+s+"(["+u+"]"+(c.length?","+c.join(","):"")+")"];else{a=u.slice(0,1);for(var o=1,f=u.length;o<f;o++)a.push(c[o-1],u[o]);a=["with(this)return "+a.join("+")]}return Function.apply(null,a).apply(i,l?[t]:[])}
641063
function _copy(val) {
    const type = $type(val);

    if (type == 'object') {
        val = _extend({}, val, true);
    } else if (type == 'array') {
        val = val.slice(0);
    }

    return val;
}
755530
def deep_copy(object)
      try_to_clone(object).tap do |new_object|
        case new_object
        when Hash
          new_object.each{ |k, v| new_object[k] = deep_copy(v) }
        when Array
          new_object.replace(new_object.collect{ |item| deep_copy(item) })
        end
      end
    end
428436
function generateCode(taskOptions) {
  try {
    // Perform initialization tasks
    const model = taskOptions.swagger;
    debug('Processing configuration');
    const config = defaults(taskOptions, configDefaults);
    debug('  Initializing template engine');
    const templateEngine = taskOptions.templateEngine(taskOptions);
    debug('  Mapping definitions from file');
    const definitionMap = taskOptions.definitionMapper(model);

    // Execute definition templates
    /* istanbul ignore else - Trivial case */
    if (config.perDefinition) {
      debug('  Executing per-definition templates:');
      for (const templateFile of Object.keys(config.perDefinition)) {
        debug('    Iterating template: %s', templateFile);
        const options = defaults(config.perDefinition[templateFile], {
          extension: '.js',
          operations: ['get', 'put', 'post', 'delete'],
        });
        const template = taskOptions.templateLoader(templateEngine)
          .loadTemplate(templateFile, taskOptions.textEncoding);
        for (const definitionKey of Object.keys(definitionMap)) {
          const definition = definitionMap[definitionKey];

          debug('      Processing definition %s', definitionKey);
          // Copy fields from options into definition for
          const context = {
            model,
            definition,
            definitionMap,
            options,
          };

          debug('      Rendering template');
          const output = template(context);
          const subPath = path.join(options.target,
            definition.definitionName.toLowerCase() +
            options.extension);
          taskOptions.output(subPath, output);
        }
      }
    } else {
      debug('    No per-definition templates specified in perDefinition');
    }

    // Execute path templates
    if (config.perPath) {
      debug('  Executing per-path templates:');
      for (const templateFile of Object.keys(config.perPath)) {
        debug('    Processing template: %s', templateFile);
        const options = defaults(config.perPath[templateFile], {
          extension: '.js',
          operations: ['get', 'put', 'post', 'delete'],
        });
        const template = taskOptions.templateLoader(templateEngine)
          .loadTemplate(templateFile, taskOptions.textEncoding);
        debug('    Iterating paths, grouping operations by %s', options.groupBy);

        const groups = {};

        for (const pathString of Object.keys(model.paths)) {
          debug('      Path: %s', pathString);
          const pathDef = model.paths[pathString];
          let groupKey = pathDef[options.groupBy];
          pathDef.pathString = pathString;

          // Iterate through the allowed operations
          for (const operationString of _.intersection(Object.keys(pathDef), options.operations)) {
            debug('        Operation: %s', operationString);
            const operationDef = model.paths[pathString][operationString];
            groupKey = operationDef[options.groupBy] || groupKey;
            operationDef.pathDef = pathDef;
            operationDef.operationString = operationString;

            // We need a grouping key at either operation or path level
            /* istanbul ignore if */
            if (groupKey === null || groupKey === undefined) {
              throw new Error(util.format(
                'Cannot map path operation. No groupBy match at path/operation level: %s/%s [%s]',
                pathString,
                operationString,
                options.groupBy));
            }
            debug('          Assigned to output group: %s', groupKey);

            // If the group does not exist, create it
            if (groups[groupKey] === undefined) {
              groups[groupKey] = [];
            }

            // Add to group
            groups[groupKey].push(operationDef);
          } // per operationString
        } // per pathString

        debug('    Rendering template for %s group(s)', Object.keys(groups).length);
        for (const groupKey of Object.keys(groups)) {
          debug('      Processing group: %s', groupKey);

          const context = {};
          context.fileName = groupKey.trim().toLowerCase();
          context.groupKey = groupKey;
          context.members = groups[groupKey];
          context.definitionMap = definitionMap;
          context.model = model;
          context.options = options;

          const output = template(context);
          const subPath = path.join(options.target,
            context.fileName + options.extension);
          taskOptions.output(subPath, output);
        }
      } // per templateFile
    } // if perPath
  } catch (err) {
    /* istanbul ignore next - We don't wan't to test process.exit */
    taskOptions.failureHandler(err);
  }
}
1017655
function compileRender(templateSource, data, block) {
  const hash = md5(templateSource);

  return Promise.try(() => {
    const cached = compileRenderCache.get(hash);
    if (cached) {
      compileRenderCache.ttl(hash);
      return cached;
    }

    const templateFunction = precompile(templateSource, {})
      .then(code => evaluate(code));

    compileRenderCache.set(hash, templateFunction);
    return templateFunction;
  }).then((templateFunction) => {
    if (block) {
      templateFunction = templateFunction.blocks && templateFunction.blocks[block];
    }
    if (!templateFunction) {
      return '';
    }

    return runtime(Benchpress.helpers, data, templateFunction);
  }).catch((err) => {
    err.message = `Render failed for template ${templateSource.slice(0, 20)}:\n ${err.message}`;
    err.stack = `Render failed for template ${templateSource.slice(0, 20)}:\n ${err.stack}`;

    throw err;
  });
}
406671
function template(source, target) {
  source = source || {};
  target = target || {};
  for(var z in source) {
    target[z] = $.partial(source[z]);
  }
  return target;
}
195397
function compile(directive, ctxt, template){
    var rfn = compiler( ( template || this[0] ).cloneNode(true), directive, ctxt);
    return function(context){
      return rfn({context:context});
    };
  }
29015
def copy(self):
        
        templates = self.prepare_templates()
        if self.params.interactive:
            keys = list(self.parser.default)
            for key in keys:
                if key.startswith('_'):
                    continue
                prompt = "{0} (default is \"{1}\")? ".format(
                    key, self.parser.default[key])

                if _compat.PY2:
                    value = raw_input(prompt.encode('utf-8')).decode('utf-8')
                else:
                    value = input(prompt.encode('utf-8'))

                value = value.strip()
                if value:
                    self.parser.default[key] = value

        self.parser.default['templates'] = tt = ','.join(
            t.name for t in templates)
        logging.warning("Paste templates: {0}".format(tt))
        self.make_directory(self.params.TARGET)

        logging.debug("\nDefault context:\n----------------")
        logging.debug(
            ''.join('{0:<15} {1}\n'.format(*v)
                    for v in self.parser.default.items())
        )
        return [t.paste(
            **dict(self.parser.default.items())) for t in templates]
573504
function _assignGenerator(own) {
    let _copy = function(target, ...source) {
        let deep = true;
        if (is.Boolean(target)) {
            deep = target;
            target = 0 in source
                ? source.shift()
                : null;
        }

        if (is.Array(target)) {
            source.forEach(sc => {
                target.push(...sc);
            });
        } else if (is.Object(target)) {
            source.forEach(sc => {
                for (let key in sc) {
                    if (own && !sc.hasOwnProperty(key))
                        continue;
                    let so = sc[key],
                        to = target[key];
                    if (is.PureObject(so)) {
                        target[key] = deep
                            ? extend(true, is.PureObject(to)
                                ? to
                                : {}, so)
                            : so;
                    } else if (is.Array(so)) {
                        target[key] = deep
                            ? extend(true, is.Array(to)
                                ? to
                                : [], so)
                            : so;
                    } else {
                        target[key] = so;
                    }
                }
            });
        }
        // Do nothing
        return target;
    };
    return _copy;
}
1206745
public PactDslJsonArray template(DslPart template, int occurrences) {
		for(int i = 0; i < occurrences; i++) {
			template(template);	
		}
		return this;
	}
120249
def deep_copy
      address = Address.new(
        _deep_copy_array(@path_fragments),
        _deep_copy_array(@query_vars),
        _deep_copy_hash(@headers),
        @path_params.dup,
        @query_params.dup,
        @header_params.dup
      )

      @auth.each { |header, value| address.auth(header, value) }

      address
    end
163022
function(deep) {
      var newObj = {},
          i;

      if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) {
        return obj;
      }

      for (i in obj) {
        if(obj.hasOwnProperty(i)) {
          if (deep) {
            newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep);
          } else {
            newObj[i] = obj[i];
          }
        }
      }
      return newObj;
    }
1143012
function copyDeep(source) {
    for (var
      key, descriptor, value,
      target = create(gPO(source)),
      names = oK(source),
      i = 0; i < names.length; i++
    ) {
      key = names[i];
      descriptor = gOPD(source, key);
      if (hOP.call(descriptor, VALUE)) {
        copyValueIfObject(descriptor, copyDeep);
      }
      defineProperty(target, key, descriptor);
    }
    return target;
  }
960067
function serializeInstruction(instruction) {
    return JSON.stringify({
      path: instruction.path,
      component: instruction.component,
      params: Object.keys(instruction.params).reduce(function (acc, key) {
        return (key !== 'childRoute' && (acc[key] = instruction.params[key])), acc;
      }, {})
    });
  }
1133346
function copy(source, target, hidden) {
	for (var key in source) {
		Object.defineProperty(target, key, {
			enumerable: hidden !== true,
			configurable: true, writable: true,
			value: source[key]
		});
	}

	return target;
}