Print environment variables.
2296
def cli(env):
    """"""
    filtered_vars = dict([(k, v)
                          for k, v in env.vars.items()
                          if not k.startswith('_')])
    env.fout(formatting.iter_to_table(filtered_vars))
529498
def docker_environment(env):
    
    return ' '.join(
        ["-e \"%s=%s\"" % (key, value.replace("$", "\\$").replace("\"", "\\\"").replace("`", "\\`"))
         for key, value in env.items()])
445196
def show_env():
    '''
    
    '''
    envs = ['PATH', 'ORACLE_HOME', 'TNS_ADMIN', 'NLS_LANG']
    result = {}
    for env in envs:
        if env in os.environ:
            result[env] = os.environ[env]
    return result
878108
def environment_variable(key, value):
    

    if key not in os.environ:
        previous = None
    else:
        previous = os.environ[key]

    os.environ[key] = value

    yield

    if previous is None:
        del os.environ[key]
    else:
        os.environ[key] = previous
308869
def write_properties_from_env(cls, path):
        '''
        
        '''
        with open(path, 'w') as f:
            f.write("# Autogenerated by kclboot v%s on %s\n\n" % (PACKAGE_VERSION, datetime.now()))
            for env_var, prop_var in ENV_TO_PROPERTY.items():
                env_value = os.environ.get(env_var)
                if env_value:
                    f.write("%s=%s\n" % (prop_var, env_value))
828337
def print_settings(settings, depth=0):
    """"""
    # handle the case where a single setting is passed
    if isinstance(settings, Setting):
        settings = [settings]
    for setting in settings:
        cur = setting.currentValue
        print(
            "%s* %s (%s, value: %s, type: %s)"
            % (
                " " * depth,
                setting.title,
                setting.target,
                click.style(cur, bold=True),
                setting.type,
            )
        )
        for opt in setting.candidate:
            if not opt.isAvailable:
                logging.debug("Unavailable setting %s", opt)
                continue
            click.echo(
                click.style(
                    "%s  - %s (%s)" % (" " * depth, opt.title, opt.value),
                    bold=opt.value == cur,
                )
            )
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
270047
def setenv(self, variable, value):
    '''
    '''
    os.environ[variable] = value
    os.putenv(variable, value)
    bot.debug('%s set to %s' % (variable, value))
738772
def from_env_vars(self) -> None:
        """"""
        for key, value in os.environ.items():
            if key.startswith('KUYRUK_'):
                key = key[7:]
                if hasattr(Config, key):
                    try:
                        value = ast.literal_eval(value)
                    except (ValueError, SyntaxError):
                        pass

                    self._setattr(key, value)
915780
def _main():
    """"""
    print('Platform: "%s"' % get_platform())
    print('Python version: "%s"' % get_python_version())
    print('Current installation scheme: "%s"' % _get_default_scheme())
    print()
    _print_dict('Paths', get_paths())
    print()
    _print_dict('Variables', get_config_vars())
1173561
def print_env(k, v)
      if v
        puts @shell_printer.export(k, v)
      else
        puts @shell_printer.unset(k)
      end
    end
198455
def print_env_info(key, out=sys.stderr):
    """"""
    value = os.getenv(key)
    if value is not None:
        print(key, "=", repr(value), file=out)
1355827
def __getVariables(self):
        """'"""
        try:
            startupinfo = None
            if os.name == 'nt':
                startupinfo = subprocess.STARTUPINFO()
                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
            output = subprocess.check_output(['p4', 'set'], startupinfo=startupinfo)
            if six.PY3:
                output = str(output, 'utf8')
        except subprocess.CalledProcessError as err:
            LOGGER.error(err)
            return

        p4vars = {}
        for line in output.splitlines():
            if not line:
                continue
            try:
                k, v = line.split('=', 1)
            except ValueError:
                continue
            p4vars[k.strip()] = v.strip().split(' (')[0]
            if p4vars[k.strip()].startswith('(config'):
                del p4vars[k.strip()]

        self._port = self._port or os.getenv('P4PORT', p4vars.get('P4PORT'))
        self._user = self._user or os.getenv('P4USER', p4vars.get('P4USER'))
        self._client = self._client or os.getenv('P4CLIENT', p4vars.get('P4CLIENT'))
845024
def get_env(name, default=None):
    """"""
    if name in os.environ:
        return os.environ[name]

    if default is not None:
        return default

    error_msg = "Set the {} env variable".format(name)
    raise ImproperlyConfigured(error_msg)
991738
def _format_envvars(ctx):
    """"""
    params = [x for x in ctx.command.params if getattr(x, 'envvar')]

    for param in params:
        yield '.. _{command_name}-{param_name}-{envvar}:'.format(
            command_name=ctx.command_path.replace(' ', '-'),
            param_name=param.name,
            envvar=param.envvar,
        )
        yield ''
        for line in _format_envvar(param):
            yield line
        yield ''
1290790
def _settings_from_env(self):
        """"""
        return {attr: self._val_from_env(env, attr)
                for env, attr in const.ENV_TO_ATTR.items()
                if env in os.environ}
277706
def print_app_info (out=stderr):
    """"""
    print(_("System info:"), file=out)
    print(configuration.App, file=out)
    print(_("Released on:"), configuration.ReleaseDate, file=out)
    print(_("Python %(version)s on %(platform)s") %
                    {"version": sys.version, "platform": sys.platform}, file=out)
    for key in PYTHON_ENV_VARS:
        print_env_info(key, out=out)
    print(configuration.get_modules_info(), file=out)
    stime = strformat.strtime(time.time())
    print(_("Local time:"), stime, file=out)
    print(_("sys.argv:"), sys.argv, file=out)