Path to the environment python
547457
def python(self):
        """"""
        py = vistir.compat.Path(self.base_paths["scripts"]).joinpath("python").absolute().as_posix()
        if not py:
            return vistir.compat.Path(sys.executable).as_posix()
        return py
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
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
1069567
def load_env_file():
    
    if not os.path.exists(ENV_FILE):
        return

    for line in open(ENV_FILE, 'r'):
        line = line.strip()
        if not line:
            continue
        name, value = line.split('=', 1)
        if not name or not value or name.startswith('#') or len(name) == 0 or name.isspace():
            continue
        if re.match(r'^(["\']).*\1$', value):
            if value.startswith('"'):
                value = os.path.expandvars(value)
            value = value[1:-1]
        os.environ[name] = value
618574
def start_env(environment, path):
    
    parser = read_config()

    if environment not in parser.sections():
        print("Unknown environment type '%s'" % environment)
        return

    if path and not os.path.isdir(path):
        try:
            os.makedirs(path)
        except os.error:
            print("Could not create directory structure")
            return

    init_path = path if path else os.getcwd()

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

    print("Working in directory: " + init_path)

    for cmd in commands:
        proc = subprocess.Popen(cmd , cwd=init_path, shell=True)
        proc.wait()

    print("Initialized '%s' environment" % environment)
438612
def _environment_variables() -> Dict[str, str]:
    
    return {key: value
            for key, value in os.environ.items()
            if _is_encodable(value)}
1279798
function (str) {
        if (!str) {
            return str;
        }
        if (str.substr(0,1) === '~') {
            str = process.env.HOME + str.substr(1);
        }
        return path.resolve(str);
    }
1243723
def setup_path(self):
        """"""
        path = self.opts.path or self.config['crony'].get('path')
        if path:
            self.logger.debug(f'Adding {path} to PATH environment variable')
            self.cmd = f'export PATH={path}:$PATH && {self.cmd}'
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'])
829777
def get_config_path():
    """"""
    dir_path = (os.getenv('APPDATA') if os.name == "nt"
                else os.path.expanduser('~'))
    return os.path.join(dir_path, '.vtjp')
1103188
def path(self):
    """"""
    if self._root_dir is None:
      # This env variable is for testing purpose.
      override_buildroot = os.environ.get('PANTS_BUILDROOT_OVERRIDE', None)
      if override_buildroot:
        self._root_dir = override_buildroot
      else:
        self._root_dir = os.path.realpath(self.find_buildroot())
      if PY2:
        self._root_dir = self._root_dir.decode('utf-8')
    return self._root_dir
988925
def setup_environment_from_config_file():
    

    from os.path import exists

    config_file = get_config_file()

    if not exists(config_file):
        return

    try:
        config = _ConfigParser.SafeConfigParser()
        config.read(config_file)

        __section = "Environment"

        if config.has_section(__section):
            items = config.items(__section)

            for k, v in items:
                try:
                    os.environ[k.upper()] = v
                except Exception as e:
                    print(("WARNING: Error setting environment variable "
                           "'%s = %s' from config file '%s': %s.")
                          % (k, str(v), config_file, str(e)) )
    except Exception as e:
        print("WARNING: Error reading config file '%s': %s." % (config_file, str(e)))
770283
def _include_paths_from_environ(env_prefix=''):
    """"""
    paths = os.environ.get(env_prefix + 'WSGI_AUTH_PATHS')
    if not paths:
        return []
    return paths.split(';')
884851
def path(self):
        
        if self.parent is None:
            return "/"
        else:
            return os.path.join(self.parent.path, self.name)
475665
def go_to_ve():
    
    # two options are possible
    if not path.abspath(sys.prefix) == VE_ROOT:
        # Option A: we are in the parental process that was called from command line like
        # $> ./launch.py start PROCESS_NAME
        # in this case sys.prefix points to Global Interpreter
        python = get_python()
        retcode = subprocess.call([python, __file__] + sys.argv[1:])
        sys.exit(retcode)
    else:
        # Option B: we have already followed Option A and instantiated Virtual Environment command
        # This mean that sys.prefix points to Virtual Environment
        pass
559445
def _read_from_paths():
    
    home = os.environ.get("HOME", "")
    home_path = os.path.join(home, _SETTINGS_PATH)
    etc_path = os.path.join("/etc", _SETTINGS_PATH)
    env_path = os.environ.get("SETTINGS_PATH", "")

    read_path = None
    if env_path and os.path.exists(env_path):
        read_path = env_path
    elif home and os.path.exists(home_path):
        read_path = home_path
    elif os.path.exists(etc_path):
        read_path = etc_path

    if not read_path:
        return "{}"

    with open(read_path) as f:
        return f.read()
1023844
def environment_context_path(cls, project, environment, user, session,
                                 context):
        """"""
        return google.api_core.path_template.expand(
            'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}',
            project=project,
            environment=environment,
            user=user,
            session=session,
            context=context,
        )