Get the environment in which halo is running

    Returns
    -------
    str
        Environment name
503588
def get_environment():
    
    try:
        from IPython import get_ipython
    except ImportError:
        return 'terminal'

    try:
        shell = get_ipython().__class__.__name__

        if shell == 'ZMQInteractiveShell':  # Jupyter notebook or qtconsole
            return 'jupyter'
        elif shell == 'TerminalInteractiveShell':  # Terminal running IPython
            return 'ipython'
        else:
            return 'terminal'  # Other type (?)

    except NameError:
        return 'terminal'
1128430
def GetEnvironmentVariable(self, name):
    
    name = name.upper()
    return self._environment_variables.get(name, None)
1127795
def get_env():
    
    env = os.getenv('ENV', os.getenv('env', None))
    if env:
        env = env.lower()
    return env
922313
def get_host(environ):
    
    scheme = environ.get('wsgi.url_scheme')
    if 'HTTP_X_FORWARDED_HOST' in environ:
        result = environ['HTTP_X_FORWARDED_HOST']
    elif 'HTTP_HOST' in environ:
        result = environ['HTTP_HOST']
    else:
        result = environ['SERVER_NAME']
        if (scheme, str(environ['SERVER_PORT'])) not \
           in (('https', '443'), ('http', '80')):
            result += ':' + environ['SERVER_PORT']
    if result.endswith(':80') and scheme == 'http':
        result = result[:-3]
    elif result.endswith(':443') and scheme == 'https':
        result = result[:-4]
    return result
128247
def get_environ(self):
        """"""
        req = self.req
        env_10 = WSGIGateway_10.get_environ(self)
        env = dict([(k.decode('ISO-8859-1'), v) for k, v in env_10.iteritems()])
        env[u'wsgi.version'] = ('u', 0)
        
        # Request-URI
        env.setdefault(u'wsgi.url_encoding', u'utf-8')
        try:
            for key in [u"PATH_INFO", u"SCRIPT_NAME", u"QUERY_STRING"]:
                env[key] = env_10[str(key)].decode(env[u'wsgi.url_encoding'])
        except UnicodeDecodeError:
            # Fall back to latin 1 so apps can transcode if needed.
            env[u'wsgi.url_encoding'] = u'ISO-8859-1'
            for key in [u"PATH_INFO", u"SCRIPT_NAME", u"QUERY_STRING"]:
                env[key] = env_10[str(key)].decode(env[u'wsgi.url_encoding'])
        
        for k, v in sorted(env.items()):
            if isinstance(v, str) and k not in ('REQUEST_URI', 'wsgi.input'):
                env[k] = v.decode('ISO-8859-1')
        
        return env
90015
def _get_envvar_value(self):
        
        envvar_name = None

        if self.envvar is True:
            envvar_name = self.envvar_name
            if envvar_name is None:
                envvar_name = '_'.join(self.get_path()).upper()
        elif self.envvar:
            envvar_name = self.envvar

        if envvar_name and envvar_name in os.environ:
            return self.type.deserialize(os.environ[envvar_name])
        else:
            return not_set
1295257
def get_environ_list(name, default=None):
    
    packed = os.environ.get(name)
    if packed is not None:
        return packed.split(':')
    elif default is not None:
        return default
    else:
        return []
949767
def get_environ(cls, prefix):
        
        return ((key[len(prefix) + 1:], value)
                for key, value in os.environ.items()
                if key.startswith('%s_' % prefix))
879673
def get_env(name):
    ""
    res = os.environ.get(name,'')
    return res if len(res) else "Unknown"
439748
def env(self, **kw):
        '''
        
        '''
        self._original_env = kw
        if self._env is None:
            self._env = dict(os.environ)
        self._env.update({k: unicode(v) for k, v in kw.iteritems()})
        return self
1197371
def env(self):
        
        env_vars = os.environ.copy()
        env_vars.update(self._env)
        new_path = ":".join(
            self._paths + [env_vars["PATH"]] if "PATH" in env_vars else [] + self._paths
        )
        env_vars["PATH"] = new_path
        for env_var in self._env_drop:
            if env_var in env_vars:
                del env_vars[env_var]
        return env_vars
1252417
def get_settings_from_environment(environ):
    ''''''
    settings = {}
    for name, value in environ.items():
        if not name.startswith('DJANGO_'):
            continue
        name = name.replace('DJANGO_', '', 1)
        if _ignore_setting(name):
            continue
        try:
            settings[name] = ast.literal_eval(value)
        except (SyntaxError, ValueError) as err:
            LOGGER.warn("Unable to parse setting %s=%s (%s)", name, value, err)
    return settings
128967
def get(self):
        

        self._cast = type([])
        source_value = os.getenv(self.env_name)

        # set the environment if it is not set
        if source_value is None:
            os.environ[self.env_name] = json.dumps(self.default)
            return self.default

        try:
            val = json.loads(source_value)
        except JSONDecodeError as e:
            click.secho(str(e), err=True, color='red')
            sys.exit(1)
        except ValueError as e:
            click.secho(e.message, err=True, color='red')
            sys.exit(1)

        if self.validator:
            val = self.validator(val)

        return val
1325307
public String getEnvironment(){
        String env = "development";

        if(!blank(System.getenv("ACTIVE_ENV"))){
            env = System.getenv("ACTIVE_ENV");
        }

        if(!blank(System.getProperty("active_env"))){
            env = System.getProperty("active_env");
        }
        return env;
    }
344529
def get_xdg_env(env_name, fallback):
    
    env = os.environ.get(env_name)
    return env if env else fallback
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'])
974147
def read_windows_environ():
    

    res = winapi.GetEnvironmentStringsW()
    if not res:
        raise ctypes.WinError()

    res = ctypes.cast(res, ctypes.POINTER(ctypes.c_wchar))

    done = []
    current = u""
    i = 0
    while 1:
        c = res[i]
        i += 1
        if c == u"\x00":
            if not current:
                break
            done.append(current)
            current = u""
            continue
        current += c

    dict_ = {}
    for entry in done:
        try:
            key, value = entry.split(u"=", 1)
        except ValueError:
            continue
        key = _norm_key(key)
        dict_[key] = value

    status = winapi.FreeEnvironmentStringsW(res)
    if status == 0:
        raise ctypes.WinError()

    return dict_