GRAYBYTE WORDPRESS FILE MANAGER5282

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/hc_python/lib/python3.12/site-packages/virtualenv/create/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/lib/python3.12/site-packages/virtualenv/create//pyenv_cfg.py
from __future__ import annotations

import logging
import os
from collections import OrderedDict

LOGGER = logging.getLogger(__name__)


class PyEnvCfg:
    def __init__(self, content, path) -> None:
        self.content = content
        self.path = path

    @classmethod
    def from_folder(cls, folder):
        return cls.from_file(folder / "pyvenv.cfg")

    @classmethod
    def from_file(cls, path):
        content = cls._read_values(path) if path.exists() else OrderedDict()
        return PyEnvCfg(content, path)

    @staticmethod
    def _read_values(path):
        content = OrderedDict()
        for line in path.read_text(encoding="utf-8").splitlines():
            equals_at = line.index("=")
            key = line[:equals_at].strip()
            value = line[equals_at + 1 :].strip()
            content[key] = value
        return content

    def write(self):
        LOGGER.debug("write %s", self.path)
        text = ""
        for key, value in self.content.items():
            normalized_value = os.path.realpath(value) if value and os.path.exists(value) else value
            line = f"{key} = {normalized_value}"
            LOGGER.debug("\t%s", line)
            text += line
            text += "\n"
        self.path.write_text(text, encoding="utf-8")

    def refresh(self):
        self.content = self._read_values(self.path)
        return self.content

    def __setitem__(self, key, value) -> None:
        self.content[key] = value

    def __getitem__(self, key):
        return self.content[key]

    def __contains__(self, item) -> bool:
        return item in self.content

    def update(self, other):
        self.content.update(other)
        return self

    def __repr__(self) -> str:
        return f"{self.__class__.__name__}(path={self.path})"


__all__ = [
    "PyEnvCfg",
]

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 04 2025 08:00:22
root / root
0755
__pycache__
--
April 04 2025 08:00:23
root / root
0755
via_global_ref
--
April 04 2025 08:00:23
root / root
0755
__init__.py
0 KB
April 04 2025 08:00:22
root / root
0644
creator.py
8.989 KB
April 04 2025 08:00:22
root / root
0644
debug.py
3.075 KB
April 04 2025 08:00:22
root / root
0644
describe.py
3.08 KB
April 04 2025 08:00:22
root / root
0644
pyenv_cfg.py
1.782 KB
April 04 2025 08:00:22
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF