Replaces any {{env::*}} directives with it's actual environment variable value or a default.

        Args:
            ctx: The processing context.

        Returns:
            Returns the altered node key and value.
324977
def _apply(self, ctx: ExtensionContext) -> AugmentedDict:
        
        node_key, node_value = ctx.node

        def process(pattern: Pattern[str], _str: str) -> str:
            _match = pattern.match(_str)
            if _match is None:
                return _str
            # We got a match
            # Group 0: Whole match; Group 1: Our placeholder; Group 2: The environment variable
            placeholder, envvar = _match.group(1), _match.group(2)
            envvalue = os.environ.get(envvar, None)
            if envvalue is None and self.fail_on_unset:
                raise ExtensionError("Environment variable '{}' is unset.".format(envvar))

            return _str.replace(placeholder, envvalue or self.default)

        _pattern = re.compile(self.__pattern__)
        node_key = process(_pattern, node_key)
        node_value = process(_pattern, node_value)

        return {node_key: node_value}
390754
def _apply(self, ctx: ExtensionContext) -> Any:
        
        _, external_path = ctx.node
        return ctx.mentor.load_yaml(self.locator(
            external_path,
            cast(str, ctx.document) if Validator.is_file(document=ctx.document) else None
        ))
1290413
def override_env_variables():
    """"""
    env_vars = ("LOGNAME", "USER", "LNAME", "USERNAME")
    old = [os.environ[v] if v in os.environ else None for v in env_vars]

    for v in env_vars:
        os.environ[v] = "test"
    yield

    for i, v in enumerate(env_vars):
        if old[i]:
            os.environ[v] = old[i]
794449
def config(ctx):
    
    ctx.default_map = ctx.obj['cfg']
    click.echo("CLI:")
    click.echo("access-token = {0}".format(ctx.obj['access_token']))
    click.echo("verbosity = {0}".format(ctx.obj['verbosity']))
    click.echo("")

    click.echo("Environment:")
    if 'MAPBOX_ACCESS_TOKEN' in os.environ:
        click.echo("MAPBOX_ACCESS_TOKEN = {0}".format(
            os.environ['MAPBOX_ACCESS_TOKEN']))
    if 'MapboxAccessToken' in os.environ:
        click.echo("MapboxAccessToken = {0}".format(
            os.environ['MapboxAccessToken']))
    if 'MAPBOX_VERBOSE' in os.environ:
        click.echo("MAPBOX_VERBOSE = {0}".format(
            os.environ['MAPBOX_VERBOSE']))
    click.echo("")

    if 'config_file' in ctx.obj:
        click.echo("Config file {0}:".format(ctx.obj['config_file']))
        for key, value in ctx.default_map.items():
            click.echo("{0} = {1}".format(key, value))
        click.echo("")
97395
def resolve_ctx(cli, prog_name, args):
    
    ctx = cli.make_context(prog_name, args, resilient_parsing=True)
    args = ctx.protected_args + ctx.args
    while args:
        if isinstance(ctx.command, MultiCommand):
            if not ctx.command.chain:
                cmd_name, cmd, args = ctx.command.resolve_command(ctx, args)
                if cmd is None:
                    return ctx
                ctx = cmd.make_context(cmd_name, args, parent=ctx,
                                       resilient_parsing=True)
                args = ctx.protected_args + ctx.args
            else:
                # Walk chained subcommand contexts saving the last one.
                while args:
                    cmd_name, cmd, args = ctx.command.resolve_command(ctx, args)
                    if cmd is None:
                        return ctx
                    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx,
                                               allow_extra_args=True,
                                               allow_interspersed_args=False,
                                               resilient_parsing=True)
                    args = sub_ctx.args
                ctx = sub_ctx
                args = sub_ctx.protected_args + sub_ctx.args
        else:
            break
    return ctx
