HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/attr/__pycache__/_make.cpython-310.pyc
o

��h�y�@s0ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZddlmZmZmZddlmZmZmZddlmZmZmZmZmZmZdd	lm Z m!Z!m"Z"m#Z#e$j%Z&d
Z'dZ(dZ)e
�*i�Z+e$�Z,e�-ej.ej/�Z0Gd
d�dej1�Z2e2j3Z3	Gdd�de4�Z5e3ddddddddddddddfdd�Z6		d�d�dd �Z7	d�d�d#d$�Z8d�d)d*�Z9Gd+d,�d,e�Z:d-d.�Z;d/d0�Z<d�d2d3�Z=d4d5�Z>d�d6d7�Z?d8d9�Z@d:d;�ZAd<d=�ZBd>d?�ZCGd@dA�dA�ZDdBdC�ZEdDdE�ZF	d�dFdG�ZG																								d�dHdI�ZHeHZI	dJdK�ZJd�dNdO�ZKd�dUdV�ZLd�dWdX�ZMdYdZ�ZNd�d\d]�ZOd^d_�ZPd�d`da�ZQd�dbdc�ZRd�ddde�ZSdfdg�ZTdhdi�ZUdjdk�Z/dldm�ZVd�dodp�ZWd�dtdu�ZXd�dxdy�ZYd�d{d|�ZZd�d}d~�Z[d�d�d��Z\d�d�d��Z]d�d�d��Z^Gd�d��d��Z_d�d��e_j`D�ZaeMeQeSe_ead��d�d��eaD�d��d�d��eaD�d��Z_Gd�d��d��ZbeQeSeb��ZbGd�d��d��Zcd�d��ecj`D�ZdeMeQeSecedd��edd��edd��ZcGd�dw�dw�Zed�d��d�D�ZdeMeQeSeeedd��edd��edd��Zee$fdfd�d��ZfeHddd��Gd�d��d���Zgd�d��Zhd�d��Z-dS)��)�annotationsN)�Callable�Mapping)�cached_property)�Any�
NamedTuple�TypeVar�)�_compat�_config�setters)�PY_3_10_PLUS�PY_3_11_PLUS�PY_3_13_PLUS�_AnnotationExtractor�_get_annotations�get_generic_base)�DefaultAlreadySetError�FrozenInstanceError�NotAnAttrsClassError�UnannotatedAttributeErrorz__attr_factory_%s)ztyping.ClassVarz
t.ClassVar�ClassVarztyping_extensions.ClassVar�_attrs_cached_hashc@s(eZdZdZe��Zdd�Zdd�ZdS)�_NothingaF
    Sentinel to indicate the lack of a value when `None` is ambiguous.

    If extending attrs, you can use ``typing.Literal[NOTHING]`` to show
    that a value may be ``NOTHING``.

    .. versionchanged:: 21.1.0 ``bool(NOTHING)`` is now False.
    .. versionchanged:: 22.2.0 ``NOTHING`` is now an ``enum.Enum`` variant.
    cC�dS)N�NOTHING���selfrr�@/usr/local/CyberPanel/lib/python3.10/site-packages/attr/_make.py�__repr__J�z_Nothing.__repr__cCr)NFrrrrr�__bool__Mr!z_Nothing.__bool__N)	�__name__�
__module__�__qualname__�__doc__�enum�autorr r"rrrrr=s

rc@s"eZdZdZed�dfdd�ZdS)�_CacheHashWrappera
    An integer subclass that pickles / copies as None

    This is used for non-slots classes with ``cache_hash=True``, to avoid
    serializing a potentially (even likely) invalid hash value. Since `None`
    is the default value for uncalculated hashes, whenever this is copied,
    the copy's value for the hash should automatically reset.

    See GH #613 for more details.
    NrcCs||fS�Nr)r�_none_constructor�_argsrrr�
__reduce__e�z_CacheHashWrapper.__reduce__)r#r$r%r&�typer-rrrrr)Ysr)TFcCs4t|||d�\}}}}|dur|dur|durd}t|��|	dur9|tur+d}t|��t|	�s5d}t|��t|	�}|dur?i}t|
ttf�rKt	j
|
�}
|rXt|ttf�rXt|�}|ret|ttf�ret
|�}tdid|�d|�d	|�d
d�d|�d|�d
|�d|�d|�d|
�d|�d|�d|�d|�d|
�d|��S)a�
    Create a new field / attribute on a class.

    Identical to `attrs.field`, except it's not keyword-only.

    Consider using `attrs.field` in new code (``attr.ib`` will *never* go away,
    though).

    ..  warning::

        Does **nothing** unless the class is also decorated with
        `attr.s` (or similar)!


    .. versionadded:: 15.2.0 *convert*
    .. versionadded:: 16.3.0 *metadata*
    .. versionchanged:: 17.1.0 *validator* can be a ``list`` now.
    .. versionchanged:: 17.1.0
       *hash* is `None` and therefore mirrors *eq* by default.
    .. versionadded:: 17.3.0 *type*
    .. deprecated:: 17.4.0 *convert*
    .. versionadded:: 17.4.0
       *converter* as a replacement for the deprecated *convert* to achieve
       consistency with other noun-based arguments.
    .. versionadded:: 18.1.0
       ``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``.
    .. versionadded:: 18.2.0 *kw_only*
    .. versionchanged:: 19.2.0 *convert* keyword argument removed.
    .. versionchanged:: 19.2.0 *repr* also accepts a custom callable.
    .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.
    .. versionadded:: 19.2.0 *eq* and *order*
    .. versionadded:: 20.1.0 *on_setattr*
    .. versionchanged:: 20.3.0 *kw_only* backported to Python 2
    .. versionchanged:: 21.1.0
       *eq*, *order*, and *cmp* also accept a custom callable
    .. versionchanged:: 21.1.0 *cmp* undeprecated
    .. versionadded:: 22.2.0 *alias*
    TNF�6Invalid value for hash.  Must be True, False, or None.z=The `default` and `factory` arguments are mutually exclusive.z*The `factory` argument must be a callable.�default�	validator�repr�cmp�hash�init�	converter�metadatar/�kw_only�eq�eq_key�order�	order_key�
on_setattr�aliasr)
�_determine_attrib_eq_order�	TypeErrorr�
ValueError�callable�Factory�
isinstance�list�tupler�pipe�and_�
_CountingAttr)r1r2r3r4r5r6r8r/r7�factoryr9r:r<r>r?r;r=�msgrrr�attribisp7��
��������	�
���
����rM��script�str�globs�dict[str, Any] | None�locs�Mapping[str, object] | None�filename�return�NonecCst||d�}t|||�dS)z[
    Evaluate the script with the given global (globs) and local (locs)
    variables.
    �execN)�compile�eval)rOrQrSrU�bytecoderrr�_compile_and_eval�s
r\�locals�dict[str, Any]c	Cs||durin|}d}|}	t|�d|�d�|f}tj�||�}||kr$n|dd��d|�d�}|d7}q
t||||�|S)zP
    Cache the script with _linecache_, compile it and return the _locals_.
    Nr	T����-�>)�len�
splitlines�	linecache�cache�
setdefaultr\)	rOrUrQr]rS�count�
base_filename�linecache_tuple�old_valrrr�_linecache_and_compile�s"
��rk�cls_name�
attr_names�	list[str]r/cCsF|�d�}i}t|�D]\}}|fdd�}t|�||<qt|tf|�S)z�
    Create a tuple subclass to hold `Attribute`s for an `attrs` class.

    The subclass is a bare tuple with properties for names.

    class MyClassAttributes(tuple):
        __slots__ = ()
        x = property(itemgetter(0))
    �
AttributescSs||Sr*r)r�irrr�getterr.z&_make_attr_tuple_class.<locals>.getter)�	enumerate�propertyr/rG)rlrm�attr_class_name�bodyrp�	attr_namerqrrr�_make_attr_tuple_classs

rwc@s&eZdZUded<ded<ded<dS)�_Attributesr/�attrs�list[Attribute]�
base_attrs�dict[str, type]�base_attrs_mapN)r#r$r%�__annotations__rrrrrxs
rxcCs2t|�}|�d�r|�d�r|dd�}|�t�S)z�
    Check whether *annot* is a typing.ClassVar.

    The string comparison hack is used to avoid evaluating all string
    annotations which would put attrs-based classes at a performance
    disadvantage compared to plain old classes.
    )�'�"r	r_)rP�
startswith�endswith�_CLASSVAR_PREFIXES)�annotrrr�
_is_class_var"s
r�cCs
||jvS)zR
    Check whether *cls* defines *attrib_name* (and doesn't just inherit it).
    )�__dict__)�cls�attrib_namerrr�_has_own_attribute3s
r��'tuple[list[Attribute], dict[str, type]]cCs�g}i}t|jdd��D]$}t|dg�D]}|js|j|vr q|jdd�}|�|�|||j<qq
g}t�}t|�D]}|j|vrCq;|�d|�|�	|j�q;||fS)zQ
    Collect attr.ibs from base classes of *cls*, except *taken_attr_names*.
    r	r_�__attrs_attrs__T��	inheritedr)
�reversed�__mro__�getattrr��name�evolve�append�set�insert�add)r��taken_attr_namesr{�
base_attr_map�base_cls�a�filtered�seenrrr�_collect_base_attrs:s$
�
r�cCsng}i}|jdd�D]'}t|dg�D]}|j|vrq|jdd�}|�|j�|�|�|||j<qq||fS)a-
    Collect attr.ibs from base classes of *cls*, except *taken_attr_names*.

    N.B. *taken_attr_names* will be mutated.

    Adhere to the old incorrect behavior.

    Notably it collects from the front and considers inherited attributes which
    leads to the buggy behavior reported in #428.
    r	r_r�Tr�)r�r�r�r�r�r�)r�r�r{r�r�r�rrr�_collect_base_attrs_broken[s

�	r�c	s|j�t|��|durt|���}nd|durgdd����D�}g}t�}���D]$\}	}
t|
�r1q(|�|	���|	t�}|j	t
urEt|�}|�|	|f�q(||}|rft
dd�t|�fdd�d	��d
��ntdd����D�d
d�d	�}tj���fdd�|D�}
|r�t|dd�|
D��\}}nt|dd�|
D��\}}|r�dd�|
D�}
dd�|D�}||
}|dur�t|||��}d}dd�|D�D]}|dur�|jtur�d|��}t|��|dur�|jtur�d}q�|D]}|js�t�|�dt|j��q�dd�|D�}t|j|�}t||�||�S)a3
    Transform all `_CountingAttr`s on a class into `Attribute`s.

    If *these* is passed, use that and don't look for them on the class.

    If *collect_by_mro* is True, collect them in the correct MRO order,
    otherwise use the old -- incorrect -- order.  See #428.

    Return an `_Attributes`.
    NTcSsh|]\}}|jtur|�qSr��	__class__rJ��.0r��attrrrr�	<setcomp>�s

�z#_transform_attrs.<locals>.<setcomp>z1The following `attr.ib`s lack a type annotation: �, cs��|�jSr*)�get�counter)�n)�cdrr�<lambda>�sz"_transform_attrs.<locals>.<lambda>)�key�.css&�|]\}}|jtur||fVqdSr*r�r�rrr�	<genexpr>�s�
��z#_transform_attrs.<locals>.<genexpr>cSs
|djS�Nr	)r�)�errrr���
cs"g|]
\}}�||��|���qSr)r�)r�rv�ca)�anns�fcarr�
<listcomp>�s�z$_transform_attrs.<locals>.<listcomp>cS�h|]}|j�qSr�r��r�r�rrrr���cSr�rr�r�rrrr��r�cS�g|]}|jdd��qS�T)r9�r�r�rrrr���cSr�r�r�r�rrrr��r�Fcss(�|]}|jdur|jdur|VqdS)FN)r6r9r�rrrr��s�&zlNo mandatory attributes allowed after an attribute with a default value or factory.  Attribute in question: r?cSsg|]}|j�qSrr�r�rrrr��r�)r�rrF�itemsr�r�r�r�rr�rJrMr�r�join�sorted�	Attribute�from_counting_attrr�r�rGr1rBr?�_OBJ_SETATTR�__get__�_default_init_alias_forr�rwr#rx)r��these�auto_attribsr9�collect_by_mro�field_transformer�ca_list�ca_names�annot_namesrvr/r��unannotated�	own_attrsr{r�ry�had_defaultrLrm�
AttrsClassr)r�r�r�r�_transform_attrsws�
�

�����	��	�
��
��r�cCsngd�}|dur|�d�n|�gd��|�ddg�t|d�}|tj|d�}td�|�||d	|id
�dS)N)	zdef wrapper(_cls):z    __class__ = _clsz�    def __getattr__(self, item, cached_properties=cached_properties, original_getattr=original_getattr, _cached_setattr_get=_cached_setattr_get):z+         func = cached_properties.get(item)z         if func is not None:z!              result = func(self)z1              _setter = _cached_setattr_get(self)z#              _setter(item, result)z              return resultz,         return original_getattr(self, item))z
         try:z2             return super().__getattribute__(item)z         except AttributeError:z4             if not hasattr(super(), '__getattr__'):z                 raisez-             return super().__getattr__(item)zY         original_error = f"'{self.__class__.__name__}' object has no attribute '{item}'"z-         raise AttributeError(original_error)z    return __getattr__z__getattr__ = wrapper(_cls)r�)�cached_properties�_cached_setattr_get�original_getattr�
�_cls)r]�__getattr__)r��extend�_generate_unique_filenamer�r�rkr�)r�r�r��lines�unique_filename�globrrr�_make_cached_property_getattr�s.
��
��
���r�cCs(t|t�r|dvrt�|||�dSt�)z4
    Attached to frozen classes as __setattr__.
    )�	__cause__�__context__�
__traceback__�__suppress_context__�	__notes__N)rE�
BaseException�__setattr__r�rr��valuerrr�_frozen_setattrssr�cCs&t|t�r|dvrt�||�dSt�)z4
    Attached to frozen classes as __delattr__.
    )r�N)rEr��__delattr__r)rr�rrr�_frozen_delattrs(sr�c	Os�z|\}Wntydt|��d�}t|�d�w|j}t|�}|D]}|js)q#|j}|j}||vr:t||�||<q#|di|��S)a
    Create a new instance, based on the first positional argument with
    *changes* applied.

    .. tip::

       On Python 3.13 and later, you can also use `copy.replace` instead.

    Args:

        inst:
            Instance of a class with *attrs* attributes. *inst* must be passed
            as a positional argument.

        changes:
            Keyword changes in the new copy.

    Returns:
        A copy of inst with *changes* incorporated.

    Raises:
        TypeError:
            If *attr_name* couldn't be found in the class ``__init__``.

        attrs.exceptions.NotAnAttrsClassError:
            If *cls* is not an *attrs* class.

    .. versionadded:: 17.1.0
    .. deprecated:: 23.1.0
       It is now deprecated to pass the instance using the keyword argument
       *inst*. It will raise a warning until at least April 2024, after which
       it will become an error. Always pass the instance as a positional
       argument.
    .. versionchanged:: 24.1.0
       *inst* can't be passed as a keyword argument anymore.
    z*evolve() takes 1 positional argument, but z were givenNr)	rBrbrAr��fieldsr6r�r?r�)	�args�changes�instrLr�ryr�rv�	init_namerrrr�3s$%
�
��r�c@s�eZdZdZdZd2dd�Zdd�Zd3dd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd4d-d.�Zd4d/d0�Zd1S)5�
_ClassBuilderz(
    Iteratively build *one* class.
    )�_add_method_dunders�_attr_names�_attrs�_base_attr_map�_base_names�_cache_hashr��	_cls_dict�_delete_attribs�_frozen�_has_custom_setattr�_has_post_init�
_has_pre_init�_is_exc�_on_setattr�_pre_init_has_args�_repr_added�_script_snippets�_slots�
_weakref_slot�_wrote_own_setattrr�r/cCs�t||||||�\}}}||_|rt|j�ni|_||_dd�|D�|_||_tdd�|D��|_	||_
||_||_|	|_
tt|dd��|_d|_|jr\|j}t�|�}t|j�dk|_tt|dd��|_t|�|_|
|_||_|
|_d|_|j|jd	<|r�t|jd
<t|jd<d|_n?|tt j!t j"fvr�d}}|D]}|j#dur�d}|j$dur�d}|r�|r�nq�|tkr�|s�|r�|t j!kr�|r�|t j"kr�|s�d|_|r�|�%�\|jd
<|jd<g|_&d|_'t(|jd�r�t(|jd�s�|j)|_*dS|j+|_*dS)NcSr�rr�r�rrrr��r�z)_ClassBuilder.__init__.<locals>.<setcomp>css�|]}|jVqdSr*r�r�rrrr��s�z)_ClassBuilder.__init__.<locals>.<genexpr>�__attrs_pre_init__Fr	�__attrs_post_init__r�r�r�T�__getstate__�__setstate__r$r%),r�r��dictr�r�r�r�r�rGr�rr�rr��boolr�r�r�r�inspect�	signaturerb�
parametersr�r�r�r�r�rr�r��_DEFAULT_ON_SETATTRr�validate�convertr2r7�_make_getstate_setstater�r��hasattr�_add_method_dunders_safer��_add_method_dunders_unsafe)rr�r��slots�frozen�weakref_slot�getstate_setstater�r9�
cache_hash�is_excr�r>�has_custom_setattrr�ryr{�base_map�
pre_init_func�pre_init_signature�
has_validator�
has_converterr�rrr�__init__�s�
�	


�

������z_ClassBuilder.__init__cCsd|jj�d�S)Nz<_ClassBuilder(cls=z)>)r�r#rrrrr �sz_ClassBuilder.__repr__rVrWcCsld�dd�|jD��}i}|jD]
\}}}|�|�qt|t|jd�|�}|jD]\}}}||j|�q(dS)z=
        Evaluate any registered snippets in one go.
        r�cSsg|]}|d�qS)rr)r��snippetrrrr���z0_ClassBuilder._eval_snippets.<locals>.<listcomp>�methodsN)r�r��updaterkr�r�r�)rrOrQ�_�
snippet_globsrS�hookrrr�_eval_snippets�s
��z_ClassBuilder._eval_snippetscCsT|��|jdur|��}n|��}trt�|�}t|dd�r(d|jvr(|�	�|S)z�
        Finalize class based on the accumulated configuration.

        Builder cannot be used after calling this method.
        T�__attrs_init_subclass__N)
r'r�_create_slots_class�_patch_original_classr
�abc�update_abstractmethodsr�r�r()rr�rrr�build_class
s



�
z_ClassBuilder.build_classc	Cs�|j}|j}|jr5|jD](}||vr4t||t�tur4t�t��
t	||�Wd�n1s/wYq|j
��D]
\}}t|||�q:|j
sWt|dd�rWd|_|jsWt|_|S)zA
        Apply accumulated methods and return the class.
        N�__attrs_own_setattr__F)r�r�r�r�r��	_SENTINEL�
contextlib�suppress�AttributeError�delattrr�r��setattrrr.r�r�r�)rr��
base_namesr�r�rrrr*"s&
���z#_ClassBuilder._patch_original_classc
s��fdd��j��D�}�js*d|d<�js*�jjD]��j�dd�r)t|d<nqi}d}�jj	dd�D]��j�dd	�d	urCd
}|�
�fdd�t�dg�D��q6t�j
���j}�jrrdt�jdd
�vrrd|vrr|sr|d7}dd�|��D�}g}|r�t�j�}|��D]!\}}	||f7}||=|�|	�t�|	�j}
|
tjjur�|
||<q�|�d�}|d	ur�|�|�t||�j�|d<�fdd�|D���fdd�|��D���fdd��D��|�
���jr��t�t��|d<�jj|d<t�j��jj�jj|�}t�|j� �|�D]L}
t!|
t"t#f��rt|
j$dd	�}nt!|
t%��r-t|
j&dd	�}nt|
dd	�}|�s8�q
|D]}z|j'�ju}Wnt(�yOY�q:w|�rV||_'�q:�q
|S)zL
        Build and return a new class with a `__slots__` attribute.
        cs2i|]\}}|gt�j��d�d�Rvr||�qS)r��__weakref__)rGr��r��k�vrrr�
<dictcomp>Js
�z5_ClassBuilder._create_slots_class.<locals>.<dictcomp>Fr.r�r	r_r6NTc�i|]}|t�|��qSr�r��r�r�)r�rrr:is
���	__slots__r)r6cSs"i|]
\}}t|t�r||j�qSr)rEr�func)r�r��cached_proprrrr:zs��r�c�g|]}|�vr|�qSrrr=)r5rrr��r�z5_ClassBuilder._create_slots_class.<locals>.<listcomp>csi|]\}}|�vr||�qSrr)r��slot�slot_descriptor)�
slot_namesrrr:�s
�crArrr=)�reused_slotsrrr��r�r%�__closure__))r�r�rr�r��	__bases__r�r�r�r�r#r�r�r�r�rrr�r	r
�return_annotation�	Parameter�emptyr�r��_HASH_CACHE_FIELDrGr%r/r#�	itertools�chain�valuesrE�classmethod�staticmethod�__func__rs�fget�
cell_contentsrB)rr��existing_slots�weakref_inherited�namesr��&additional_closure_functions_to_update�class_annotationsr�r?�
annotationr�r��item�
closure_cells�cell�matchr)r�r5rErrDrr)Fs�
��

��
���


�

�
�


����	z!_ClassBuilder._create_slots_classcs8t�j|�\}}�fdd�}�j�|||f�d�_�S)Nc���|d�|d<dS)Nr �r���cls_dictrQrrr�_attach_repr��z,_ClassBuilder.add_repr.<locals>._attach_reprT)�_make_repr_scriptr�r�r�r�)r�nsrOrQrbrrr�add_repr�s
z_ClassBuilder.add_reprcCs.|js	d}t|��dd�}|�|�|jd<|S)Nz3__str__ can only be generated if a __repr__ exists.cSs|��Sr*�r rrrr�__str__�r.z&_ClassBuilder.add_str.<locals>.__str__rh)r�rBr�r�)rrLrhrrr�add_str�sz_ClassBuilder.add_strcs<tdd�|jD����fdd�}|j���fdd�}||fS)zF
        Create custom __setstate__ and __getstate__ methods.
        css�|]	}|dkr|VqdS)r6Nr)r��anrrrr��s��z8_ClassBuilder._make_getstate_setstate.<locals>.<genexpr>cs�fdd��D�S)�9
            Automatically created by attrs.
            cr;rr<r=rrrr:�r�zQ_ClassBuilder._make_getstate_setstate.<locals>.slots_getstate.<locals>.<dictcomp>rr)�state_attr_namesrr�slots_getstate��z=_ClassBuilder._make_getstate_setstate.<locals>.slots_getstatecsjt�|�}t|t�rt�|�D]	\}}|||�qn�D]
}||vr)||||�q�r3|td�dSdS)rkN)r�r�rErG�ziprK)r�state�_ClassBuilder__bound_setattrr�r���hash_caching_enabledrlrr�slots_setstate�s

