Replaces Node-style environment variables with plain strings.
343251
function inlineNodeEnvironmentVariables(data) {
	var dependencyGraph = data.graph;
	var configuration = data.configuration;
	var options = configuration.options;

	if (options.envify) {
		winston.info("Inlining Node-style environment variables...");
		envifyGraph(dependencyGraph, options);
		envifyGraph(data.configGraph, options);
	}

	return data;
}
991409
function replaceInString(string, variables) {
    const model = createModel(string);
    let offset = 0;
    let output = '';

    for (let i = 0, il = model.variables.length; i < il; i++) {
        const v = model.variables[i];
        let value = v.name in variables ? variables[v.name] : v.name;
        if (typeof value === 'function') {
            value = value(model.string, v, offset + v.location);
        }

        output += model.string.slice(offset, v.location) + value;
        offset = v.location + v.length;
    }

    return output + model.string.slice(offset);
}
373824
def expandvars(path):
    

    path = path2fsn(path)

    def repl_func(match):
        return environ.get(match.group(1), match.group(0))

    path = re.compile(r"\$(\w+)", flags=re.UNICODE).sub(repl_func, path)
    if os.name == "nt":
        path = re.sub(r"%([^%]+)%", repl_func, path)
    return re.sub(r"\$\{([^\}]+)\}", repl_func, path)
319778
public static String replaceAllVariables(String strVars, DriverRequest request) {
        String result = strVars;
        if (VariablesResolver.containsVariable(strVars)) {
            Matcher matcher = VAR_PATTERN.matcher(strVars);

            while (matcher.find()) {
                String group = matcher.group();
                String var = group.substring(2, group.length() - 1);
                String arg = null;

                // try to find argument
                int argIndex = var.indexOf('{');
                if (argIndex != -1) {
                    arg = VarUtils.removeSimpleQuotes(var.substring(argIndex + 1, var.indexOf('}')));
                }

                // try to find default value
                // ESI 1.0 spec :
                // 4.2 Variable Default Values
                // Variables whose values are empty, nonexistent variables and
                // undefined substructures of variables will evaluate to an
                // empty string when they are accessed.
                String defaultValue = StringUtils.EMPTY;
                int defaultValueIndex = var.indexOf('|');
                if (defaultValueIndex != -1) {
                    defaultValue = VarUtils.removeSimpleQuotes(var.substring(defaultValueIndex + 1));
                }

                String value = getProperty(var, arg, request);

                if (value == null) {
                    value = defaultValue;
                }

                result = result.replace(group, value);

            }

        }
        return result;
    }
438612
def _environment_variables() -> Dict[str, str]:
    
    return {key: value
            for key, value in os.environ.items()
            if _is_encodable(value)}
316116
def _replace_global_vars(xs, global_vars):
    
    if isinstance(xs, (list, tuple)):
        return [_replace_global_vars(x) for x in xs]
    elif isinstance(xs, dict):
        final = {}
        for k, v in xs.items():
            if isinstance(v, six.string_types) and v in global_vars:
                v = global_vars[v]
            final[k] = v
        return final
    else:
        return xs
1156609
def __replace_base_variables(text, req_len, idx):
        
        return text \
            .replace("{i}", str(idx + 1)) \
            .replace("{n}", str(req_len))
519058
private String replaceVariablesWithPatterns(String pattern) {
        int group = 0;
        Matcher findVariablesMatcher = variablePattern.matcher(pattern);
        while(findVariablesMatcher.find()) {
            String variable = findVariablesMatcher.group(0);
            pattern = pattern.replaceFirst(variable, "(.+)");
            variableToGroupNumber.put(variable, ++group);
        }
        return pattern;
    }
1330909
function replacementForNode (node) {
  var rule = this.rules.forNode(node)
  var content = process.call(this, node)
  var whitespace = node.flankingWhitespace
  if (whitespace.leading || whitespace.trailing) content = content.trim()
  return (
    whitespace.leading +
    rule.replacement(content, node, this.options) +
    whitespace.trailing
  )
}
223602
protected function replaceVariables(string $value): string
    {
        foreach ($this->env as $keyEnv => $valueEnv) {
            $value = \str_replace('$' . $keyEnv, $valueEnv, $value);
        }

        if (\mb_strpos($value, '$') !== false) {
            throw new EnvironmentException(\sprintf('Missing variable in value %s', $value));
        }

        return $value;
    }
155757
def env(*vars, **kwargs):
    
    for v in vars:
        value = os.environ.get(v)
        if value:
            return value
    return kwargs.get('default', '')
383680
def _slice_replace(code, index, old, new):
        """"""
        nodes = [str(node) for node in code.get(index)]
        substring = "".join(nodes).replace(old, new)
        code.nodes[index] = parse_anything(substring).nodes
1124499
function replacePositionalVariables(command) {
  return command.replace(/\$(\d)/g, (match, number) => {
    return process.argv[number]
  })
}
560448
def update_environment_variables(self, filename):
        """"""
        self.env.update({'PIPELINE_BASH_FILE_ORIGINAL': filename})
        filename = os.path.join('/root/scripts', os.path.basename(filename))
        self.env.update({'PIPELINE_BASH_FILE': filename})

        # remove those keys for Docker since the paths inside Docker are different
        os_environ = os.environ.copy()
        for remove_variable in ['PATH', 'PYTHONPATH', 'JAVA_HOME', 'HOME']:
            os_environ.pop(remove_variable, None)

        self.env.update(os_environ)
1230701
function replace(pattern, replacement, val){
  utils.assertString(pattern, 'pattern');
  utils.assertString(replacement, 'replacement');
  utils.assertString(val, 'val');
  pattern = new RegExp(pattern.string, 'g');
  var res = val.string.replace(pattern, replacement.string);
  return val instanceof nodes.Ident
    ? new nodes.Ident(res)
    : new nodes.String(res);
}
1251429
def _replace_match(m, env):
    """"""
    # ditch the curly braces
    s = m.group()[1:-1].strip()

    try:
        # get the env attributes e.g. envpython or toxinidir.
        # Note: if you ask for a env methodname this will raise
        # later on... so don't do that.
        return getattr(env, s)
    except AttributeError:
        pass

    for r in [_replace_envvar, _replace_config, _replace_posargs]:
        try:
            return r(s, env)
        except ValueError:
            pass

    raise NotImplementedError("{%s} not understood in tox.ini file." % s)
615860
function(nodePath, state) {
        var replacements = [];

        if ( nodePath.node.source.value.match(/^[\./]/) ) {
          nodePath.node.specifiers.forEach(function(specifier) {
            var expr = getGlobalExpression(
              state,
              removeExtensions(nodePath.node.source.value),
              specifier.imported ? specifier.imported.name : null,
              t.isImportNamespaceSpecifier(specifier)
            );
            replacements.push(t.variableDeclaration('var', [
              t.variableDeclarator(specifier.local, expr)
            ]));
          });
        }
        nodePath.replaceWithMultiple(replacements);
      }