403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.144.4.4
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/cloudlinux/venv/lib64/python3.11/site-packages/setoptconf/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/cloudlinux/venv/lib64/python3.11/site-packages/setoptconf/config.py
from .exception import MissingRequiredError, ReadOnlyError


__all__ = ("Configuration",)


class Configuration:
    def __init__(self, settings, parent=None):
        self.__dict__["_parent"] = parent

        self.__dict__["_settings"] = {}
        for setting in settings:
            self._settings[setting.name] = setting

    def validate_setting(self, name):
        if name in self._settings:
            setting = self._settings[name]
            if setting.required and not setting.established:
                if self._parent:
                    self._parent.validate_setting(name)
                else:
                    raise MissingRequiredError(name)
        elif self._parent:
            self._parent.validate_setting(name)
        else:
            raise AttributeError('No such setting "%s"' % name)

    def validate(self):
        for name in self:
            self.validate_setting(name)

    def __getattr__(self, name):
        if name in self._settings:
            if self._settings[name].established:
                return self._settings[name].value
            elif self._parent:
                return getattr(self._parent, name)
            else:
                return self._settings[name].default
        elif self._parent:
            return getattr(self._parent, name)
        else:
            raise AttributeError('No such setting "%s"' % name)

    def __getitem__(self, key):
        return getattr(self, key)

    def __setattr__(self, name, value):
        raise ReadOnlyError("Cannot change the value of settings")

    def __setitem__(self, key, value):
        setattr(self, key, value)

    def __delattr__(self, name):
        raise ReadOnlyError("Cannot delete settings")

    def __delitem__(self, key):
        delattr(self, key)

    def __iter__(self):
        all_names = set(self._settings.keys())
        if self._parent:
            all_names.update(iter(self._parent))
        return iter(all_names)

    def __len__(self):
        return len(list(iter(self)))

    def __contains__(self, item):
        return item in list(iter(self))

    def __str__(self):  # pragma: no cover
        return "Configuration(%s)" % (
            ", ".join([u"%s=%s" % (name, repr(self[name])) for name in self])
        )

    def __repr__(self):  # pragma: no cover
        return "<%s>" % str(self)

Youez - 2016 - github.com/yon3zu
LinuXploit