���z=_ClassBuilder._make_getstate_setstate.<locals>.slots_setstate)rGr�r�)rrmrtrrrrr�s�z%_ClassBuilder._make_getstate_setstatecCsd|jd<|S�N�__hash__)r�rrrr�make_unhashables
z_ClassBuilder.make_unhashablecs@t�j�j�j�jd�\}}d	�fdd�}�j�|||f��S)
N�rrrarrSrVrWcr^rur_)rarSrrr�attach_hashrcz+_ClassBuilder.add_hash.<locals>.attach_hash)rarrSrrVrW)�_make_hash_scriptr�r�r�r�r�r�)rrOrQryrrr�add_hashs
�z_ClassBuilder.add_hashc�`t�j�j�j�j�j�j�j�j�j	�j
�jdd�\}}���fdd�}�j�
|||f��S)NF��
attrs_initc� |d}�|_��|�|d<dS)Nr�r~r��rarQr6�rrrr�_attach_init2�z,_ClassBuilder.add_init.<locals>._attach_init��_make_init_scriptr�r�r�r�r�r�rr�r�r�r�r�r�)rrOrQr�rr�r�add_init"�"�z_ClassBuilder.add_initcCs|�dd��|jd<|S)Nc[st|fi|��Sr*r�)rr�rrrr�=sz+_ClassBuilder.add_replace.<locals>.<lambda>�__replace__)r�r�rrrr�add_replace;s
�z_ClassBuilder.add_replacecCstdd�|jD��|jd<dS)Ncss"�|]}|jr|js|jVqdSr*)r6r9r�)r��fieldrrrr�Bs���
�z/_ClassBuilder.add_match_args.<locals>.<genexpr>�__match_args__)rGr�r�rrrr�add_match_argsAs�z_ClassBuilder.add_match_argscr|)NTr}cr)N�__attrs_init__r�r�r�rr�_attach_attrs_initXr�z8_ClassBuilder.add_attrs_init.<locals>._attach_attrs_initr�)rrOrQr�rr�r�add_attrs_initHr�z_ClassBuilder.add_attrs_initcs>�j}t�j�\}}�fdd�}�j�|||f�t|d<�S)Ncr^)N�__eq__r_r`rrr�
_attach_eqfrcz(_ClassBuilder.add_eq.<locals>._attach_eq�__ne__)r��_make_eq_scriptr�r�r�r�)rr�rOrQr�rrr�add_eqasz_ClassBuilder.add_eqcs>�j}�fdd�t�j�j�D�\|d<|d<|d<|d<�S)Nc3s�|]}��|�VqdSr*r_)r��methrrrr�rs
��
�z*_ClassBuilder.add_order.<locals>.<genexpr>�__lt__�__le__�__gt__�__ge__)r��_make_orderr�r�)rr�rrr�	add_orderos

�z_ClassBuilder.add_ordercs�i�|jD]}|jp|j}|r|tjur||f�|j<q�s |S|jr)d}t|���fdd�}d|jd<|�	|�|jd<d|_
|S)Nz7Can't combine custom __setattr__ with on_setattr hooks.csDz�|\}}Wnty|}Ynw||||�}t|||�dSr*)�KeyErrorr�)rr��valr�r&�nval��sa_attrsrrr��s�z._ClassBuilder.add_setattr.<locals>.__setattr__Tr.r�)r�r>r�r�NO_OPr�r�rBr�r�r)rr�r>rLr�rr�r�add_setattrys 
�

z_ClassBuilder.add_setattr�methodrcCs6|jj|_|jj�d|j��|_d|jj�d�|_|S)z@
        Add __module__ and __qualname__ to a *method*.
        r��$Method generated by attrs for class )r�r$r%r#r&�rr�rrrr�s

�z(_ClassBuilder._add_method_dunders_unsafecCs�t�t��
|jj|_Wd�n1swYt�t��|jj�d|j��|_Wd�n1s5wYt�t��d|jj�d�|_Wd�|S1sTwY|S)zL
        Add __module__ and __qualname__ to a *method* if possible.
        Nr�r�)r0r1r2r�r$r%r#r&r�rrrr�s��
��z&_ClassBuilder._add_method_dunders_safeN)r�r/)rVrW)r�rrVr)r#r$r%r&r>rr r'r-r*r)rfrirrwr{r�r�r�r�r�r�r�rrrrrrr�ms0
k
$
)

 r�cCst|durt|du|duf�rd}t|��|dur||fS|dur"|}|dur(|}|dur6|dur6d}t|��||fS)��
    Validate the combination of *cmp*, *eq*, and *order*. Derive the effective
    values of eq and order.  If *eq* is None, set it to *default_eq*.
    N�&Don't mix `cmp` with `eq' and `order`.FT�-`order` can only be True if `eq` is True too.��anyrB)r4r:r<�
default_eqrLrrr�_determine_attrs_eq_order�sr�c	Cs�|durt|du|duf�rd}t|��dd�}|dur(||�\}}||||fS|dur2|d}}n||�\}}|durB||}}n||�\}}|durV|durVd}t|��||||fS)r�Nr�cSs&t|�r
d|}}||fSd}||fS)z8
        Decide whether a key function is used.
        TN)rC)r�r�rrr�decide_callable_or_boolean�s

�z>_determine_attrib_eq_order.<locals>.decide_callable_or_booleanFTr�r�)	r4r:r<r�rLr��cmp_keyr;r=rrrr@�s"r@cCsF|dus|dur
|S|dur|dur|S|D]
}t||�r dSq|S)ap
    Check whether we should implement a set of methods for *cls*.

    *flag* is the argument passed into @attr.s like 'init', *auto_detect* the
    same as passed into @attr.s and *dunders* is a tuple of attribute names
    whose presence signal that the user has implemented it themselves.

    Return *default* if no reason for either for or against is found.
    TFN)r�)r��flag�auto_detect�dundersr1�dunderrrr�_determine_whether_to_implement�s
�r�cs��durddl}|jtd�dd�t|||d�\��|dur |�	t�
ttf�r,tj�
��
����������	�
���
�������fdd�}|durL|S||�S)a�
    A class decorator that adds :term:`dunder methods` according to the
    specified attributes using `attr.ib` or the *these* argument.

    Consider using `attrs.define` / `attrs.frozen` in new code (``attr.s`` will
    *never* go away, though).

    Args:
        repr_ns (str):
            When using nested classes, there was no way in Python 2 to
            automatically detect that.  This argument allows to set a custom
            name for a more meaningful ``repr`` output.  This argument is
            pointless in Python 3 and is therefore deprecated.

    .. caution::
        Refer to `attrs.define` for the rest of the parameters, but note that they
        can have different defaults.

        Notably, leaving *on_setattr* as `None` will **not** add any hooks.

    .. versionadded:: 16.0.0 *slots*
    .. versionadded:: 16.1.0 *frozen*
    .. versionadded:: 16.3.0 *str*
    .. versionadded:: 16.3.0 Support for ``__attrs_post_init__``.
    .. versionchanged:: 17.1.0
       *hash* supports `None` as value which is also the default now.
    .. versionadded:: 17.3.0 *auto_attribs*
    .. versionchanged:: 18.1.0
       If *these* is passed, no attributes are deleted from the class body.
    .. versionchanged:: 18.1.0 If *these* is ordered, the order is retained.
    .. versionadded:: 18.2.0 *weakref_slot*
    .. deprecated:: 18.2.0
       ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now raise a
       `DeprecationWarning` if the classes compared are subclasses of
       each other. ``__eq`` and ``__ne__`` never tried to compared subclasses
       to each other.
    .. versionchanged:: 19.2.0
       ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now do not consider
       subclasses comparable anymore.
    .. versionadded:: 18.2.0 *kw_only*
    .. versionadded:: 18.2.0 *cache_hash*
    .. versionadded:: 19.1.0 *auto_exc*
    .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.
    .. versionadded:: 19.2.0 *eq* and *order*
    .. versionadded:: 20.1.0 *auto_detect*
    .. versionadded:: 20.1.0 *collect_by_mro*
    .. versionadded:: 20.1.0 *getstate_setstate*
    .. versionadded:: 20.1.0 *on_setattr*
    .. versionadded:: 20.3.0 *field_transformer*
    .. versionchanged:: 21.1.0
       ``init=False`` injects ``__attrs_init__``
    .. versionchanged:: 21.1.0 Support for ``__attrs_pre_init__``
    .. versionchanged:: 21.1.0 *cmp* undeprecated
    .. versionadded:: 21.3.0 *match_args*
    .. versionadded:: 22.2.0
       *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
    .. deprecated:: 24.1.0 *repr_ns*
    .. versionchanged:: 24.1.0
       Instances are not compared as tuples of attributes anymore, but using a
       big ``and`` condition. This is faster and has more correct behavior for
       uncomparable values like `math.nan`.
    .. versionadded:: 24.1.0
       If a class has an *inherited* classmethod called
       ``__attrs_init_subclass__``, it is executed after the class is created.
    .. deprecated:: 24.1.0 *hash* is deprecated in favor of *unsafe_hash*.
    NrzQThe `repr_ns` argument is deprecated and will be removed in or after August 2025.�)�
