replace predefined variables, the format is #{name}
491777
def _pre_var(self, value):
        

        def sub_(m):
            return self._pre_variables.get(m.group()[2:-1].strip(), '')

        return r_pre_var.sub(sub_, value)
144288
function toGetVariableLiteral(name) {
        name = name.replace(/^\s*\*/, '');
        return stringFormat(
            'gv({0},["{1}"])',
            stringLiteralize(name),
            name.replace(
                    /\[['"]?([^'"]+)['"]?\]/g,
                    function (match, name) {
                        return '.' + name;
                    }
                )
                .split('.')
                .join('","')
        );
    }
366434
function replaceFn(name, args, content) {
    var newContent = '';
    var oneVarRE = /(\$\w+)/g;
    var variableRE = /(\$\w+)([\+\-\*/@])/g;
    var content = removeSpace(content);
    // to get '$a' in the end of a content string beacuse of my bad Reg
    content = content + '@';
    var length = args.length;

    if (length) {
        if(length === 1) {
            content = content.replace(oneVarRE, args[0]);
        } else {
            var i = 0;
            var replacer = function(str, $1, $2) {
                if(args[i]){
                    return args[i++] + $2;
                } else {
                    return str;
                }

            }
            content = content.replace(variableRE, replacer);
        }

    } else {
        // no params
        content = content;
    }
    // delete '@'
    newContent = content.substr(0, content.length - 1);



    return newContent;
}
1207394
def variablename(var):
    
    s=[tpl[0] for tpl in itertools.ifilter(lambda x: var is x[1], globals().items())]
    s=s[0].upper()
    return s
904823
function replaceParams(ast, keys) {
  Object.keys(ast)
    .filter(key => {
      const value = ast[key]
      return Array.isArray(value) || (typeof value === 'object' && value !== null)
    })
    .forEach(key => {
      const expr = ast[key]

      if (!(typeof expr === 'object' && expr.type === 'param')) return replaceParams(expr, keys)

      if (typeof keys[expr.value] === 'undefined') throw new Error(`no value for parameter :${expr.value} found`)
      ast[key] = createValueExpr(keys[expr.value])
      return null
    })

  return ast
}
328453
def format_unix_var(text):
    
    text = text.strip()
    if len(text) == 0:  # if empty string, return it
        raise ValueError("can not be empty string!")
    else:
        if text[0] in string.digits:
            raise ValueError("variable can not start with digits!")
        text = text.lower()
        # delete redundant empty space
        words = list()
        word = list()
        for char in text:
            if char in ALPHA_DIGITS:
                word.append(char)
            else:
                if len(word):
                    words.append("".join(word))
                    word = list()
        if len(word):
            words.append("".join(word))

        return "_".join(words)
549389
def FormatNameToPython(i):
    

    i = i.replace("<", "")
    i = i.replace(">", "")
    i = i.replace("$", "_")

    return i
1321597
function fixVarNames(varObj = {}) {
    const reLeadingHyphens = /^-{2}/;

    return Object.keys(varObj).reduce((obj, value) => {
        const key = reLeadingHyphens.test(value) ? value : `--${value.replace(/^-+/, '')}`;

        obj[key] = varObj[value];

        return obj;
    }, {});
}
557046
def fix_var_name(var_name):
    """"""
    name = var_name.strip()
    for char in '(). /#,':
        name = name.replace(char, '_')
    name = name.replace('+', 'pos_')
    name = name.replace('-', 'neg_')
    if name.endswith('_'):
        name = name[:-1]
    return name
836072
function formatStr(str, values) {
    values = values || {};

    if (typeof str !== 'string') {
        return str;
    }

    return str.replace(FORMAT_REGEXP, (m0, m1, m2) => (m1 === '%' ? "%{" + m2 + "}" : values[m2]));
}
478085
def convertVariable(self, key, varName, varValue):
        """"""
        if isinstance(varValue, encapsulation.FunctionEncapsulation):
            result = varValue.getFunction()

            # Update the global scope of the function to match the current module
            mainModule = sys.modules["__main__"]
            result.__name__ = varName
            result.__globals__.update(mainModule.__dict__)
            setattr(mainModule, varName, result)
            shared.elements[key].update({
                varName: result,
            })
1329139
function str_replace(names, values, str) {
  names.forEach((name, idx) => {
    str = str.replace(names[idx], values[idx]);
  });
  return str;
}
147186
def transform_file_name(file)
			if @bind
				variables = file.scan(/{{([^}]*)}}/).flatten

				variables.each do |v|
					file.sub!("{{#{v}}}", @bind.get_binding.eval(v))
				end
			end

			(!@nomodify && file.end_with?(".erb") && !File.directory?(file)) ? File.basename(file, ".*") : file
		end
1299190
private static String replacePlaceholders(String containerNamePattern, String imageName, String nameAlias, Date buildTimestamp) {

        Map<String, FormatParameterReplacer.Lookup> lookups = new HashMap<>();

        lookups.put("a", () -> nameAlias);
        lookups.put("n", () -> cleanImageName(imageName));
        lookups.put("t", () -> String.valueOf(buildTimestamp.getTime()));
        lookups.put("i", () -> INDEX_PLACEHOLDER);

        return new FormatParameterReplacer(lookups).replace(containerNamePattern);
    }
852401
function transformVariables(source, dest) {
        var xformed, arrayVals;

        if (dest === undefined) {
            xformed = {};
        }
        else {
            xformed = dest;
        }

        $.each(source, function(prop, val) {
            if (val instanceof $) {
                xformed[prop] = val[0];
            }
            else if ($.isPlainObject(val)) {
                xformed[prop] = {};
                transformVariables(val, xformed[prop]);
            }
            else if ($.isArray(val)) {
                arrayVals = [];
                $.each(val, function(idx, arrayVal) {
                    if (arrayVal instanceof $) {
                        $.merge(arrayVals, arrayVal);
                    }
                    else {
                        arrayVals.push(arrayVal);
                    }
                });
                xformed[prop] = arrayVals;
            }
            else {
                xformed[prop] = val;
            }
        });

        if (dest === undefined) {
            return xformed;
        }
    }
819727
function variables(root, config, done) {
  var expression = /\$v\[(.+?)\]/g;
  each(Object.keys(root), function(key, next) {
    var value = root[key];
    if (typeof value === 'object') return variables(value, config, next);
    if (typeof value !== 'string') return next();
    root[key] = value.replace(expression, function(match, matchKey) {
      return config[matchKey] || match;
    });
    next();
  }, done);
}
43872
def clean_key(cls, key):
        
        for var_re in cls.VARIABLE_RES:
            key = var_re.sub('#', key)
        return key