a
    6Rh                     @   s4  d dl mZ d dlmZ d dlZddlmZ G dd dZe	e
e
ddd	d
ZG dd de
eZG dd deeZG dd deeZdD ]Zeeed qG dd deeZdD ]Zeeed qG dd dejjeZedZeedddZe
eeeeeeeiZeedddZeeddd Ze Ze ZdS )!    )wraps)TypeVarN   )SetuptoolsDeprecationWarningc                   @   s   e Zd ZU dZdZeed< dS )Statica`  
    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.
    F	_mutated_N)__name__
__module____qualname____doc__r   bool__annotations__ r   r   H/opt/python-3.9.24/usr/lib/python3.9/site-packages/setuptools/_static.pyr   	   s   
r   )targetmethodcopyingreturnc                    sJ   t | |ddu rdS ttd fdd}d|_t| || dS )a	  
    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.
    N)selfc                    s4   d| _ tjdd  ddd | g|R i |S )NTz/Direct modification of value will be disallowedz
            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 z
            and make sure conform to all relevant standards when overriding setuptools
            functionality (https://packaging.python.org/en/latest/specifications/).
            )i  
   r   )Zdue_date)r   r   emit)r   argskwargsr   fnr   r   _replacement'   s    z+_prevent_modification.<locals>._replacement )getattrr   r   r   setattr)r   r   r   r   r   r   r   _prevent_modification   s    r   c                   @   s   e Zd ZdS )StrNr   r	   r
   r   r   r   r   r    =   s   r    c                   @   s   e Zd ZdS )TupleNr!   r   r   r   r   r"   A   s   r"   c                   @   s   e Zd ZdZdS )Lista  
    :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
    Nr   r	   r
   r   r   r   r   r   r#   E   s   r#   )
__delitem____iadd____setitem__appendclearextendinsertremovereversepopz`list(value)`c                   @   s   e Zd ZdZdS )Dicta  
    :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
    Nr$   r   r   r   r   r/   l   s   r/   )r%   __ior__r'   r)   r.   popitem
setdefaultupdatez`dict(value)`c                   @   s   e Zd ZdZdS )SpecifierSetz>Not exactly a built-in type but useful for ``requires-python``Nr$   r   r   r   r   r4      s   r4   T)valuer   c                 C   s   | S )z
    >>> noop(42)
    42
    r   r6   r   r   r   noop   s    r8   c                 C   s   t t| t| S )zc
    >>> is_static(attempt_conversion("hello"))
    True
    >>> is_static(object())
    False
    )_CONVERSIONSgettyper8   r7   r   r   r   attempt_conversion   s    r<   c                 C   s   t | to| j S )z
    >>> 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
    )
isinstancer   r   r7   r   r   r   	is_static   s    r>   )	functoolsr   typingr   Zpackaging.specifiers	packagingwarningsr   r   r;   strr   r    tupler"   listr#   _methoddictr/   
specifiersr4   r5   r8   r9   r<   objectr   r>   
EMPTY_LIST
EMPTY_DICTr   r   r   r   <module>   s*   "

