PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/alt/python37/lib/python3.7/site-packages/virtualenv/app_data/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/alt/python37/lib/python3.7/site-packages/virtualenv/app_data/__init__.py

"""
Application data stored by virtualenv.
"""
from __future__ import absolute_import, unicode_literals

import logging
import os

from platformdirs import user_data_dir

from .na import AppDataDisabled
from .read_only import ReadOnlyAppData
from .via_disk_folder import AppDataDiskFolder
from .via_tempdir import TempAppData


def _default_app_data_dir(env):
    key = str("VIRTUALENV_OVERRIDE_APP_DATA")
    if key in env:
        return env[key]
    else:
        return user_data_dir(appname="virtualenv", appauthor="pypa")


def make_app_data(folder, **kwargs):
    read_only = kwargs.pop("read_only")
    env = kwargs.pop("env")
    if kwargs:  # py3+ kwonly
        raise TypeError("unexpected keywords: {}")

    if folder is None:
        folder = _default_app_data_dir(env)
    folder = os.path.abspath(folder)

    if read_only:
        return ReadOnlyAppData(folder)

    if not os.path.isdir(folder):
        try:
            os.makedirs(folder)
            logging.debug("created app data folder %s", folder)
        except OSError as exception:
            logging.info("could not create app data folder %s due to %r", folder, exception)

    if os.access(folder, os.W_OK):
        return AppDataDiskFolder(folder)
    else:
        logging.debug("app data folder %s has no write access", folder)
        return TempAppData()


__all__ = (
    "AppDataDisabled",
    "AppDataDiskFolder",
    "ReadOnlyAppData",
    "TempAppData",
    "make_app_data",
)