stacklevelcs��pt|�}�duot|t�}�ot|d�}|r |r d}t|��t|��|�t|��d�d����|��
|��}t|��d�rD|����durL|��t|��d�}|s]|dur]|�	�|sjt|��d�rj|�
��sp|���	dur�durt|d	�rd
�	�	dur��	d
ur��	dur�d}t|���	d
us��	dur�|d
us�|r��r�d}t|��n!�	dus��	dur�|dur�|dur�|�
�n�r�d}t|��|��t|�
�d
�r�|��n|���r�d}t|��tr�t|d�s�|��tr��r�t|d�s�|��|��S)NTr�z/Can't freeze a class with a custom __setattr__.)rr)r1rg)r�r�)r�r�r�r�rvFr0zlInvalid value for cache_hash.  To use hash caching, hashing must be either explicitly or implicitly enabled.�rzFInvalid value for cache_hash.  To use hash caching, init must be True.r�r�)�_has_frozen_base_class�
issubclassr�r�rBr�r�rfrir�r�r�rAr{rwr�r�rr�r
r�r-)r��	is_frozenr�has_own_setattrrL�builderr:�r�r��auto_excrr��eq_r�rrr5r6r9�
match_argsr>�order_r3�repr_nsrrPr�rrr�wrap�s�����
����
�
���zattrs.<locals>.wrap)	�warnings�warn�DeprecationWarningr�rErFrGrrH)�	maybe_clsr�r�r3r4r5r6rrrrPr�r9rr�r:r<r�r�rr>r�r��unsafe_hashr�r�rr�rrys"\��
4nrycCs
|jtuS)zV
    Check whether *cls* has a frozen ancestor by looking at its
    __setattr__.
    )r�r�)r�rrrr�s
r�r��	func_namec	Cs$d|�d|j�dt|d|j��d�S)zF
    Create a "filename" suitable for a function being generated.
    z<attrs generated � r�r%ra)r$r�r#)r�r�rrrr�
s��r�rzrrr�tuple[str, dict]cstdd��D���d}tt|d���i�d}d�d�|s!|d7}n|d	7}|d
7}d���d7�|g�������fd
d�}|ry��|dt�d��|rc|dt�d�|d���|dd�n|dt�d�|d���|dt���n|d|�d���}|�fS)Ncss2�|]}|jdus|jdur|jdur|VqdS)TN)r5r:r�rrrr�s�(�z$_make_hash_script.<locals>.<genexpr>�        r5zdef __hash__(selfzhash((z))z):z, *zC, _cache_wrapper=__import__('attr._make')._make._CacheHashWrapper):z_cache_wrapper(�)c	s���||�|d��d�g��D]-}|jr4d|j�d�}|j�|<��|d|�d|j�d��q��|d|j�d��q��|d��d	S)
z�
        Generate the code for actually computing the hash code.
        Below this will either be returned directly or used to compute
        a value which is then cached, depending on the value of cache_hash
        r��,r$�_key�(self.z),�
        self.�    N)r�r;r�r�)�prefix�indentr��cmp_name�ry�closing_bracesrQ�	hash_func�method_lines�	type_hashrr�append_hash_computation_lines/s
��
�z8_make_hash_script.<locals>.append_hash_computation_lineszif self.z	 is None:zobject.__setattr__(self, '�', r��self.� = zreturn self.zreturn r�)rGr5r�r�rKr�)r�ryrr�tab�hash_defr�rOrr�rrzs>�
��

rzcCs6t||ddd�\}}t||t|d�d�|d|_|S)z%
    Add a hash method to *cls*.
    Frxrv�rU)rzr\r�rv�r�ryrOrQrrr�	_add_hash\s
��
r�cCs|�|�}|turtS|S)z^
    Check equality and either forward a NotImplemented or
    return the result negated.
    )r��NotImplemented)r�other�resultrrrr�js
r�rFcCs�dd�|D�}gd�}i}|r_|�d�|D]B}|jr<d|j�d�}|j||<|�d|�d|j�d	|�d
|j�d�	�n
|�d|j�d
|j���||durX|d�d�|d<q|�d�n|�d�d�|�}||fS)z6
    Create __eq__ method for *cls* with *attrs*.
    cS�g|]}|jr|�qSr)r:r�rrrr�z�z#_make_eq_script.<locals>.<listcomp>)zdef __eq__(self, other):z-    if other.__class__ is not self.__class__:z        return NotImplementedz
    return  (r$r�r�r�z) == z(other.r�r�z
 == other.r_z andz    )z    return Truer�)r�r;r�r�)ryr�rQr�r�rOrrrr�vs(

 ��

r�csVdd��D���fdd���fdd�}�fdd�}�fd	d
�}�fdd�}||||fS)
z9
    Create ordering methods for *cls* with *attrs*.
    cSr�r)r<r�rrrr��r�z_make_order.<locals>.<listcomp>cs tdd��fdd��D�D��S)z&
        Save us some typing.
        css$�|]
\}}|r||�n|VqdSr*r)r�r�r�rrrr��s
��
�z6_make_order.<locals>.attrs_to_tuple.<locals>.<genexpr>c3s"�|]}t�|j�|jfVqdSr*)r�r�r=r���objrrr��s�
�)rGr��ryr�r�attrs_to_tuple�s

��z#_make_order.<locals>.attrs_to_tuplecs |j|jur�|��|�kStS�z1
        Automatically created by attrs.
        �r�r��rr��r�rrr���z_make_order.<locals>.__lt__cs |j|jur�|��|�kStSr�r�r�r�rrr��r�z_make_order.<locals>.__le__cs |j|jur�|��|�kStSr�r�r�r�rrr��r�z_make_order.<locals>.__gt__cs |j|jur�|��|�kStSr�r�r�r�rrr��r�z_make_order.<locals>.__ge__r)r�ryr�r�r�r�r)ryr�rr��s				r�cCsB|dur|j}t|�\}}t||t|d�d�|d|_t|_|S)z5
    Add equality methods to *cls* with *attrs*.
    Nr�r�)r�r�r\r�r�r�r�rrr�_add_eq�s�
r�c
Cs�tdd�|D��}dd�|D�}t|d<t|d<t|d<g}|D]'\}}}|r+d|nd	|d
}|tkr;d||fnd|||f}	|�|	�q d
�|�}
|durTd}n|d}ddddddddddddd|�d|
�d�dd g}d!�|�|fS)"zC
    Create the source and globs for a __repr__ and return it.
    css8�|]}|jdur|j|jdurtn|j|jfVqdS)FTN)r3r�r6r�rrrr��s�
��z$_make_repr_script.<locals>.<genexpr>cSs$i|]\}}}|tkr|d|�qS)�_repr)r3)r�r��rr$rrrr:�sz%_make_repr_script.<locals>.<dictcomp>r
r2rr�zgetattr(self, "z", NOTHING)z	%s={%s!r}z%s={%s_repr(%s)}r�Nz1{self.__class__.__qualname__.rsplit(">.", 1)[-1]}z.{self.__class__.__name__}zdef __repr__(self):z  try:z:    already_repring = _compat.repr_context.already_repringz  except AttributeError:z!    already_repring = {id(self),}z:    _compat.repr_context.already_repring = already_repringz  else:z#    if id(self) in already_repring:z      return '...'z	    else:z#      already_repring.add(id(self))z
    return f'�(z)'z
  finally:z$    already_repring.remove(id(self))r�)rGr
