Compile specified lodash string template properties into functions.
967548
function normalize(options, templates) {
  // Options override defaults and toc methods.
  var result = _.defaults({}, options, toc, toc.defaults);
  // Remove "core" methods from result object.
  ['defaults', 'process', 'anchorize', 'toc'].forEach(function(prop) {
    delete result[prop];
  });
  // Compile Lodash string templates into functions.
  (templates || []).forEach(function(tmpl) {
    if (typeof result[tmpl] === 'string') {
      result[tmpl] = _.template(result[tmpl]);
    }
  });
  return result;
}
190522
def compiled_update_func(self):
        """"""

        def get_not_none_col_assignment(column_name):
            return ALCHEMY_TEMPLATES.not_none_col_assignment.safe_substitute(col_name=column_name)

        def get_compiled_args(arg_name):
            return ALCHEMY_TEMPLATES.func_arg.safe_substitute(arg_name=arg_name)

        join_string = "\n" + self.tab + self.tab
        columns = [n for n in self.columns if n not in self.primary_keys]
        not_none_col_assignments = join_string.join([get_not_none_col_assignment(n) for n in columns])
        update_args = ", ".join(get_compiled_args(n) for n in columns)
        return ALCHEMY_TEMPLATES.update_function.safe_substitute(not_none_col_assignments=not_none_col_assignments,
                                                                 update_args=update_args,
                                                                 class_name=self.class_name)
987616
function compile(prop, name){
  var output = {};

  if(prop.__params) return prop.__params;

  var str = prop.toString(), //.replace(/(?:\/\*(?:[\s\S]*?)\*\/)|(?:([\s;])+\/\/(?:.*)$)/gm, '$1'), // String representation of function sans comments
      token = tokenizer(str, {
        ecmaVersion: 6,
        sourceType: 'script'
      }),
      finishedPaths = [],
      listening = 0,
      paths = [],
      attrs = [],
      workingpath = [];

  do {

    // console.log(token.type.label, token.value);
    token.nextToken();

    if(token.value === 'this'){
      listening++;
      workingpath = [];
    }

    // TODO: handle gets on collections
    if(token.value === 'get'){
      token.nextToken();
      while(_.isUndefined(token.value)){
        token.nextToken();
      }
      // Replace any access to a collection with the generic @each placeholder and push dependancy
      workingpath.push(token.value.replace(/\[.+\]/g, ".@each").replace(/^\./, ''));
    }

    if(token.value === 'pluck'){
      token.nextToken();
      while(_.isUndefined(token.value)){
        token.nextToken();
      }

      workingpath.push('@each.' + token.value);
    }

    if(token.value === 'slice' || token.value === 'clone' || token.value === 'filter'){
      token.nextToken();
      if(token.type.label === '(') workingpath.push('@each');
    }

    if(token.value === 'at'){
      token.nextToken();
      while(_.isUndefined(token.value)){
        token.nextToken();
      }
      workingpath.push('@each');
    }

    if(token.value === 'where' || token.value === 'findWhere'){
      workingpath.push('@each');
      token.nextToken();
      attrs = [];
      var itr = 0;
      while(token.type.label !== ')'){
        if(token.value){
          if(itr%2 === 0){
            attrs.push(token.value);
          }
          itr++;
        }
        token.nextToken();
      }
      workingpath.push(attrs);
    }

    if(listening && (_.indexOf(TERMINATORS, token.type.label) > -1 || _.indexOf(TERMINATORS, token.value) > -1)){
      workingpath = _.reduce(workingpath, reduceMemos, ['']);
      finishedPaths = _.compact(_.union(finishedPaths, workingpath));
      workingpath = [];
      listening--;
    }

  } while (token.start !== token.end && token.type !== tokTypes.eof);

  // Save our finished paths directly on the function
  prop.__params = finishedPaths;

  // Return the dependancies list
  return finishedPaths;

}
531216
function pluck(collection, propertyName) {
  if (!collection || typeof collection != 'object') {
    return new Error('expected first argument to be an object or array');
  }

  var result, len, i, keys, key;
  if (Array.isArray(collection)) {
    result = [];
    len = collection.length;
    for (i = 0; i < len; i++) {
      result.push(collection[i][propertyName]);
    }
  } else {
    result = {};
    keys = Object.keys(collection);
    len = keys.length;
    for (i = 0; i < len; i++) {
      key = keys[i];
      result[key] = collection[key][propertyName];
    }
  }
  return result;
}
586949
function compileParse(templateSource, block, data, callback) {
  if (!callback && typeof block === 'object' && typeof data === 'function') {
    callback = data;
    data = block;
    block = null;
  }
  if (!templateSource) {
    callback('');
    return;
  }

  compileRender(templateSource, data, block)
    .then(
      output => process.nextTick(callback, null, output),
      err => process.nextTick(callback, err),
    );
}
1278121
def apply_template(template, *args, **kw):
    """"""
    if six.callable(template):
        return template(*args, **kw)
    if isinstance(template, six.string_types):
        return template
    if isinstance(template, collections.Mapping):
        return template.__class__((k, apply_template(v, *args, **kw)) for k, v in template.items())
    if isinstance(template, collections.Iterable):
        return template.__class__(apply_template(v, *args, **kw) for v in template)
    return template
