$21 GRAYBYTE WORDPRESS FILE MANAGER $96

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/setoptconf/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/setoptconf//setting.py
# pylint: disable=W0401,W0223

import re

from .datatype import *
from .exception import NamingError


__all__ = (
    "Setting",
    "StringSetting",
    "IntegerSetting",
    "FloatSetting",
    "BooleanSetting",
    "ListSetting",
    "ChoiceSetting",
)


class Setting(DataType):
    RE_NAME = re.compile(r"^[a-z](?:[a-z0-9]|[_](?![_]))*[a-z0-9]$")

    def __init__(self, name, default=None, required=False):
        if Setting.RE_NAME.match(name):
            self.name = name
        else:
            raise NamingError(name)

        self._value = None
        self.default = self.sanitize(default)
        self.required = required
        self.established = False

    @property
    def value(self):
        return self._value

    @value.setter
    def value(self, value):
        self._value = self.sanitize(value)
        self.established = True

    def __str__(self):  # pragma: no cover
        return unicode(self.name)

    def __repr__(self):  # pragma: no cover
        return "<%s(%s=%s)>" % (
            self.__class__.__name__,
            self.name,
            self.value if self.established else "",
        )


class StringSetting(Setting, String):
    pass


class IntegerSetting(Setting, Integer):
    pass


class FloatSetting(Setting, Float):
    pass


class BooleanSetting(Setting, Boolean):
    pass


class ListSetting(Setting, List):
    def __init__(self, name, subtype, **kwargs):
        List.__init__(self, subtype)
        Setting.__init__(self, name, **kwargs)


class ChoiceSetting(Setting, Choice):
    def __init__(self, name, choices, subtype=None, **kwargs):
        Choice.__init__(self, choices, subtype=subtype)
        Setting.__init__(self, name, **kwargs)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
17 Dec 2025 3.08 AM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
source
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
0.184 KB
17 Apr 2025 8.10 PM
root / root
0644
config.py
2.29 KB
17 Apr 2025 8.10 PM
root / root
0644
datatype.py
3.033 KB
17 Apr 2025 8.10 PM
root / root
0644
exception.py
0.363 KB
17 Apr 2025 8.10 PM
root / root
0644
manager.py
1.096 KB
17 Apr 2025 8.10 PM
root / root
0644
setting.py
1.669 KB
17 Apr 2025 8.10 PM
root / root
0644
util.py
0.235 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF