Determine the environment from the provided options and the
NODE_ENV environment variable. Also normalize the environment
name such that "prod" becomes "production" and "dev" becomes
"development".
519842
function getEnvironment (options) {
  var env;

  if (options.environment) {
    env = options.environment;
  } else {
    env = process.env.NODE_ENV;
  }

  if (env) {
    if (env === 'prod') {
      env = 'production';
    } else if (env === 'dev') {
      env = 'development';
    }
  } else {
        // Default to "development"
    env = 'development';
  }

  return env;
}
599248
def get_environment_paths(config, env):
    
    if env is None:
        return config.get(Config.DEFAULTS, 'environment')

    # Config option takes precedence over environment key.
    if config.has_option(Config.ENVIRONMENTS, env):
        env = config.get(Config.ENVIRONMENTS, env).replace(' ', '').split(';')
    else:
        env = os.getenv(env)
        if env:
            env = env.split(os.pathsep)
    return [i for i in env if i]
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)
1111466
private function set_up_environment() {
		if ( $this->it_has( 'environment' ) ) {
			$this->environment = $this->options['environment'];
		} else {
			$this->environment = defined( 'WP_DEBUG' ) && WP_DEBUG
				? 'development'
				: 'production';
		}
	}
1127795
def get_env():
    
    env = os.getenv('ENV', os.getenv('env', None))
    if env:
        env = env.lower()
    return env
960247
def show_env(environment):
    
    if not environment:
        print("You need to supply an environment name")
        return

    parser = read_config()

    try:
        commands = parser.get(environment, "cmd").split("\n")

    except KeyError:
        print("Unknown environment type '%s'" % environment)
        return

    print("Environment: %s\n" % environment)

    for cmd in commands:
        print(cmd)
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
517483
def get_environment(self):
        '''
        
        '''
        env = {}
        if self.http:
            env['http_proxy'] = env['HTTP_PROXY'] = self.http
        if self.https:
            env['https_proxy'] = env['HTTPS_PROXY'] = self.https
        if self.ftp:
            env['ftp_proxy'] = env['FTP_PROXY'] = self.ftp
        if self.no_proxy:
            env['no_proxy'] = env['NO_PROXY'] = self.no_proxy
        return env
617468
def guess_python_env():
    """"""
    version, major, minor = get_version_info()
    if 'PyPy' in version:
        return 'pypy3' if major == 3 else 'pypy'
    return 'py{major}{minor}'.format(major=major, minor=minor)
1042726
function init(){

    // set NODE_ENV to --env value
    if (argv.env) {
        set('NODE_ENV', argv.env);
    }

    // load evironment files
    ['./.env', './config/.env', './env', './config/env'].map(file => {

        try {

            load(file);

        } catch(err) {

            if (env('DEBUG')) {
                console.error(`Env: ${err.message}`);
            }

        }

    });

    // set default vars
    set('NODE_ENV', 'development');

    ['DEVELOPMENT', 'PRODUCTION'].map(str => {
        set(str, get('NODE_ENV') === str.toLowerCase());
    });

}
56328
def validate_options(node, options, environments)
      if options =~ /-E/ # check for environments
        env = options.split("-E")[1].split[0]
        unless environments.member?(env)
          STDERR.puts "ERROR: '#{node}' environment '#{env}' is missing from the list of environments in the manifest."
          exit(-1)
        end
      end
    end
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
10774
def getenv(option, default=undefined, cast=undefined):
    

    # We can't avoid __contains__ because value may be empty.
    if option in os.environ:
        value = os.environ[option]
    else:
        if isinstance(default, Undefined):
            raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))

        value = default

    if isinstance(cast, Undefined):
        return value

    if cast is bool:
        value = _cast_boolean(value)
    elif cast is list:
        value = [x for x in value.split(',') if x]
    else:
        value = cast(value)

    return value
1202225
def from_env(cls):
        """"""
        token = getenv(cls.TOKEN_ENV_VAR)
        if token is None:
            msg = 'missing environment variable: {!r}'.format(cls.TOKEN_ENV_VAR)
            raise ValueError(msg)
        return cls(api_token=token)
9703
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str:
        
        return str(self.get_or_create_venv(repo_path).resolve() / "bin" / "python")
1062556
def env_info():
    '''
    
    '''
    v = sys.version_info
    pyver = f'Python {v.major}.{v.minor}.{v.micro}'
    if v.releaselevel == 'alpha':
        pyver += 'a'
    if v.releaselevel == 'beta':
        pyver += 'b'
    if v.releaselevel == 'candidate':
        pyver += 'rc'
    if v.releaselevel != 'final':
        pyver += str(v.serial)
    return f'{pyver} (env: {sys.prefix})'
879673
def get_env(name):
    ""
    res = os.environ.get(name,'')
    return res if len(res) else "Unknown"