1345382
function compileFile(module, filename) {
		const templateString = fs.readFileSync(filename, 'utf8');

		module.exports = handlebars.compile(templateString);
	}
1347694
function compile(format) {
  /* istanbul ignore if */
  if (typeof format !== 'string') {
    throw new TypeError('argument format must be a string');
  }
  const fmt = format.replace(/"/g, '\\"');
  /* eslint prefer-template:0 */
  const js = '  return "'
    + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, (_, name, arg) => {
      const str = '"\n    + (tokens["' + name + '"](ctx, ';
      return str + String(JSON.stringify(
        arg,
      )) + ') || "-") + "';
    }) + '";';
  /* eslint no-new-func:0 */
  return new Function('tokens, ctx', js);
}
20314
function renderTemplate(contents, data, filename) {
    if (!templateCache.hasOwnProperty(contents)) {
      var jadeOptions = merge.recursive({}, options.jadeOptions, {filename: filename});
      templateCache[contents] = options.jade.compile(contents, jadeOptions);
    }
    var locals = merge.recursive({}, data, {locals: locals});
    return templateCache[contents](data);
  }
1072877
function (yamlJson, cb) {
		
		let all_apis = {};
		let all_errors = {};
		
		let paths = reformatPaths(yamlJson.paths);
		let definitions = yamlJson.definitions;
		let parameters = yamlJson.parameters;
		
		let convertedDefinitions = {};
		let convertedParameters = {};
		
		// convert definitions first
		if (definitions) {
			let definitionsKeys = Object.keys(definitions);
			definitionsKeys.forEach(function (eachDef) {
				convertedDefinitions[eachDef] = convertItem(null, definitions[eachDef], 1); // 1 ??? definitions should never have schema -=-=-=-=-=
			});
		}
		
		// convert parameters then
		if (parameters) {
			let parametersKeys = Object.keys(parameters);
			parametersKeys.forEach(function (eachParam) {
				convertedParameters[eachParam] = convertItem(convertedDefinitions, parameters[eachParam], 1);
			});
			all_apis.commonFields = convertedParameters;
		}
		
		let pathsKeys = Object.keys(paths);
		pathsKeys.forEach(function (eachPath) {
			let methods = paths[eachPath];
			let methodsKeys = Object.keys(methods);
			
			methodsKeys.forEach(function (eachMethod) {
				let apiData = methods[eachMethod];
				
				if (!all_apis[eachMethod]) {
					all_apis[eachMethod] = {};
				}
				
				var mwFile = eachPath.replace(/\\/g, "_").replace(/:/g, "_").replace(/\//g, "_").replace(/[_]{2,}/g, "_").replace(/{/g, "").replace(/}/g, "");
				mwFile = mwFile.toLowerCase();
				if (mwFile[0] === "_") {
					mwFile = mwFile.substring(1);
				}
				mwFile += "_" + eachMethod.toLowerCase() + ".js";
				
				all_apis[eachMethod][eachPath] = {
					_apiInfo: {},
					"mw": '%dirname% + "/lib/mw/' + mwFile + '"'
				};
				let newSoajsApi = all_apis[eachMethod][eachPath];
				
				let params = apiData.parameters;
				
				let group = apiData.tags ? apiData.tags[0] : "";
				newSoajsApi._apiInfo.group = group && group !== '' ? group : "general";
				newSoajsApi._apiInfo.l = apiData.summary;
				newSoajsApi.imfv = convertParams(convertedDefinitions, convertedParameters, params);
			});
		});
		
		// todo: convert errors
		
		return cb({"schema": all_apis, "errors": all_errors});
	}
563525
function applyLodashFp(fn, { arity = fn.length, fixedArity = false } = {}) {
  return apply(
    lodashFpConvert(fn),
    {
      arity,
      fixedArity,
    },
  )
}
1091104
function(template_data, template_name) {
        var precompiled_template,
            regex = /{([^{}]*)}/g;

        // replace double quotes with single quotes
        precompiled_template = template_data.replace(/\"/g, "'");

        // split each line, enclose in double quotes & join them using + sign
        precompiled_template = precompiled_template.split("\n").map(
          function(line) {
            return '"' + line.trim() + '"';
          }).join(" \t+\n ");

        // replace the curly braces with the variables
        precompiled_template = precompiled_template.replace(
          regex, function(a, b) {
            return '" + data.' + b + ' + "';
          });

        return "(function() {\n\t" +
                  "window." + template_namespace + ' = window.' + template_namespace + ' || {};\n\t' +
                  template_namespace + '["' + template_name + '"] = ' + 'function(data) {\n\t\t' +
                    'return ' + precompiled_template + ';\n\t' +
                  '};\n' +
                '})();';
      }
906803
function t (template, data) {
    for (var key in data) {
      template = template.replace(new RegExp('{' + key + '}', 'g'), data[key] || '')
    }
    return template
  }
86706
private void prepTemplatePlaceholders(Node fn) {
    final List<String> locals = templateLocals;
    final List<String> params = templateParams;
    final Map<String, JSType> paramTypes = new HashMap<>();

    // drop the function name so it isn't include in the name maps
    String fnName = fn.getFirstChild().getString();
    fn.getFirstChild().setString("");

    // Build a list of parameter names and types.
    Node templateParametersNode = fn.getSecondChild();
    JSDocInfo info = NodeUtil.getBestJSDocInfo(fn);
    if (templateParametersNode.hasChildren()) {
      Preconditions.checkNotNull(info,
          "Missing JSDoc declaration for template function %s", fnName);
    }
    for (Node paramNode : templateParametersNode.children()) {
      String name = paramNode.getString();
      JSTypeExpression expression = info.getParameterType(name);
      Preconditions.checkNotNull(expression,
          "Missing JSDoc for parameter %s of template function %s",
          name, fnName);
      JSType type = typeRegistry.evaluateTypeExpressionInGlobalScope(expression);
      checkNotNull(type);
      params.add(name);
      paramTypes.put(name, type);
    }

    // Find references to string literals, local variables and parameters and replace them.
    traverse(
        fn,
        new Visitor() {
          @Override
          public void visit(Node n) {
            if (n.isName()) {
              Node parent = n.getParent();
              String name = n.getString();
              if (!name.isEmpty() && parent.isVar() && !locals.contains(name)) {
                locals.add(n.getString());
              }

              if (params.contains(name)) {
                JSType type = paramTypes.get(name);
                boolean isStringLiteral =
                    type.isStringValueType() && name.startsWith("string_literal");
                replaceNodeInPlace(
                    n, createTemplateParameterNode(params.indexOf(name), type, isStringLiteral));
              } else if (locals.contains(name)) {
                replaceNodeInPlace(n, createTemplateLocalNameNode(locals.indexOf(name)));
              }
            }
          }
        });
  }
1267687
function compile(fileNames, options, verbose) {
  const program = ts.createProgram(fileNames, options)
  const emitResult = program.emit()

  /* istanbul ignore next */
  if (verbose) {
    const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics)

    allDiagnostics.forEach((diagnostic) => {
      if (diagnostic.file) {
        const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(
          diagnostic.start
        )
        const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
        console.log(
          `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
        )
      } else {
        console.log(`${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`)
      }
    })
  }
}
1146148
function compile (str, options) {
    var id;
    var render;

    str = str || EMPTY;
    options = options || {};

    id = options.id || str;

    render = eoraptor[id];
    if (render) {
        return render;
    }

    var oTag = options.oTag || OTAG;
    var cTag = options.cTag || CTAG;

    var code = build(parse(str, oTag, cTag));

    render = function (data) {
        var result;
        try {

            result = new Function('data', codePrefix + code)(data);
        } catch(err) {
            console.error('"' +err.message + '" from data and tpl below:');
            console.log(data);
            console.log(str);
        }
        return result;
    };

    render.render = render;
    render.source = 'function (data) {\n' + code + '\n}';
    return eoraptor[id] = render;
}
1270303
function renderString(templateString, options, callback) {
  var template = builtTemplateFromString(templateString, '', options);
  return template.render({ model: options, }, callback);
}