SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > setuptools >


Operation   : Linux premium131.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
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
_distutils Directory - -
_vendor Directory - -
command Directory - -
compat Directory - -
config Directory - -
tests Directory - -
__init__.py File 10406 bytes April 17 2025 13:10:58.
_core_metadata.py File 11978 bytes April 17 2025 13:10:58.
_entry_points.py File 2310 bytes April 17 2025 13:10:58.
_imp.py File 2435 bytes April 17 2025 13:10:58.
_importlib.py File 223 bytes April 17 2025 13:10:58.
_itertools.py File 657 bytes April 17 2025 13:10:58.
_normalization.py File 5824 bytes April 17 2025 13:10:58.
_path.py File 2685 bytes April 17 2025 13:10:58.
_reqs.py File 1438 bytes April 17 2025 13:10:58.
_shutil.py File 1496 bytes April 17 2025 13:10:58.
_static.py File 4855 bytes April 17 2025 13:10:58.
archive_util.py File 7356 bytes April 17 2025 13:10:58.
build_meta.py File 20446 bytes April 17 2025 13:10:58.
cli-32.exe File 11776 bytes April 17 2025 13:10:58.
cli-64.exe File 14336 bytes April 17 2025 13:10:58.
cli-arm64.exe File 13824 bytes April 17 2025 13:10:58.
cli.exe File 11776 bytes April 17 2025 13:10:58.
depends.py File 5965 bytes April 17 2025 13:10:58.
discovery.py File 21258 bytes April 17 2025 13:10:58.
dist.py File 44897 bytes April 17 2025 13:10:58.
errors.py File 3024 bytes April 17 2025 13:10:58.
extension.py File 6683 bytes April 17 2025 13:10:58.
glob.py File 6062 bytes April 17 2025 13:10:58.
gui-32.exe File 11776 bytes April 17 2025 13:10:58.
gui-64.exe File 14336 bytes April 17 2025 13:10:58.
gui-arm64.exe File 13824 bytes April 17 2025 13:10:58.
gui.exe File 11776 bytes April 17 2025 13:10:58.
installer.py File 5110 bytes April 17 2025 13:10:58.
launch.py File 820 bytes April 17 2025 13:10:58.
logging.py File 1261 bytes April 17 2025 13:10:58.
modified.py File 568 bytes April 17 2025 13:10:58.
monkey.py File 3717 bytes April 17 2025 13:10:58.
msvc.py File 41631 bytes April 17 2025 13:10:58.
namespaces.py File 3171 bytes April 17 2025 13:10:58.
package_index.py File 39095 bytes April 17 2025 13:10:58.
sandbox.py File 14906 bytes April 17 2025 13:10:58.
script (dev).tmpl File 218 bytes April 17 2025 13:10:58.
script.tmpl File 138 bytes April 17 2025 13:10:58.
unicode_utils.py File 3189 bytes April 17 2025 13:10:58.
version.py File 161 bytes April 17 2025 13:10:58.
warnings.py File 3796 bytes April 17 2025 13:10:58.
wheel.py File 8624 bytes April 17 2025 13:10:58.
windows_support.py File 726 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools//_static.py

from functools import wraps
from typing import TypeVar

import packaging.specifiers

from .warnings import SetuptoolsDeprecationWarning


class Static:
    """
    Wrapper for built-in object types that are allow setuptools to identify
    static core metadata (in opposition to ``Dynamic``, as defined :pep:`643`).

    The trick is to mark values with :class:`Static` when they come from
    ``pyproject.toml`` or ``setup.cfg``, so if any plugin overwrite the value
    with a built-in, setuptools will be able to recognise the change.

    We inherit from built-in classes, so that we don't need to change the existing
    code base to deal with the new types.
    We also should strive for immutability objects to avoid changes after the
    initial parsing.
    """

    _mutated_: bool = False  # TODO: Remove after deprecation warning is solved