r2rr3r�r�)
ryre�attr_names_with_reprsrQ�attribute_fragmentsr�r�rp�accessor�fragment�
repr_fragment�cls_name_fragmentr�rrrrd�sN�����
�rdcCs>|dur|j}t||�\}}t||t|d�d�|d|_|S)z%
    Add a repr method to *cls*.
    Nr r�)r�rdr\r�r )r�reryrOrQrrr�	_add_reprs�
r�cCsvt|�}|durt|t�sd}t|��t|dd�}|dur9|dur0t|dd�}|dur0||_|S|�d�}t|��|S)aG
    Return the tuple of *attrs* attributes for a class.

    The tuple also allows accessing the fields by their names (see below for
    examples).

    Args:
        cls (type): Class to introspect.

    Raises:
        TypeError: If *cls* is not a class.

        attrs.exceptions.NotAnAttrsClassError:
            If *cls* is not an *attrs* class.

    Returns:
        tuple (with name accessors) of `attrs.Attribute`

    .. versionchanged:: 16.2.0 Returned tuple allows accessing the fields
       by name.
    .. versionchanged:: 23.1.0 Add support for generic classes.
    N�Passed object must be a class.r��! is not an attrs-decorated class.)rrEr/rAr�r�r)r��generic_baserLryrrrr�,s
r�cCsJt|t�sd}t|��t|dd�}|dur|�d�}t|��dd�|D�S)a�
    Return an ordered dictionary of *attrs* attributes for a class, whose keys
    are the attribute names.

    Args:
        cls (type): Class to introspect.

    Raises:
        TypeError: If *cls* is not a class.

        attrs.exceptions.NotAnAttrsClassError:
            If *cls* is not an *attrs* class.

    Returns:
        dict[str, attrs.Attribute]: Dict of attribute name to definition

    .. versionadded:: 18.1.0
    r�r�Nr�cSsi|]}|j|�qSrr�r�rrrr:tr!zfields_dict.<locals>.<dictcomp>)rEr/rAr�r)r�rLryrrr�fields_dictZs

rcCsDtjdurdSt|j�D]}|j}|dur|||t||j��qdS)z�
    Validate all attributes on *inst* that have a validator.

    Leaves all exceptions through.

    Args:
        inst: Instance of a class with *attrs* attributes.
    FN)r�_run_validatorsr�r�r2r�r�)r�r�r9rrrr
ws
	��r
cCs|�|�}|od|jvS)z>
    Check if the attribute name comes from a slot class.
    r>)r�r�)�a_namer�r�rrr�
_is_slot_attr�s
r�tuple[str, dict, dict]c
Cs|
duo|
tju}|r|rd}
t|
��|p|}g}i}|D]1}|js(|jtur(q|�|�|||j<|jdurD|durAd}
t|
��d}q|rN|jtjurNd}qt	|||||||||	|||r_dnd�\}}}|j
tjvru|�
tj|j
j�|�
t|d��|r�tj|d<|||fS)Nz$Frozen classes can't use on_setattr.Tr�r)r�	attr_dictr�)rr�rBr6r1rr�r�r>�_attrs_to_init_scriptr$�sys�modulesr#r�r�r�)r�ry�pre_init�pre_init_has_args�	post_initrrrr�r�cls_on_setattrr~�has_cls_on_setattrrL�needs_cached_setattr�filtered_attrsrr�rOrQrrrrr��sR�


�

�

r�rv�	value_var�has_on_setattrcCsd|�d|�d�S)zJ
    Use the cached object.setattr to set *attr_name* to *value_var*.
    �
_setattr('r�r�r�rvrrrrr�_setattr�rnrr7�	ConvertercCsd|�d|�||��d�S)zk
    Use the cached object.setattr to set *attr_name* to *value_var*, but run
    its converter first.
    rr�r�)�_fmt_converter_call�rvrrr7rrr�_setattr_with_converter�srr�cCs |rt||d�Sd|�d|��S)zo
    Unless *attr_name* has an on_setattr hook, use normal assignment. Otherwise
    relegate to _setattr.
    Tr�r�)r)rvr�rrrr�_assign�srcCs*|r	t||d|�Sd|�d|�||���S)z�
    Unless *attr_name* has an on_setattr hook, use normal assignment after
    conversion. Otherwise relegate to _setattr_with_converter.
    Tr�r�)rrrrrr�_assign_with_converter�srrr�r|csJ|dur |dur
dttfSd�fd	d
�}d�fd
d�}d||fSdttfS)zg
    Determine the correct setter functions based on whether a class is frozen
    and/or slotted.
    TrrvrPrrrrVcs&t|��rt|||�Sd|�d|��S�N�_inst_dict['z'] = )rrr�r�rr�
fmt_setters
z&_determine_setters.<locals>.fmt_setterr7rcs4|st|��rt||||�Sd|�d|�||���Sr)rrrrrrr�fmt_setter_with_converters
�z5_determine_setters.<locals>.fmt_setter_with_converter)z_inst_dict = self.__dict__N�rvrPrrPrrrVrP�
rvrPrrPrrr7rrVrP)rrrr)rrr�rrrrr�_determine_setters�s
�
r"r��
is_slotted�
call_pre_initr
�call_post_init�does_cache_hashrrr
�method_namec$
Cs�|rdgng}|	r|�d�t|||�\}
}}|�|
�g}g}g}i}ddi}|D�]�}|jr5|�|�|j}|jdupD|jtjuoD|
}|j}t	|j
t�}|rV|j
jrVdnd}|j
durit	|j
t�sit|j
�}n|j
}|jdur�|r�t|jf}|dur�|�|||d|�d	�||��|j
||�|j�<n|�|||d|�d	�|��|j
j||<�n|dur�|�||d
|�d�||��|j
||�|j�<�n|�||d
|�d�|��n�|j
tu�r|�s|�d|�d�}|jr�|�|�n|�|�|du�r|�|||||��|j
||�|j�<n�|�||||��n�|�r�|�d
�}|j�r-|�|�n|�|�|�d|�d��t|jf}|du�rs|�d|||||��|�d�|�d|||d|d	||��|j
||�|j�<n!|�d||||��|�d�|�d|||d|d	|��|j
j||<n1|j�r�|�|�n|�|�|du�r�|�|||||��|j
||�|j�<n	|�||||��|jdu�r�|jdu�r�|du�r�|j||<q*|du�r�|j�r�|j||<q*|�r't|d<|�d�|D]&}d|j}d|j}|�d|�d|�d|j�d	��|j||<|||<�q|�r/|�d�|�rQ|�rF|�r?dt�d�}n
dt�d�}ndt�d�}|�|�|�rgd �d!d"�|D��} |�d#| �d	��d$�|�}|}!|�r�||�rwd$nd�d%d$�|���7}d$�d&d'�d(d"�|D�D��}"|!|!�r�d$nd7}!|!|"7}!|�r�|�r�d)|!�d	�|d*<d+}#d,|�d|�d-|�r�|#�|�nd.�d/�||fS)0z�
    Return a script of an initializer for *attrs*, a dict of globals, and
    annotations for the initializer.

    The globals are required by the generated script.
    zself.__attrs_pre_init__()z$_setattr = _cached_setattr_get(self)rVNrrNFr�r�zattr_dict['z
'].defaultz=attr_dict['z=NOTHINGzif z is not NOTHING:r�zelse:Trz#if _config._run_validators is True:�__attr_validator_�__attr_z(self, z, self.zself.__attrs_post_init__()rz', None)rz	'] = Noner�z = Noner�css"�|]}|jrd|j��VqdS)r�N)r6r�r�rrrr�	s� z(_attrs_to_init_script.<locals>.<genexpr>zBaseException.__init__(self, r�z*, cSsg|]	}|�d|���qS)�=r)r��kw_arg_namerrrr�	s��z)_attrs_to_init_script.<locals>.<listcomp>css�|]
}|�d�dVqdS)r*rN)�split)r��kwarrrr�	s�zself.__attrs_pre_init__(rz
    zdef z):
    �passr�)r�r"r�r2r�r>rr�r?rEr1rD�
