Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
read_only.py43 linesDownload Raw Back to app_data
1from __future__ import annotations2 3import os.path4 5from virtualenv.util.lock import NoOpFileLock6 7from .via_disk_folder import AppDataDiskFolder, PyInfoStoreDisk8 9 10class ReadOnlyAppData(AppDataDiskFolder):11    can_update = False12 13    def __init__(self, folder: str) -> None:14        if not os.path.isdir(folder):15            msg = f"read-only app data directory {folder} does not exist"16            raise RuntimeError(msg)17        super().__init__(folder)18        self.lock = NoOpFileLock(folder)19 20    def reset(self) -> None:21        msg = "read-only app data does not support reset"22        raise RuntimeError(msg)23 24    def py_info_clear(self) -> None:25        raise NotImplementedError26 27    def py_info(self, path):28        return _PyInfoStoreDiskReadOnly(self.py_info_at, path)29 30    def embed_update_log(self, distribution, for_py_version):31        raise NotImplementedError32 33 34class _PyInfoStoreDiskReadOnly(PyInfoStoreDisk):35    def write(self, content):  # noqa: ARG00236        msg = "read-only app data python info cannot be updated"37        raise RuntimeError(msg)38 39 40__all__ = [41    "ReadOnlyAppData",42]43 
codekingpro/portable-devtools · Team Ai