def _prevent_modification(target: type, method: str, copying: str) -> None:
    """
    Because setuptools is very flexible we cannot fully prevent
    plugins and user customizations from modifying static values that were
    parsed from config files.
    But we can attempt to block "in-place" mutations and identify when they
    were done.
    """
    fn = getattr(target, method, None)
    if fn is None:
        return

    @wraps(fn)
    def _replacement(self: Static, *args, **kwargs):
        # TODO: After deprecation period raise NotImplementedError instead of warning
        #       which obviated the existence and checks of the `_mutated_` attribute.
        self._mutated_ = True
        SetuptoolsDeprecationWarning.emit(
            "Direct modification of value will be disallowed",
            f"""
            In an effort to implement PEP 643, direct/in-place changes of static values
            that come from configuration files are deprecated.
            If you need to modify this value, please first create a copy with {copying}
            and make sure conform to all relevant standards when overriding setuptools
            functionality (https://packaging.python.org/en/latest/specifications/).
            """,
            due_date=(2025, 10, 10),  # Initially introduced in 2024-09-06
        )
        return fn(self, *args, **kwargs)

    _replacement.__doc__ = ""  # otherwise doctest may fail.
    setattr(target, method, _replacement)


class Str(str, Static):
    pass


class Tuple(tuple, Static):
    pass


class List(list, Static):
    """
    :meta private:
    >>> x = List([1, 2, 3])
    >>> is_static(x)
    True
    >>> x += [0]  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    SetuptoolsDeprecationWarning: Direct modification ...
    >>> is_static(x)  # no longer static after modification
    False
    >>> y = list(x)
    >>> y.clear()
    >>> y
    []
    >>> y == x
    False
    >>> is_static(List(y))
    True
    """


# Make `List` immutable-ish
# (certain places of setuptools/distutils issue a warn if we use tuple instead of list)
for _method in (
    '__delitem__',
    '__iadd__',
    '__setitem__',
    'append',
    'clear',
    'extend',
    'insert',
    'remove',
    'reverse',
    'pop',
):
    _prevent_modification(List, _method, "`list(value)`")


class Dict(dict, Static):
    """
    :meta private:
    >>> x = Dict({'a': 1, 'b': 2})
    >>> is_static(x)
    True
    >>> x['c'] = 0  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    SetuptoolsDeprecationWarning: Direct modification ...
    >>> x._mutated_
    True
    >>> is_static(x)  # no longer static after modification
    False
    >>> y = dict(x)
    >>> y.popitem()
    ('b', 2)
    >>> y == x
    False
    >>> is_static(Dict(y))
    True
    """


# Make `Dict` immutable-ish (we cannot inherit from types.MappingProxyType):
for _method in (
    '__delitem__',
    '__ior__',
    '__setitem__',
    'clear',
    'pop',
    'popitem',
    'setdefault',
    'update',
):
    _prevent_modification(Dict, _method, "`dict(value)`")


class SpecifierSet(packaging.specifiers.SpecifierSet, Static):
    """Not exactly a built-in type but useful for ``requires-python``"""


T = TypeVar("T")


def noop(value: T) -> T:
    """
    >>> noop(42)
    42
    """
    return value


_CONVERSIONS = {str: Str, tuple: Tuple, list: List, dict: Dict}


def attempt_conversion(value: T) -> T:
    """
    >>> is_static(attempt_conversion("hello"))
    True
    >>> is_static(object())
    False
    """
    return _CONVERSIONS.get(type(value), noop)(value)  # type: ignore[call-overload]


def is_static(value: object) -> bool:
    """
    >>> is_static(a := Dict({'a': 1}))
    True
    >>> is_static(dict(a))
    False
    >>> is_static(b := List([1, 2, 3]))
    True
    >>> is_static(list(b))
    False
    """
    return isinstance(value, Static) and not value._mutated_


EMPTY_LIST = List()
EMPTY_DICT = Dict()

SILENT KILLER Tool