1030766
def match(self, *command_tokens, command_context=None, **command_env):
		
		if self.adapter().match(command_context, **command_env) is False:
			return False

		command_tokens = self.adapter().adapt(*command_tokens, command_context=command_context, **command_env)
		return self.original_command().match(*command_tokens, command_context=command_context, **command_env)
651367
function getEnv(key) {
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
}
854550
function _basedirWithContext (ctx) {
  let data = ctx && ctx.data
  let $$bud = data && data.root && data.root[ '$$bud' ] || {}
  return $$bud.cwd || process.cwd()
}
1355278
def with_env(self, **environment_variables):
        
        new_env_vars = {
            str(var): str(val) for var, val in environment_variables.items()
        }
        new_command = copy.deepcopy(self)
        new_command._env.update(new_env_vars)
        return new_command
1338259
def DefaultRC():
    
    xdg = os.path.join(os.path.expanduser('~'), '.config')
    if 'XDG_CONFIG_DIR' in os.environ:
        xdg = os.environ['XDG_CONFIG_DIR']
    xdgfile = os.path.join(xdg, 'cmakelintrc')
    if os.path.exists(xdgfile):
        return xdgfile
    return os.path.join(os.path.expanduser('~'), '.cmakelintrc')
723131
def get_service_env_value(self, key):
        
        service_key = predix.config.get_env_key(self, key)
        value = os.environ[service_key]
        if not value:
            raise ValueError("%s env unset" % key)
        return value
353106
def env(var_name, default=False):
    
    try:
        value = os.environ[var_name]
        if str(value).strip().lower() in ['false', 'f', 'no', 'off' '0', 'none', 'null', '', ]:
            return None
        return value
    except:
        from traceback import format_exc
        msg = "Unable to find the %s environment variable.\nUsing the value %s (the default) instead.\n" % (var_name, default)
        sys.stderr.write(format_exc())
        sys.stderr.write(msg)
        return default
1077248
def as_dict(self, env=None, internal=False):
        
        ctx_mgr = suppress() if env is None else self.using_env(env)
        with ctx_mgr:
            data = self.store.copy()
            # if not internal remove internal settings
            if not internal:
                for name in dir(default_settings):
                    data.pop(name, None)
            return data
1165172
def apply_environment!(hook_context, env)
      skipped_hooks = "#{env['SKIP']} #{env['SKIP_CHECKS']} #{env['SKIP_HOOKS']}".split(/[:, ]/)
      only_hooks = env.fetch('ONLY') { '' }.split(/[:, ]/)
      hook_type = hook_context.hook_class_name

      if only_hooks.any? || skipped_hooks.include?('all') || skipped_hooks.include?('ALL')
        @hash[hook_type]['ALL']['skip'] = true
      end

      only_hooks.select { |hook_name| hook_exists?(hook_context, hook_name) }.
                 map { |hook_name| Overcommit::Utils.camel_case(hook_name) }.
                 each do |hook_name|
        @hash[hook_type][hook_name] ||= {}
        @hash[hook_type][hook_name]['skip'] = false
      end

      skipped_hooks.select { |hook_name| hook_exists?(hook_context, hook_name) }.
                    map { |hook_name| Overcommit::Utils.camel_case(hook_name) }.
                    each do |hook_name|
        @hash[hook_type][hook_name] ||= {}
        @hash[hook_type][hook_name]['skip'] = true
      end
    end
97892
def get_env_key(obj, key=None):
    
    return str.join('_', [obj.__module__.replace('.','_').upper(),
        key.upper()])
788992
def env(key, default=None, required=False):
    
    try:
        value = os.environ[key]
        return ast.literal_eval(value)
    except (SyntaxError, ValueError):
        return value
    except KeyError:
        if default or not required:
            return default
        raise ImproperlyConfigured(
            "Missing required environment variable '%s'" % key)
561030
function flattenContext(template, ctx) {
    var arr, result = {};

    while ((arr = re.exec(template)) !== null) {
        if (arr[1]) {
            var value = reach(ctx, arr[1]);
            result[arr[1]] = value && value.toString();
        }
    }

    return result;
}