takes_selfr7rr6�_INIT_FACTORY_PAT�_get_global_namerKrr9r/�_first_param_typerrKr�)$ryr�r#r$r
r%r&r�rrr
r'r��extra_linesrrr��kw_only_args�attrs_to_validate�names_for_globalsrr�rvr�arg_name�has_factory�
maybe_selfr7�init_factory_name�arg�val_name�init_hash_cache�vals�
pre_init_args�pre_init_kw_only_args�NLrrrr.sl�
�



�
��	���
��	�
��

���


���
���
��
���

���
�


 



"����rr�cCs
|�d�S)z�
    The default __init__ parameter name for a field.

    This performs private-name adjustment via leading-unscore stripping,
    and is the default value of Attribute.alias if not provided.
    r$)�lstripr�rrrr�2	s
r�c@sjeZdZdZdZ										ddd�Zdd�Zeddd
d��Zdd�Z	dd�Z
dd�Zdd�ZdS)r�a�
    *Read-only* representation of an attribute.

    .. warning::

       You should never instantiate this class yourself.

    The class has *all* arguments of `attr.ib` (except for ``factory`` which is
    only syntactic sugar for ``default=Factory(...)`` plus the following:

    - ``name`` (`str`): The name of the attribute.
    - ``alias`` (`str`): The __init__ parameter name of the attribute, after
      any explicit overrides and default private-attribute-name handling.
    - ``inherited`` (`bool`): Whether or not that attribute has been inherited
      from a base class.
    - ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The
      callables that are used for comparing and ordering objects by this
      attribute, respectively. These are set by passing a callable to
      `attr.ib`'s ``eq``, ``order``, or ``cmp`` arguments. See also
      :ref:`comparison customization <custom-comparison>`.

    Instances of this class are frequently used for introspection purposes
    like:

    - `fields` returns a tuple of them.
    - Validators get them passed as the first argument.
    - The :ref:`field transformer <transform-fields>` hook receives a list of
      them.
    - The ``alias`` property exposes the __init__ parameter name of the field,
      with any overrides and default private-attribute handling applied.


    .. versionadded:: 20.1.0 *inherited*
    .. versionadded:: 20.1.0 *on_setattr*
    .. versionchanged:: 20.2.0 *inherited* is not taken into account for
        equality checks and hashing anymore.
    .. versionadded:: 21.1.0 *eq_key* and *order_key*
    .. versionadded:: 22.2.0 *alias*

    For the full version history of the fields, see `attr.ib`.
    )r�r1r2r3r:r;r<r=r5r6r8r/r7r9r�r>r?NFcCs�t||p|
|p|d�\}
}}}t�|�}|d|�|d|�|d|�|d|�|d|
�|d|�|d|�|d	|�|d
|�|d|�|d|�|d
|	rVt�t|	��nt�|d|
�|d|�|d|�|d|�|d|�dS)NTr�r1r2r3r:r;r<r=r5r6r7r8r/r9r�r>r?)r@r�r��types�MappingProxyTyper�_EMPTY_METADATA_SINGLETON)rr�r1r2r3r4r5r6r�r8r/r7r9r:r;r<r=r>r?�
bound_setattrrrrr~	s4�











��



zAttribute.__init__cCst�r*)rr�rrrr��	r!zAttribute.__setattr__r�rPr�rJcCst|dur|j}n|jdurd|�d�}t|��|||j|j|jd|j|jd|j||j|j	|j
|j|j|j
|j|j�S)Nz>Type annotation and type argument cannot both be present for 'z'.F)r/rB�_default�
_validatorr3r5r6r8r7r9r:r;r<r=r>r?)r�r�r�r/rLrrrr��	s2
�zAttribute.from_counting_attrcKst�|�}|�|���|S)a

        Copy *self* and apply *changes*.

        This works similarly to `attrs.evolve` but that function does not work
        with :class:`attrs.Attribute`.

        It is mainly meant to be used for `transform-fields`.

        .. versionadded:: 20.3.0
        )�copy�	_setattrsr�)rr��newrrrr��	s
zAttribute.evolvec�t�fdd��jD��S)�(
        Play nice with pickle.
        c3s,�|]}|dkr
t�|�nt�j�VqdS)r8N)r�rr8r=rrrr��	s
��
�z)Attribute.__getstate__.<locals>.<genexpr>�rGr>rrrrr�	s�zAttribute.__getstate__cCs|�t|j|��dS�rMN)rJror>�rrprrrr�	szAttribute.__setstate__cCsLt�|�}|D]\}}|dkr|||�q|||r t�t|��nt�qdS)Nr8)r�r�rCrDrrE)r�name_values_pairsrFr�r�rrrrJ�	s
���zAttribute._setattrs)
NNNFNNNNNNr*)r�rPr�rJ)
r#r$r%r&r>rr�rOr�r�rrrJrrrrr�=	s*,
�7	r�cCs2g|]}t|tddddd|dkddt|�d��qS)NTFr8)r�r1r2r3r4r:r<r5r6r�r?)r�rr�r=rrrr�
s ���r�r�cCsg|]	}|jdkr|�qSr�r�r�rrrr�
scCs g|]}|jr|jdkr|�qSr�)r5r�r�rrrr�
s c@sneZdZdZdZgedd�dD���eddddddd	dd	ddd	dd	dd
��RZdZdd
�Z	dd�Z
dd�ZdS)rJa
    Intermediate representation of attributes that uses a counter to preserve
    the order in which the attributes have been defined.

    *Internal* data structure of the attrs library.  Running into is most
    likely the result of a bug like a forgotten `@attr.s` decorator.
    )rGrHr?r7r�r:r;r5r6r9r8r>r<r=r3r/ccs:�|]}t|t|�tddddddddddddd�VqdS)NTF�r�r?r1r2r3r4r5r6r9r:r;r<r=r�r>)r�r�rr=rrrr�=
s*���
�z_CountingAttr.<genexpr>)	r�rGr3r:r<r5r6r>r?r8NTFrRrcCsttjd7_tj|_||_||_||_||_||_||_|
|_	||_
||_||_||_
|	|_|
|_||_||_dSr�)rJ�cls_counterr�rGrHr7r3r:r;r<r=r5r6r8r/r9r>r?)rr1r2r3r4r5r6r7r8r/r9r:r;r<r=r>r?rrrro
s"
z_CountingAttr.__init__cCs&|jdur
||_|St|j|�|_|S)z�
        Decorator that adds *meth* to the list of validators.

        Returns *meth* unchanged.

        .. versionadded:: 17.1.0
        N)rHrI�rr�rrrr2�
s

�z_CountingAttr.validatorcCs |jturt�t|dd�|_|S)z�
        Decorator that allows to set the default for an attribute.

        Returns *meth* unchanged.

        Raises:
            DefaultAlreadySetError: If default has been set before.

        .. versionadded:: 17.1.0
        T)r/)rGrrrDrTrrrr1�
s
z_CountingAttr.default)r#r$r%r&r>rGr�r�rSrr2r1rrrrrJ!
s<����1%rJc@s.eZdZdZdZddd�Zdd�Zdd	�Zd
S)rDa�
    Stores a factory callable.

    If passed as the default value to `attrs.field`, the factory is used to
    generate a new value.

    Args:
        factory (typing.Callable):
            A callable that takes either none or exactly one mandatory
            positional argument depending on *takes_self*.

        takes_self (bool):
            Pass the partially initialized instance that is being initialized
            as a positional argument.

    .. versionadded:: 17.1.0  *takes_self*
    �rKr/FcCs||_||_dSr*rU)rrKr/rrrr�
