Returns cached env names, if present. Otherwise returns None.
553410
def check_env_cache(opts, env_cache):
    '''
    
    '''
    if not os.path.isfile(env_cache):
        return None
    try:
        with salt.utils.files.fopen(env_cache, 'rb') as fp_:
            log.trace('Returning env cache data from %s', env_cache)
            serial = salt.payload.Serial(opts)
            return salt.utils.data.decode(serial.load(fp_))
    except (IOError, OSError):
        pass
    return None
1359060
def _users_from_environ(env_prefix=''):
    """"""
    auth_string = os.environ.get(env_prefix + 'WSGI_AUTH_CREDENTIALS')
    if not auth_string:
        return {}

    result = {}
    for credentials in auth_string.split('|'):
        username, password = credentials.split(':', 1)
        result[username] = password
    return result
254633
def find_kernel_specs_for_envs(self):
        """"""
        data = self._get_env_data()
        return {name: data[name][0] for name in data}
315144
def get_config_env() -> Dict[str, Any]:
    
    if 'PULUMI_CONFIG' in os.environ:
        env_config = os.environ['PULUMI_CONFIG']
        return json.loads(env_config)
    return dict()
135712
def _get_environ_overrides() -> Dict[str, str]:
    
    return {
        ce.name: os.environ['OT_API_' + ce.name.upper()]
        for ce in CONFIG_ELEMENTS
        if 'OT_API_' + ce.name.upper() in os.environ}
1141778
def get_config_filename(metadata):
    
    envvar = "{}__SETTINGS".format(underscore(metadata.name).upper())
    try:
        return environ[envvar]
    except KeyError:
        return None
587023
def get_environments():
    """"""
    envs = []
    for root, subfolders, files in os.walk('environments'):
        for filename in files:
            if filename.endswith(".json"):
                path = os.path.join(
                    root[len('environments'):], filename[:-len('.json')])
                envs.append(get_environment(path))
    return sorted(envs, key=lambda x: x['name'])
779783
def _get_environ_vars(self):
        # type: () -> Iterable[Tuple[str, str]]
        """"""
        for key, val in os.environ.items():
            should_be_yielded = (
                key.startswith("PIP_") and
                key[4:].lower() not in self._ignore_env_names
            )
            if should_be_yielded:
                yield key[4:].lower(), val
1123506
def getenv(name, **kwargs):
    
    default_value = kwargs.pop('default', None)
    desired_type = kwargs.pop('type', str)
    list_separator = kwargs.pop('separator', ',')

    value = os.getenv(name, None)

    if value is None:
        if default_value is None:
            return None
        else:
            return default_value

    if desired_type is bool:
        if value.lower() in ['false', '0']:
            return False
        else:
            return bool(value)

    if desired_type is list or desired_type is tuple:
        value = value.split(list_separator)
        return desired_type(value)

    if desired_type is dict:
        return dict(literal_eval(value))

    return desired_type(value)
1127795
def get_env():
    
    env = os.getenv('ENV', os.getenv('env', None))
    if env:
        env = env.lower()
    return env
1128430
def GetEnvironmentVariable(self, name):
    
    name = name.upper()
    return self._environment_variables.get(name, None)
765402
def get_associations(self, env):
        

        if env.is_root:
            return None

        associations = self.associations.get_all()
        return [assoc for assoc in associations
                if associations[assoc] == self._get_view_path(env)]
742817
def _parse_env(self):
        
        env_cfg = DotDict()

        # if the env prefix doesn't end with '_', we'll append it here
        if self.env_prefix and not self.env_prefix.endswith('_'):
            self.env_prefix = self.env_prefix + '_'

        # if there is no scheme, we won't know what to look for so only parse
        # config if there is a scheme.
        if self.scheme:
            for k, v in self.scheme.flatten().items():
                value = v.parse_env(k, self.env_prefix, self.auto_env)
                if value is not None:
                    env_cfg[k] = value

        if len(env_cfg) > 0:
            # the configuration changes, so we invalidate the cached config
            self._full_config = None
            self._environment.update(env_cfg)
70219
def get_env():
    
    if not __ENV__:
        env = os.environ["env"] if "env" in os.environ else "Dev"
        set_env(env)
    return __ENV__
214409
def get_env():
    ''' 
    '''
    if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
        # PyInstaller uses _MEIPASS and only works with jinja2.FileSystemLoader
        templates_path = join(sys._MEIPASS, 'bokeh', 'core', '_templates')
    else:
        # Non-frozen Python and cx_Freeze can use __file__ directly
        templates_path = join(dirname(__file__), '_templates')

    return Environment(loader=FileSystemLoader(templates_path))
545569
def list_from_env(key, default=""):
    
    try:
        val = os.environ.get(key, default)
        return val.split(',')
    except (KeyError, ValueError):
        return []
899467
def env(self, current_scope):
    
    return self.__env_cache.get(
            current_scope.ident,
            framework.Environment, current_scope,
            names=self.keys(),
            parent=framework.Environment({'self': current_scope}, parent=self.__parent_env))