s
zFactory.__init__crL)rMc3s�|]}t�|�VqdSr*r<r=rrrr��
��z'Factory.__getstate__.<locals>.<genexpr>rNrrrrr�
szFactory.__getstate__cCs&t|j|�D]
\}}t|||�qdSrO)ror>r4)rrpr�r�rrrr�
s�zFactory.__setstate__N)F)r#r$r%r&r>rrrrrrrrD�
s
rDcC�(g|]}t|tddddddddd�
�qS�NTF)
r�r1r2r3r4r:r<r5r6r��r�rr=rrrr��
�
���c@sLeZdZdZdZddd�dd�Zedd
d��Zdd
d�Zdd�Z	dd�Z
dS)rae
    Stores a converter callable.

    Allows for the wrapped converter to take additional arguments. The
    arguments are passed in the order they are documented.

    Args:
        converter (Callable): A callable that converts the passed value.

        takes_self (bool):
            Pass the partially initialized instance that is being initialized
            as a positional argument. (default: `False`)

        takes_field (bool):
            Pass the field definition (an :class:`Attribute`) into the
            converter as a positional argument. (default: `False`)

    .. versionadded:: 24.1.0
    )�__call__r2�_global_namer7�takes_fieldr/F�r/r]cs�|�_|�_|�_t|�}|���_�js �js �fdd��_n#�jr.�js.�fdd��_n�js<�jr<�fdd��_n�fdd��_|��}|durS|�jjd<dSdS)Ncs
��|�Sr*�r7)r�r$�__rrrr�r�z$Converter.__init__.<locals>.<lambda>cs��||�Sr*r_)r��instancer`rrrr���cs��||�Sr*r_)r�r`r�rrrr�rbcs��|||�Sr*r_)r�rar�rrrr�#s�rV)	r7r/r]r�get_first_param_typer2r[�get_return_typer~)rr7r/r]�ex�rtrrrrs 
�zConverter.__init__rvrPrVcCs
d|��S)zh
        Return the name that a converter for an attribute name *attr_name*
        would have.
        �__attr_converter_r)rvrrrr1+s
zConverter._get_global_namercCs�|js|js|�|��d|�d�S|jr%|jr%|�|��d|�d|�d�S|jr3|�|��d|�d�S|�|��d|�d|�d�S)z�
        Return a string that calls the converter for an attribute name
        *attr_name* and the value in variable named *value_var* according to
        `self.takes_self` and `self.takes_field`.
        r�r�z, self, attr_dict['z'])z, self)z
, attr_dict[')r/r]r1)rrvrrrrr3szConverter._fmt_converter_callcCs|j|j|jd�S)zx
        Return a dict containing only converter and takes_self -- the rest gets
        computed when loading.
        �r7r/r]rhrrrrrDs�zConverter.__getstate__cCs|jdi|��dS)z+
        Load instance from state.
        Nrr�rPrrrrOszConverter.__setstate__N)rvrPrVrP)rvrPrrPrVrP)r#r$r%r&r>rrPr1rrrrrrrr�
s	
cCrWrXrYr=rrrr�VrZrhc
sjt�d|�}t|t�r|}nt|ttf�rdd�|D�}nd}t|��|�dd�}|�dd�}|�dd�}	i�|dur@��|�|durH|�d<|durP|�d<|	durX|	�d<t	�
||i�fd	d
��}
t�t
t��t�d�j�dd
�|
_Wd�n1s�wY|�dd�}t||�d�|�d�d�\|d<|d<tdd|i|��|
�}dd�|��D�|_|S)a
    A quick way to create a new class called *name* with *attrs*.

    .. note::

        ``make_class()`` is a thin wrapper around `attr.s`, not `attrs.define`
        which means that it doesn't come with some of the improved defaults.

        For example, if you want the same ``on_setattr`` behavior as in
        `attrs.define`, you have to pass the hooks yourself: ``make_class(...,
        on_setattr=setters.pipe(setters.convert, setters.validate)``

    .. warning::

        It is *your* duty to ensure that the class name and the attribute names
        are valid identifiers. ``make_class()`` will *not* validate them for
        you.

    Args:
        name (str): The name for the new class.

        attrs (list | dict):
            A list of names or a dictionary of mappings of names to `attr.ib`\
            s / `attrs.field`\ s.

            The order is deduced from the order of the names or attributes
            inside *attrs*.  Otherwise the order of the definition of the
            attributes is used.

        bases (tuple[type, ...]): Classes that the new class will subclass.

        class_body (dict):
            An optional dictionary of class attributes for the new class.

        attributes_arguments: Passed unmodified to `attr.s`.

    Returns:
        type: A new class with *attrs*.

    .. versionadded:: 17.1.0 *bases*
    .. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained.
    .. versionchanged:: 23.2.0 *class_body*
    .. versionchanged:: 25.2.0 Class names can now be unicode.
    �NFKCcSsi|]}|t��qSr)rMr�rrrr:�r!zmake_class.<locals>.<dictcomp>z(attrs argument must be a dict or a list.rNrrcs
|���Sr*)r#)re�rurrr��r�zmake_class.<locals>.<lambda>r	r#�__main__r4r:r<Tr�cSs"i|]
\}}|jdur||j�qSr*)r/r7rrrr:�sr)�unicodedata�	normalizerErrFrGrA�popr#rC�	new_classr0r1r2rBr�	_getframe�	f_globalsr�r$r�r�r�r~)
r�ry�bases�
class_body�attributes_argumentsrarLr	r�	user_init�type_r4r�rrjr�
make_classksP0

�����rw)rr�c@seZdZdZe�Zdd�ZdS)�
_AndValidatorz2
    Compose many validators to a single one.
    cCs|jD]}||||�qdSr*)�_validators)rr�r�r�r9rrrr[�s
�z_AndValidator.__call__N)r#r$r%r&rMryr[rrrrrx�srxcGs6g}|D]}|�t|t�r|jn|g�qtt|��S)a
    A validator that composes multiple validators into one.

    When called on a value, it runs all wrapped validators.

    Args:
        validators (~collections.abc.Iterable[typing.Callable]):
            Arbitrary number of validators.

    .. versionadded:: 17.1.0
    )r�rErxryrG)�
validatorsr>r2rrrrI�s��rIcs�tdd��D��}|r�fdd�}n�fdd�}�s(td�}|j�||d��n*t�d���}|r7||jd	<�d
}tsEt|t�rE|j	}t|��
�}|rR||jd<|r[t|ddd
�S|S)a�
    A converter that composes multiple converters into one.

    When called on a value, it runs all wrapped converters, returning the
    *last* value.

    Type annotations will be inferred from the wrapped converters', if they
    have any.

        converters (~collections.abc.Iterable[typing.Callable]):
            Arbitrary number of converters.

    .. versionadded:: 20.1.0
    css�|]}t|t�VqdSr*�rEr)r��crrrr�
rVzpipe.<locals>.<genexpr>cs,�D]}t|t�r||||�n||�}q|Sr*r{)r�r�r�r|��
convertersrr�pipe_converters�zpipe.<locals>.pipe_convertercs�D]}||�}q|Sr*r)r�r|r}rrrs
�A)r�rVrr�r_rVTr^)r�rr~r#rrcrrErr[rd)r~�return_instancerr��t�lastrfrr}rrH�s&


rH)NrN)
rOrPrQrRrSrTrUrPrVrWr*)
rOrPrUrPrQrRr]rTrVr^)rlrPrmrnrVr/)rVr�)rVrx)T)NNNNNNNFFTFFFFFNNFFNNNTN)r�r/r�rPrVrP)
r�r/ryrzrrrrrVr�)r�r/ryrz)ryrFrVr�)rVr�)NN)rVrr r!)rvrPr�rPrrrVrP)rrrrr�r|)ryrzr�rr#rr$rr
rr%rr&rr�r|rrrrr
rr'rPrVr)r�rPrVrP)i�
__future__rr+r0rIr'r	rLrdrrCrl�collections.abcrr�	functoolsr�typingrrrrNr
rrr
rrrrr�
exceptionsrrrr�objectr�r�r0r�rKrDrEr/rHrr
r�Enumrr�intr)rMr\rkrwrxr�r�r�r�r�r�r�r�r�r�r�r@r�ryr�r�r�rzr�r�r�r�r�rdr�r�rrr�rrrrr"rr�r�r>�_arJrD�_frrwrxrIrrrr�<module>s4 		

�n��
#
!
l4:N,
�
�d



H
%
8

9.

E





/
K�
��	'
�d
��
�
k