o
    †ôj‘ž ã                   @  sl  d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlmZmZ d dlmZ d dlmZmZmZ ddlmZmZmZ ddlmZmZmZmZmZmZ dd	l m!Z!m"Z"m#Z#m$Z$ e%j&Z'd
Z(dZ)dZ*e
 +i ¡Z,e%ƒ Z-e .ej/ej0¡Z1G dd„ dej2ƒZ3e3j4Z4	 G dd„ de5ƒZ6e4ddddddddddddddfdd„Z7		d®d¯dd„Z8	d°d±d"d#„Z9d²d(d)„Z:G d*d+„ d+eƒZ;d,d-„ Z<d.d/„ Z=d³d1d2„Z>d3d4„ Z?d´d5d6„Z@d7d8„ ZAd9d:„ ZBd;d<„ ZCd=d>„ ZDG d?d@„ d@ƒZEdAdB„ ZFdCdD„ ZG	dµdEdF„ZH								G	G		G	G	G	G	G			G	G						d¶dHdI„ZIeIZJ	 dJdK„ ZKd·dNdO„ZLd¸dUdV„ZMd¹dWdX„ZNdYdZ„ ZOdºd\d]„ZPd^d_„ ZQd°d`da„ZRd»dbdc„ZSd¼ddde„ZTdfdg„ ZUdhdi„ ZVdjdk„ Z0dldm„ ZWd½dodp„ZXd¾dtdu„ZYd¿dxdy„ZZdÀd{d|„Z[d¿d}d~„Z\dÁd‚dƒ„Z]dÂdŽd�„Z^dÃd‘d’„Z_G d“d”„ d”ƒZ`d•d–„ e`jaD ƒZbeNeReTe`ebd—�d˜d–„ ebD ƒd—�d™d–„ ebD ƒd—�Z`G dšd›„ d›ƒZceReTecƒƒZcG dœd�„ d�ƒZddžd–„ edjaD ƒZeeReTedeed—�eed—�ZdG dŸd „ d ƒZfd¡d–„ efjaD ƒZgeNeReTefegd—�egd—�egd—�ZfG d¢dw„ dwƒZhd£d–„ d¤D ƒZgeNeReTehegd—�egd—�egd—�Zhe%fdfd¥d¦„ZieIddd§�G d¨d©„ d©ƒƒZjdªd«„ Zkd¬d­„ Z.dS )Äé    )Ú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)ztyping.ClassVarz
t.ClassVarÚClassVarztyping_extensions.ClassVarZ_attrs_cached_hashc                   @  s(   e Zd ZdZe ¡ Zdd„ Zdd„ ZdS )Ú_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.
    c                 C  ó   dS )NÚNOTHING© ©Úselfr   r   ú]/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/attr/_make.pyÚ__repr__K   ó   z_Nothing.__repr__c                 C  r   )NFr   r   r   r   r   Ú__bool__N   r    z_Nothing.__bool__N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚenumÚautor   r   r!   r   r   r   r   r   >   s
    
r   c                   @  s"   e Zd ZdZedƒdfdd„ZdS )Ú_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.
    Nr   c                 C  s   ||fS ©Nr   )r   Z_none_constructorÚ_argsr   r   r   Ú
__reduce__f   ó   z_CacheHashWrapper.__reduce__)r"   r#   r$   r%   Útyper+   r   r   r   r   r(   Z   s    r(   Tc                 C  s4  t |||dƒ\}}}}|dur|dur|durd}t|ƒ‚|	dur9| tur+d}t|ƒ‚t|	ƒs5d}t|ƒ‚t|	ƒ} |du r?i }t|ttfƒrKt	j
|Ž }|rXt|ttfƒrXt|Ž }|ret|ttfƒret
|Ž }tdi d| “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*
    .. versionchanged:: 25.4.0
       *kw_only* can now be None, and its default is also changed from False to
       None.
    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)r/   r0   r1   r2   r3   r4   r6   r-   r5   Úfactoryr7   r8   r:   r<   r=   r9   r;   Úmsgr   r   r   Úattribj   sp   :ÿÿ
ÿþýüûúùø	÷
öõôóòñðrK   Ú ÚscriptÚstrÚglobsúdict[str, Any] | NoneÚlocsúMapping[str, object] | NoneÚfilenameÚreturnÚNonec                 C  s   t | |dƒ}t|||ƒ dS )z[
    Evaluate the script with the given global (globs) and local (locs)
    variables.
    ÚexecN)ÚcompileÚeval)rM   rO   rQ   rS   Úbytecoder   r   r   Ú_compile_and_evalØ   s   
rZ   Úlocalsúdict[str, Any]c           	      C  s|   |du ri n|}d}|}	 t | ƒd|  d¡|f}tj ||¡}||kr$n|dd… › d|› d�}|d7 }qt| |||ƒ |S )zP
    Cache the script with _linecache_, compile it and return the _locals_.
    Nr	   Téÿÿÿÿú-ú>)ÚlenÚ
splitlinesÚ	linecacheÚcacheÚ
setdefaultrZ   )	rM   rS   rO   r[   rQ   ÚcountÚbase_filenameZlinecache_tupleZold_valr   r   r   Ú_linecache_and_compileæ   s"   
üôrg   Úcls_nameÚ
attr_namesú	list[str]r-   c                 C  sF   | › d�}i }t |ƒD ]\}}|fdd„}t|ƒ||< qt|tf|ƒ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))
    Ú
Attributesc                 S  s   | | S r)   r   )r   Úir   r   r   Úgetter  r,   z&_make_attr_tuple_class.<locals>.getter)Ú	enumerateÚpropertyr-   rE   )rh   ri   Zattr_class_nameÚbodyrl   Ú	attr_namerm   r   r   r   Ú_make_attr_tuple_class	  s   

rr   c                   @  s&   e Zd ZU ded< ded< ded< dS )Ú_Attributesr-   Úattrsúlist[Attribute]Ú
base_attrsúdict[str, type]Zbase_attrs_mapN)r"   r#   r$   Ú__annotations__r   r   r   r   rs      s   
 rs   c                 C  s2   t | ƒ} |  d¡r|  d¡r| dd… } |  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]   )rN   Ú
startswithÚendswithÚ_CLASSVAR_PREFIXES)Zannotr   r   r   Ú_is_class_var&  s   
r~   c                 C  s
   || j v S )zR
    Check whether *cls* defines *attrib_name* (and doesn't just inherit it).
    )Ú__dict__)ÚclsZattrib_namer   r   r   Ú_has_own_attribute7  s   
r�   ú'tuple[list[Attribute], dict[str, type]]c                 C  s¨   g }i }t | jdd… ƒD ]$}t|dg ƒD ]}|js|j|v r q|jdd�}| |¡ |||j< qqg }tƒ }t |ƒD ]}|j|v rCq;| d|¡ | 	|j¡ q;||fS )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_namesrv   Úbase_attr_mapÚbase_clsÚaÚfilteredÚseenr   r   r   Ú_collect_base_attrs>  s$   
ú
r•   c                 C  sn   g }i }| j dd… D ]'}t|dg ƒD ]}|j|v rq|jdd�}| |j¡ | |¡ |||j< qq||fS )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�   rv   r�   r‘   r’   r   r   r   Ú_collect_base_attrs_broken_  s   

ù	r–   c              	     s~  | j ‰t| ƒ‰ |durt| ¡ ƒ}nd|du rgdd„ ˆ ¡ D ƒ}g }tƒ }ˆ  ¡ D ]$\}	}
t|
ƒr1q(| |	¡ ˆ |	t¡}|j	t
urEt|ƒ}| |	|f¡ q(|| }|rftdd t|‡fdd„d	�¡ d
 ƒ‚ntdd„ ˆ ¡ D ƒdd„ d	�}tj‰tjj‰‡ ‡‡‡fdd„|D ƒ}|r˜t| dd„ |D ƒƒ\}}nt| dd„ |D ƒƒ\}}ˆtjju r¸dd„ |D ƒ}dd„ |D ƒ}|| }|D ]}|jsÖt |¡dt|jƒƒ t |¡ddƒ q¾|durât|| |ƒƒ}d}dd„ |D ƒD ]!}|du rÿ|jtu rÿd|›�}t|ƒ‚|du �r|jtu�rd}që|D ]}|j�s(t |¡dt|jƒƒ t |¡ddƒ �qdd„ |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`.
    NTc                 S  s   h | ]\}}|j tu r|’qS r   ©Ú	__class__rH   ©Ú.0r‰   Úattrr   r   r   Ú	<setcomp>“  s
    
þz#_transform_attrs.<locals>.<setcomp>z1The following `attr.ib`s lack a type annotation: ú, c                   s   ˆ   | ¡jS r)   )ÚgetÚcounter)Ún)Úcdr   r   Ú<lambda>©  s    z"_transform_attrs.<locals>.<lambda>)ÚkeyÚ.c                 s  s&   � | ]\}}|j tu r||fV  qd S r)   r—   r™   r   r   r   Ú	<genexpr>¯  s   € 
þýz#_transform_attrs.<locals>.<genexpr>c                 S  s
   | d j S ©Nr	   )rŸ   )Úer   r   r   r¢   ´  ó   
 c              	     s(   g | ]\}}ˆ||ˆˆuˆ   |¡ƒ‘qS r   )rž   )rš   rq   Úca)ÚannsÚfcar7   Únor   r   Ú
<listcomp>¹  s    úüÿz$_transform_attrs.<locals>.<listcomp>c                 S  ó   h | ]}|j ’qS r   ©r‰   ©rš   r’   r   r   r   rœ   Å  ó    c                 S  r®   r   r¯   r°   r   r   r   rœ   É  r±   c                 S  ó   g | ]}|j d d�‘qS ©T)r7   ©rŠ   r°   r   r   r   r­   Í  ó    c                 S  r²   r³   r´   r°   r   r   r   r­   Î  rµ   r=   Úalias_is_defaultFc                 s  s(   � | ]}|j d ur|jd u r|V  qdS )FN)r4   r7   r°   r   r   r   r¥   ä  s   €& zlNo mandatory attributes allowed after an attribute with a default value or factory.  Attribute in question: c                 S  s   g | ]}|j ‘qS r   r¯   r°   r   r   r   r­   õ  r±   )#r   r   rD   ÚitemsrŒ   r~   rŽ   rž   r   r˜   rH   rK   r‹   r   ÚjoinÚsortedÚ	AttributeÚfrom_counting_attrÚ
ClassPropsÚKeywordOnlyÚNOr•   r–   ÚFORCEr=   Ú_OBJ_SETATTRÚ__get__Ú_default_init_alias_forr‰   rE   r/   r@   rr   r"   rs   )r€   ÚtheseÚauto_attribsr7   Úcollect_by_mroÚfield_transformerZca_listZca_namesZannot_namesrq   r-   r’   ZunannotatedZ	own_attrsrv   r�   rt   Zhad_defaultrJ   ri   Z
AttrsClassr   )rª   r¡   r«   r7   r¬   r   Ú_transform_attrs{  s–   þ

ÿÿüÿÿ	þú	ù

ÿÿ€
€€rÇ   c                 C  sn   g d¢}|d ur|  d¡ n| g d¢¡ | ddg¡ t|dƒ}| tj|dœ}td |¡||d	|id
�d S )N)	zdef 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Á   rg   r¸   )rÈ   rÊ   r€   ÚlinesZunique_filenameÚglobr   r   r   Ú_make_cached_property_getattrû  s.   ÿÿþÿ
ýÿþrÒ   c                 C  s(   t | tƒr|dv rt | ||¡ dS t‚)z4
    Attached to frozen classes as __setattr__.
    )Ú	__cause__Ú__context__Ú__traceback__Ú__suppress_context__Ú	__notes__N)rC   ÚBaseExceptionÚ__setattr__r   ©r   r‰   Úvaluer   r   r   Ú_frozen_setattrs/  s   rÜ   c                 C  s&   t | tƒr|dkrt | |¡ dS t‚)z4
    Attached to frozen classes as __delattr__.
    r×   N)rC   rØ   Ú__delattr__r   )r   r‰   r   r   r   Ú_frozen_delattrs@  s   rÞ   c            	      O  s„   z| \}W n t y   dt| ƒ› d�}t|ƒd‚w |j}t|ƒ}|D ]}|js)q#|j}|j}||vr:t||ƒ||< q#|di |¤Ž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   )	r@   r`   r?   r˜   Úfieldsr4   r‰   r=   rˆ   )	ÚargsÚchangesÚinstrJ   r€   rt   r’   rq   Ú	init_namer   r   r   rŠ   K  s$   %
ÿ
ü€rŠ   c                   @  s¼   e Zd ZdZdZd7d
d„Zdd„ Zd8dd„Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd9d2d3„Zd9d4d5„Zd6S ):Ú_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-   rÄ   ÚboolÚpropsr¼   Úhas_custom_setattrc                 C  s&  t ||||j|j|jƒ\}}}|| _|jrt|jƒni | _|| _	dd„ |D ƒ| _
|| _tdd„ |D ƒƒ| _|j| _|j| _|j| _|jtjju | _tt|ddƒƒ| _d| _| jrh|j}	t |	¡}
t|
j ƒdk| _tt|ddƒƒ| _!t|ƒ | _"|j#| _$|j%| _&|| _'d| _(| j	| jd	< || jd
< |jr¡t)| jd< t*| jd< d| _(nC| j&t+t,j-t,j.fv räd }}|D ]}|j/d urºd}|j0d urÁd}|rÇ|rÇ nq±| j&t+krÑ|sÑ|rá| j&t,j-krÙ|rá| j&t,j.krä|säd | _&|j1ró|  2¡ \| jd< | jd< g | _3d| _4t5| jdƒ�rt5| jdƒ�s| j6| _7d S | j8| _7d S )Nc                 S  r®   r   r¯   r°   r   r   r   rœ   ¶  r±   z)_ClassBuilder.__init__.<locals>.<setcomp>c                 s  s   � | ]}|j V  qd S r)   r¯   r°   r   r   r   r¥   ¸  s   € z)_ClassBuilder.__init__.<locals>.<genexpr>Ú__attrs_pre_init__Fr	   Ú__attrs_post_init__rƒ   Z__attrs_props__rÙ   rÝ   TÚ__getstate__Ú__setstate__r#   r$   )9rÇ   r7   Úcollected_fields_by_mrorÆ   rÌ   Ú
is_slottedÚdictr   rë   rç   ré   rè   rE   ræ   rö   Ú	is_frozenrí   Úhas_weakref_slotr÷   Úhashabilityr¼   ÚHashabilityÚHASHABLE_CACHEDrê   rù   rˆ   rð   ró   rü   ÚinspectÚ	signaturer`   Ú
parametersrï   rì   Úis_exceptionrñ   Úon_setattr_hookrò   rî   rø   rÜ   rÞ   Ú_DEFAULT_ON_SETATTRr   ÚvalidateÚconvertr0   r5   Úadded_picklingÚ_make_getstate_setstaterõ   rô   ÚhasattrÚ_add_method_dunders_saferå   Ú_add_method_dunders_unsafe)r   r€   rÃ   rÄ   rú   rû   rt   rv   Zbase_mapZpre_init_funcZpre_init_signatureZhas_validatorZhas_converterr’   r   r   r   Ú__init__¢  s�   
ú	ÿ



ý

€
ÿÿýþÿz_ClassBuilder.__init__c                 C  s   d| j j› d�S )Nz<_ClassBuilder(cls=z)>)rÌ   r"   r   r   r   r   r     s   z_ClassBuilder.__repr__rT   rU   c                 C  sl   d  dd„ | jD ƒ¡}i }| jD ]
\}}}| |¡ qt|t| jdƒ|ƒ}| jD ]\}}}|| j|ƒ q(dS )z=
        Evaluate any registered snippets in one go.
        rË   c                 S  s   g | ]}|d  ‘qS )r   r   )rš   Úsnippetr   r   r   r­     ó    z0_ClassBuilder._eval_snippets.<locals>.<listcomp>ÚmethodsN)r¸   rõ   Úupdaterg   rÏ   rÌ   rë   )r   rM   rO   Ú_Zsnippet_globsrQ   Úhookr   r   r   Ú_eval_snippets
  s   
ýÿz_ClassBuilder._eval_snippetsc                 C  sb   |   ¡  | jdu r|  ¡ }t |¡| j_n|  ¡ }tr t	 
|¡}t|ddƒr/d|jvr/| ¡  |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ÚweakrefÚrefrÌ   Z__attrs_base_of_slotted__Ú_patch_original_classr   ÚabcÚupdate_abstractmethodsrˆ   r   r  )r   r€   r   r   r   Úbuild_class  s   


ÿ
z_ClassBuilder.build_classc              	   C  s²   | j }| j}| jr5| jD ](}||vr4t||tƒtur4t t¡� t	||ƒ W d  ƒ n1 s/w   Y  q| j
 ¡ D ]
\}}t|||ƒ q:| jsWt|ddƒrWd|_| jsWt|_|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·   Úsetattrrø   r%  rî   rÀ   rÙ   )r   r€   Ú
base_namesr‰   rÛ   r   r   r   r!  5  s&   
ÿ€ÿz#_ClassBuilder._patch_original_classc              
     sÎ  ‡fdd„ˆj  ¡ D ƒ}ttdƒrt ˆj¡ ˆjs5d|d< ˆjs5ˆjjD ]‰ ˆ j	 
dd¡r4t|d<  nq%i }d}ˆjjdd… D ]‰ ˆ j	 
d	d
¡d
urNd}| ‡ fdd„tˆ dg ƒD ƒ¡ qAtˆjƒ‰ˆj}ˆjr}d	tˆjddƒvr}d	|vr}|s}|d7 }dd„ | ¡ D ƒ}g }|rÌtˆjƒ}| ¡ D ]!\}}	||f7 }||= | |	¡ t |	¡j}
|
tjjur´|
||< q“| 
d¡}|d
urÃ| |¡ t||ˆjƒ|d< ‡fdd„|D ƒ‰‡fdd„| ¡ D ƒ‰‡fdd„ˆD ƒ‰| ˆ¡ ˆjröˆ t¡ tˆƒ|d< ˆjj|d< tˆjƒˆjj ˆjj|ƒ}t! "|j	 #¡ |¡D ]L}t$|t%t&fƒ�r*t|j'dd
ƒ}nt$|t(ƒ�r8t|j)dd
ƒ}nt|dd
ƒ}|�sC�q|D ]}z|j*ˆju }W n t+�yZ   Y �qEw |�ra||_*�qE�q|S )zL
        Build and return a new class with a `__slots__` attribute.
        c                   s2   i | ]\}}|g t ˆ jƒ¢d ‘d‘R vr||“qS )r   Ú__weakref__)rE   ræ   ©rš   ÚkÚvr   r   r   Ú
<dictcomp>]  s
    þz5_ClassBuilder._create_slots_class.<locals>.<dictcomp>Ú_clear_type_descriptorsFr%  rÙ   r	   r]   r-  NTc                   ó   i | ]}|t ˆ |ƒ“qS r   ©rˆ   ©rš   r‰   )r‘   r   r   r1  €  s    
ÿÿÚ	__slots__r   )r-  c                 S  s"   i | ]\}}t |tƒr||j“qS r   )rC   r   Úfunc)rš   r‰   Zcached_propr   r   r   r1  ‘  s    ýÿrÍ   c                   ó   g | ]}|ˆ vr|‘qS r   r   r5  )r,  r   r   r­   °  rµ   z5_ClassBuilder._create_slots_class.<locals>.<listcomp>c                   s   i | ]\}}|ˆ v r||“qS r   r   )rš   ÚslotZslot_descriptor)Ú
slot_namesr   r   r1  ¶  s
    þc                   r8  r   r   r5  )Úreused_slotsr   r   r­   »  rµ   r$   Ú__closure__),rë   r·   r  Úsysr2  rÌ   rø   rî   Ú	__bases__r   rž   rÀ   r‡   r  rˆ   rŒ   ré   ræ   r÷   r   r‹   r  r	  Úreturn_annotationÚ	ParameterÚemptyrÒ   rê   Ú_HASH_CACHE_FIELDrE   r$   r-   r"   Ú	itertoolsÚchainÚvaluesrC   ÚclassmethodÚstaticmethodÚ__func__ro   ÚfgetÚcell_contentsr@   )r   r¡   Zexisting_slotsZweakref_inheritedÚnamesrÈ   Z&additional_closure_functions_to_updateÚclass_annotationsr‰   r7  Ú
annotationrÊ   r€   ÚitemÚclosure_cellsÚcellÚmatchr   )r‘   r,  r;  r   r:  r   r  Y  s¨   
þ

þ

þÿ
ÿÿþ


€

ÿ
þ


ÿþ€ø	z!_ClassBuilder._create_slots_classc                   s8   t ˆ j|ƒ\}}‡ fdd„}ˆ j |||f¡ dˆ _ˆ S )Nc                   ó   ˆ   |d ¡| d< d S )Nr   ©rå   ©Úcls_dictrO   r   r   r   Ú_attach_reprë  ó   z,_ClassBuilder.add_repr.<locals>._attach_reprT)Ú_make_repr_scriptrç   rõ   r‹   rô   )r   ÚnsrM   rO   rV  r   r   r   Úadd_reprè  s
   z_ClassBuilder.add_reprc                 C  s.   | j s	d}t|ƒ‚dd„ }|  |¡| jd< | S )Nz3__str__ can only be generated if a __repr__ exists.c                 S  s   |   ¡ S r)   ©r   r   r   r   r   Ú__str__÷  r,   z&_ClassBuilder.add_str.<locals>.__str__r\  )rô   r@   rå   rë   )r   rJ   r\  r   r   r   Úadd_strò  s   z_ClassBuilder.add_strc                   s<   t dd„ | jD ƒƒ‰‡fdd„}| j‰ ‡ ‡fdd„}||fS )zF
        Create custom __setstate__ and __getstate__ methods.
        c                 s  s   � | ]	}|d kr|V  qdS )r-  Nr   )rš   Úanr   r   r   r¥     s   € ÿz8_ClassBuilder._make_getstate_setstate.<locals>.<genexpr>c                   s   ‡ fdd„ˆD ƒS )ú9
            Automatically created by attrs.
            c                   r3  r   r4  r5  r   r   r   r1  
  rµ   zQ_ClassBuilder._make_getstate_setstate.<locals>.slots_getstate.<locals>.<dictcomp>r   r   )Ústate_attr_namesr   r   Úslots_getstate  ó   z=_ClassBuilder._make_getstate_setstate.<locals>.slots_getstatec                   sj   t  | ¡}t|tƒrtˆ|ƒD ]	\}}|||ƒ qnˆD ]}||v r)|||| ƒ qˆ r3|tdƒ dS dS )r_  N)rÀ   rÁ   rC   rE   ÚziprB  )r   ÚstateZ_ClassBuilder__bound_setattrr‰   rÛ   ©Zhash_caching_enabledr`  r   r   Úslots_setstate  s   

ÿ€ÿz=_ClassBuilder._make_getstate_setstate.<locals>.slots_setstate)rE   ræ   rê   )r   ra  rf  r   re  r   r  ý  s   ÿz%_ClassBuilder._make_getstate_setstatec                 C  s   d | j d< | S ©NÚ__hash__)rë   r   r   r   r   Úmake_unhashable&  s   
z_ClassBuilder.make_unhashablec                   s@   t ˆ jˆ jˆ jˆ jd�\}}d	‡ fdd„}ˆ j |||f¡ ˆ S )
N©ÚfrozenÚ
cache_hashrU  r  rQ   rT   rU   c                   rR  rg  rS  )rU  rQ   r   r   r   Úattach_hash2  rW  z+_ClassBuilder.add_hash.<locals>.attach_hash)rU  r  rQ   r  rT   rU   )Ú_make_hash_scriptrÌ   rç   rí   rê   rõ   r‹   )r   rM   rO   rm  r   r   r   Úadd_hash*  s   
üz_ClassBuilder.add_hashc                   ó`   t ˆjˆjˆjˆjˆjˆjˆjˆjˆj	ˆj
ˆjdd�\}}‰ ‡ ‡fdd„}ˆj |||f¡ ˆS )NF©Ú
attrs_initc                   ó    |d }ˆ |_ ˆ |¡| d< d S )Nr  ©rx   rå   ©rU  rO   r4   ©r   r   r   r   Ú_attach_initI  ó   z,_ClassBuilder.add_init.<locals>._attach_init©Ú_make_init_scriptrÌ   rç   rð   ró   rï   rí   rö   rê   rè   rñ   rò   rõ   r‹   )r   rM   rO   rw  r   rv  r   Úadd_init9  ó"   ôz_ClassBuilder.add_initc                 C  s   |   t¡| jd< | S )NÚ__replace__)rå   rŠ   rë   r   r   r   r   Úadd_replaceR  s   z_ClassBuilder.add_replacec                 C  s   t dd„ | jD ƒƒ| jd< d S )Nc                 s  s"   � | ]}|j r|js|jV  qd S r)   )r4   r7   r‰   )rš   Úfieldr   r   r   r¥   W  s   € ýý
ÿz/_ClassBuilder.add_match_args.<locals>.<genexpr>Ú__match_args__)rE   rç   rë   r   r   r   r   Úadd_match_argsV  s   þz_ClassBuilder.add_match_argsc                   rp  )NTrq  c                   rs  )NÚ__attrs_init__rt  ru  rv  r   r   Ú_attach_attrs_initm  rx  z8_ClassBuilder.add_attrs_init.<locals>._attach_attrs_initry  )r   rM   rO   rƒ  r   rv  r   Úadd_attrs_init]  r|  z_ClassBuilder.add_attrs_initc                   s>   ˆ j }tˆ jƒ\}}‡ fdd„}ˆ j |||f¡ t|d< ˆ S )Nc                   rR  )NÚ__eq__rS  rT  r   r   r   Ú
_attach_eq{  rW  z(_ClassBuilder.add_eq.<locals>._attach_eqÚ__ne__)rë   Ú_make_eq_scriptrç   rõ   r‹   r‡  )r   r¡   rM   rO   r†  r   r   r   Úadd_eqv  s   z_ClassBuilder.add_eqc                   s>   ˆ j }‡ fdd„tˆ jˆ jƒD ƒ\|d< |d< |d< |d< ˆ S )Nc                 3  s   � | ]}ˆ   |¡V  qd S r)   rS  )rš   Úmethr   r   r   r¥   ‡  s
   € ÿ
ÿz*_ClassBuilder.add_order.<locals>.<genexpr>Ú__lt__Ú__le__Ú__gt__Ú__ge__)rë   Ú_make_orderrÌ   rç   )r   r¡   r   r   r   Ú	add_order„  s
   
þz_ClassBuilder.add_orderc                   s‚   i ‰ | j D ]}|jp| j}|r|tjur||fˆ |j< qˆ s | S | jr)d}t|ƒ‚‡ fdd„}d| jd< |  	|¡| jd< d| _
| S )Nz7Can't combine custom __setattr__ with on_setattr hooks.c                   sD   zˆ | \}}W n t y   |}Y nw || ||ƒ}t| ||ƒ d S r)   )ÚKeyErrorrÀ   )r   r‰   Úvalr’   r  Únval©Zsa_attrsr   r   rÙ   ž  s   ÿz._ClassBuilder.add_setattr.<locals>.__setattr__Tr%  rÙ   )rç   r<   rò   r   ÚNO_OPr‰   rî   r@   rë   rå   rø   )r   r’   r<   rJ   rÙ   r   r”  r   Úadd_setattrŽ  s    
€

z_ClassBuilder.add_setattrÚmethodr   c                 C  s6   | j j|_| j j› d|j› �|_d| j j› d�|_|S )z@
        Add __module__ and __qualname__ to a *method*.
        r¤   ú$Method generated by attrs for class )rÌ   r#   r$   r"   r%   ©r   r—  r   r   r   r  ®  s
   
ÿz(_ClassBuilder._add_method_dunders_unsafec                 C  s¶   t  t¡� | jj|_W d  ƒ n1 sw   Y  t  t¡� | jj› d|j› �|_W d  ƒ n1 s5w   Y  t  t¡� d| jj› d�|_W d  ƒ |S 1 sTw   Y  |S )zL
        Add __module__ and __qualname__ to a *method* if possible.
        Nr¤   r˜  )r'  r(  r)  rÌ   r#   r$   r"   r%   r™  r   r   r   r  ¼  s   ÿÿ
ÿýz&_ClassBuilder._add_method_dunders_safeN)r€   r-   rÄ   rù   rú   r¼   rû   rù   )rT   rU   )r—  r   rT   r   )r"   r#   r$   r%   r6  r  r   r  r$  r!  r  rZ  r]  r  ri  ro  r{  r~  r�  r„  r‰  r�  r–  r  r  r   r   r   r   rä   …  s0    
e
$ 
)

 rä   c                 C  st   | durt |du|dufƒrd}t|ƒ‚| dur| | fS |du r"|}|du r(|}|du r6|du r6d}t|ƒ‚||fS )úš
    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.©Úanyr@   )r2   r8   r:   Ú
default_eqrJ   r   r   r   Ú_determine_attrs_eq_orderÌ  s   r   c           	      C  s¸   | durt |du|dufƒrd}t|ƒ‚dd„ }| dur(|| ƒ\} }| || |fS |du r2|d}}n||ƒ\}}|du rB||}}n||ƒ\}}|du rV|du rVd}t|ƒ‚||||fS )rš  Nr›  c                 S  s&   t | ƒrd| } }| |fS d}| |fS )z8
        Decide whether a key function is used.
        TN)rA   )rÛ   r£   r   r   r   Údecide_callable_or_booleanñ  s
   
ÿz>_determine_attrib_eq_order.<locals>.decide_callable_or_booleanFTrœ  r�  )	r2   r8   r:   rŸ  rJ   r¡  Zcmp_keyr9   r;   r   r   r   r>   è  s"   r>   c                 C  sF   |du s|du r
|S |du r|du r|S |D ]
}t | |ƒr  dS q|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_detectZdundersr/   Údunderr   r   r   Ú_determine_whether_to_implement  s   
ÿr¥  Fc                   s¢   ˆdurddl }|jtdƒdd� t|||dƒ\‰‰|dur |‰
tˆttfƒr,tjˆŽ ‰‡ ‡‡‡‡‡‡‡‡‡	‡
‡‡‡‡‡‡‡‡‡‡‡fdd„}| du rM|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*.
    .. versionchanged:: 25.4.0
       *kw_only* now only applies to attributes defined in the current class,
       and respects attribute-level ``kw_only=False`` settings.
    .. versionadded:: 25.4.0 *force_kw_only*
    Nr   zQThe `repr_ns` argument is deprecated and will be removed in or after August 2025.é   )Ú
stacklevelc                   sÀ  ˆpt | ƒ}ˆdu ot| tƒ}ˆot| dƒ}|r |r d}t|ƒ‚| o)t| ˆˆdƒ}tj}|r3|j}nIˆ
du r@ˆr<|j	n|j
}n<ˆ
du rH|j}n4ˆ
d u rvˆdu rYt| dƒrY|j}n#|du rj|du rjˆrf|j	n|j
}n|du rr|j}n
|j}nd}t|ƒ‚tj}ˆrŠˆr†|jn|j}	n|j}	td"i d|“d	|“d
ˆ“dˆ“dt| ˆˆdƒ“dt| ˆˆdƒ“d|“d| o¹t| ˆˆdƒ“d|“dˆ“d|	“dˆ“dˆ“dt| ˆ	ˆdˆd�“dˆ“dˆ“Ž}
|
jsæˆræd}t|ƒ‚t| ˆˆ |
|d�}|
jr÷| ˆ¡ |
jrþ| ¡  |
j�r| ¡  |
j�r| ¡  ˆ�s| ¡  |
j�r| ¡  n|
j|ju �r)| ¡  |
j�r2|  ¡  n| !¡  ˆ�r?d}t|ƒ‚t"�rLt| d ƒ�sL| #¡  t$�r\ˆ�r\t| d!ƒ�s\| %¡  | &¡ S )#NTrÙ   z/Can't freeze a class with a custom __setattr__.)r…  r‡  Frh  r.   r  r  r  r   Ú
added_init©r  Ú
added_reprr[  Úadded_eqÚadded_ordering)r‹  rŒ  r�  rŽ  r  Úadded_match_argsr7   r  Ú	added_strr  )rþ   rÿ   )r/   r  rÆ   zlInvalid value for cache_hash.  To use hash caching, hashing must be either explicitly or implicitly enabled.)rÄ   rú   rû   zFInvalid value for cache_hash.  To use hash caching, init must be True.r}  r€  r   )'Ú_has_frozen_base_classÚ
issubclassrØ   r�   r@   r¥  r¼   r  ÚLEAVE_ALONEr  ÚHASHABLEÚ
UNHASHABLEr?   r½   r¿   ÚYESr¾   Úis_hashablerä   rª  rZ  r®  r]  r«  r‰  r¬  r�  r–  ro  r  ri  r¨  r{  r„  r   r~  r   r�  r$  )r€   r  Úis_excZhas_own_setattrrJ   r8   r  r  r½   Zkworú   Úbuilder©rÄ   r£  Úauto_excrl  rÅ   Úeq_rÆ   Úforce_kw_onlyrk  Úgetstate_setstater3   r4   r7   Ú
match_argsr<   Úorder_r1   Úrepr_nsÚslotsrN   rÃ   Úweakref_slotr   r   Úwrap¡  s   ÿÿÿýÿýÿþýüÿûÿøõü€óíìëêéûèá à
#û


ÿþýzattrs.<locals>.wrap)	ÚwarningsÚwarnÚDeprecationWarningr   rC   rD   rE   r   rF   )Z	maybe_clsrÃ   r¿  r1   r2   r3   r4   rÀ  rk  rÁ  rN   rÄ   r7   rl  r¹  r8   r:   r£  rÅ   r¼  r<   rÆ   r½  Úunsafe_hashr»  rÃ  rÂ  r   r¸  r   rt   -  s$   aÿü
6 rt   c                 C  s
   | j tu S )zV
    Check whether *cls* has a frozen ancestor by looking at its
    __setattr__.
    )rÙ   rÜ   )r€   r   r   r   r¯  9  s   
r¯  r€   Ú	func_namec              	   C  s$   d|› d| j › dt| d| jƒ› d�S )zF
    Create a "filename" suitable for a function being generated.
    z<attrs generated ú r¤   r$   r_   )r#   rˆ   r"   )r€   rÇ  r   r   r   rÏ   A  s   ÿÿrÏ   ru   rk  rù   rl  útuple[str, dict]c                   s  t dd„ ˆ D ƒƒ‰ d}tt| dƒƒ‰i ‰d}d‰d‰|s!|d7 }n|d	7 }|d
7 }dˆ ‰ˆd7 ‰|g‰‡ ‡‡‡‡‡fdd„}|ryˆ |dt› d� ¡ |rc|dt› d�|d ƒ ˆ |d d ¡ n|dt› d�|d ƒ ˆ |dt› � ¡ n|d|ƒ d ˆ¡}|ˆfS )Nc                 s  s2   � | ]}|j d u s|j du r|jd u r|V  qdS )TN)r3   r8   r°   r   r   r   r¥   N  s   € (ÿz$_make_hash_script.<locals>.<genexpr>ú        r3   zdef __hash__(selfzhash((z))z):z, *zC, _cache_wrapper=__import__('attr._make')._make._CacheHashWrapper):z_cache_wrapper(ú)c              	     s˜   ˆ  ||  ˆ |dˆ› d� g¡ ˆ D ]-}|jr4d|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Î   r9   r‰   r‹   )ÚprefixÚindentr’   Úcmp_name©rt   Zclosing_bracesrO   Z	hash_funcZmethod_linesZ	type_hashr   r   Úappend_hash_computation_linesf  s   
þÿ
ÿz8_make_hash_script.<locals>.append_hash_computation_lineszif self.z	 is None:zobject.__setattr__(self, 'ú', r¦  úself.ú = zreturn self.zreturn rË   )rE   r3   rÏ   r‹   rB  r¸   )r€   rt   rk  rl  ÚtabZhash_defrÕ  rM   r   rÔ  r   rn  K  s>   ÿ
ÿÿ

rn  c                 C  s6   t | |ddd�\}}t||t| dƒd� |d | _| S )z%
    Add a hash method to *cls*.
    Frj  rh  ©rS   )rn  rZ   rÏ   rh  ©r€   rt   rM   rO   r   r   r   Ú	_add_hash“  s   
ÿÿ
rÜ  c                 C  s   |   |¡}|tu rtS | S )z^
    Check equality and either forward a NotImplemented or
    return the result negated.
    )r…  ÚNotImplemented)r   ÚotherÚresultr   r   r   r‡  ¡  s   
r‡  rD   c                 C  sÚ   dd„ | D ƒ} g d¢}i }| r_|  d¡ | D ]B}|jr<d|j› d�}|j||< |  d|› d|j› d	|› d
|j› d�	¡ n|  d|j› d|j› �¡ || d urX|d › d�|d< q|  d¡ n|  d¡ d |¡}||fS )z6
    Create __eq__ method for *cls* with *attrs*.
    c                 S  ó   g | ]}|j r|‘qS r   )r8   r°   r   r   r   r­   ±  ó    z#_make_eq_script.<locals>.<listcomp>)zdef __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‹   r9   r‰   r¸   )rt   rÐ   rO   r’   rÓ  rM   r   r   r   rˆ  ­  s(   

 ÿ€

rˆ  c                   sV   dd„ ˆ D ƒ‰ ‡ fdd„‰‡fdd„}‡fdd„}‡fd	d
„}‡fdd„}||||fS )z9
    Create ordering methods for *cls* with *attrs*.
    c                 S  rà  r   )r:   r°   r   r   r   r­   Ö  rá  z_make_order.<locals>.<listcomp>c                   s    t dd„ ‡ fdd„ˆD ƒD ƒƒS )z&
        Save us some typing.
        c                 s  s$   � | ]\}}|r||ƒn|V  qd S r)   r   )rš   rÛ   r£   r   r   r   r¥   Ü  s
   € ÿ
ÿz6_make_order.<locals>.attrs_to_tuple.<locals>.<genexpr>c                 3  s"   � | ]}t ˆ |jƒ|jfV  qd S r)   )rˆ   r‰   r;   r°   ©Úobjr   r   r¥   Þ  s   € 
ÿ)rE   râ  ©rt   râ  r   Úattrs_to_tupleØ  s
   
ÿþz#_make_order.<locals>.attrs_to_tuplec                   s    |j | j u rˆ | ƒˆ |ƒk S tS ©z1
        Automatically created by attrs.
        ©r˜   rÝ  ©r   rÞ  ©rå  r   r   r‹  ã  ó   z_make_order.<locals>.__lt__c                   s    |j | j u rˆ | ƒˆ |ƒkS tS ræ  rç  rè  ré  r   r   rŒ  ì  rê  z_make_order.<locals>.__le__c                   s    |j | j u rˆ | ƒˆ |ƒkS tS ræ  rç  rè  ré  r   r   r�  õ  rê  z_make_order.<locals>.__gt__c                   s    |j | j u rˆ | ƒˆ |ƒkS tS ræ  rç  rè  ré  r   r   rŽ  þ  rê  z_make_order.<locals>.__ge__r   )r€   rt   r‹  rŒ  r�  rŽ  r   )rt   rå  r   r�  Ò  s   				r�  c                 C  sB   |du r| j }t|ƒ\}}t||t| dƒd� |d | _t| _| S )z5
    Add equality methods to *cls* with *attrs*.
    Nr…  rÚ  )rƒ   rˆ  rZ   rÏ   r…  r‡  rÛ  r   r   r   Ú_add_eq
  s   ÿ
rë  c                 C  sî   t dd„ | D ƒƒ}dd„ |D ƒ}t|d< t|d< t|d< g }|D ]'\}}}|r+d| nd	| d
 }|tkr;d||f nd|||f }	| |	¡ q d |¡}
|du rTd}n|d }ddddddddddddd|› d|
› d�dd g}d! |¡|fS )"zC
    Create the source and globs for a __repr__ and return it.
    c                 s  s8   � | ]}|j d ur|j|j du rt n|j |jfV  qdS )FTN)r1   r‰   r4   r°   r   r   r   r¥   "  s   € 
þýz$_make_repr_script.<locals>.<genexpr>c                 S  s$   i | ]\}}}|t kr|d  |“qS )Ú_repr)r1   )rš   r‰   Úrr  r   r   r   r1  '  s    z%_make_repr_script.<locals>.<dictcomp>r
   r)  r   r×  zgetattr(self, "z", NOTHING)z	%s={%s!r}z%s={%s_repr(%s)}r�   Nz1{self.__class__.__qualname__.rsplit(">.", 1)[-1]}z.{self.__class__.__name__}zdef __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Ë   )rE   r
   r)  r   r1   r‹   r¸   )rt   rY  Zattr_names_with_reprsrO   Zattribute_fragmentsr‰   rí  rl   ÚaccessorÚfragmentZrepr_fragmentZcls_name_fragmentrÐ   r   r   r   rX    sN   þÿÿÿý
ñrX  c                 C  s>   |du r| j }t||ƒ\}}t||t| dƒd� |d | _| S )z%
    Add a repr method to *cls*.
    Nr   rÚ  )rƒ   rX  rZ   rÏ   r   )r€   rY  rt   rM   rO   r   r   r   Ú	_add_reprT  s   ÿ
rñ  c                 C  s–   t | ƒ}|du r#t| tƒs#t| ƒ}t|ddƒdu rd}t|ƒ‚t|ƒS t| ddƒ}|du rI|dur@t|ddƒ}|dur@|| _|S | ›d�}t|ƒ‚|S )aµ  
    Return the tuple of *attrs* attributes for a class or instance.

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

    Args:
        cls (type): Class or instance to introspect.

    Raises:
        TypeError: If *cls* is neither a class nor an *attrs* instance.

        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.
    .. versionchanged:: 26.1.0 Add support for instances.
    Nrƒ   z0Passed object must be a class or attrs instance.ú! is not an attrs-decorated class.)r   rC   r-   rˆ   r?   rß   rƒ   r   )r€   Úgeneric_baseÚtype_rJ   rt   r   r   r   rß   c  s"   
rß   c                 C  sJ   t | tƒsd}t|ƒ‚t| ddƒ}|du r| ›d�}t|ƒ‚dd„ |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
    zPassed object must be a class.rƒ   Nrò  c                 S  s   i | ]}|j |“qS r   r¯   r°   r   r   r   r1  °  r  zfields_dict.<locals>.<dictcomp>)rC   r-   r?   rˆ   r   )r€   rJ   rt   r   r   r   Úfields_dict–  s   

rõ  c                 C  sD   t jdu rdS t| jƒD ]}|j}|dur|| |t| |jƒƒ qdS )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   Z_run_validatorsrß   r˜   r0   rˆ   r‰   )râ   r’   r0  r   r   r   r  ³  s   
	€ýr  c                 C  s   |  | ¡}|od|jv S )z>
    Check if the attribute name comes from a slot class.
    r6  )rž   r   )Úa_namer�   r€   r   r   r   Ú_is_slot_attrÅ  s   
r÷  útuple[str, dict, dict]c                 C  s  |
d uo|
t ju}|r|rd}t|ƒ‚|p|}g }i }|D ]7}|js(|jtu r(q| |¡ |||j< |jd urJ|du rG|jt jurGd}t|ƒ‚d}q|rT|jt jurTd}qt	|||||||||	|||redndƒ\}}}| j
tjv r{| tj| j
 j¡ | t|dœ¡ |rŠtj|d< |||fS )Nz$Frozen classes can't use on_setattr.Tr‚  r  )r   Ú	attr_dictrÉ   )r   r•  r@   r4   r/   r   r‹   r‰   r<   Ú_attrs_to_init_scriptr#   r=  Úmodulesr  r   rÀ   rÁ   )r€   rt   Úpre_initÚpre_init_has_argsÚ	post_initrk  rÀ  rl  r�   r¶  Zcls_on_setattrrr  Úhas_cls_on_setattrrJ   Úneeds_cached_setattrZfiltered_attrsrù  r’   rM   rO   r   r   r   r   rz  Í  sR   ÿ


€

ô

rz  rq   Ú	value_varÚhas_on_setattrc                 C  s   d| › d|› d�S )zJ
    Use the cached object.setattr to set *attr_name* to *value_var*.
    ú
_setattr('rÖ  rË  r   ©rq   r  r  r   r   r   Ú_setattr  rb  r  r5   Ú	Converterc                 C  s   d| › d|  | |¡› d�S )zk
    Use the cached object.setattr to set *attr_name* to *value_var*, but run
    its converter first.
    r  rÖ  rË  )Ú_fmt_converter_call©rq   r  r  r5   r   r   r   Ú_setattr_with_converter  s   r	  rÛ   c                 C  s    |rt | |dƒS d| › d|› �S )zo
    Unless *attr_name* has an on_setattr hook, use normal assignment. Otherwise
    relegate to _setattr.
    Tr×  rØ  )r  )rq   rÛ   r  r   r   r   Ú_assign#  s   r
  c                 C  s*   |r	t | |d|ƒS d| › d| | |¡› �S )z�
    Unless *attr_name* has an on_setattr hook, use normal assignment after
    conversion. Otherwise relegate to _setattr_with_converter.
    Tr×  rØ  )r	  r  r  r   r   r   Ú_assign_with_converter.  s   r  rÀ  r�   rw   c                   sJ   | du r |du rdt tfS d‡ fd	d
„}d‡ fdd„}d||fS dttfS )zg
    Determine the correct setter functions based on whether a class is frozen
    and/or slotted.
    Tr   rq   rN   r  r  rù   rT   c                   s&   t | ˆ ƒrt| ||ƒS d| › d|› �S ©Nú_inst_dict['z'] = )r÷  r  r  ©r�   r   r   Ú
fmt_setterK  s   
z&_determine_setters.<locals>.fmt_setterr5   r  c                   s4   |st | ˆ ƒrt| |||ƒS d| › d| | |¡› �S r  )r÷  r	  r  r  r  r   r   Úfmt_setter_with_converterS  s
   ÿz5_determine_setters.<locals>.fmt_setter_with_converter)z_inst_dict = self.__dict__N©rq   rN   r  rN   r  rù   rT   rN   ©
rq   rN   r  rN   r  rù   r5   r  rT   rN   )r  r	  r
  r  )rk  rÀ  r�   r  r  r   r  r   Ú_determine_setters;  s   
ý
r  r  r  Úcall_pre_initrý  Úcall_post_initÚdoes_cache_hashr¶  r   rÿ  Úmethod_namec           $   
   C  s´  |rdgng }|	r|  d¡ t|||ƒ\}}}| |¡ g }g }g }g }i }ddi}| D �]Ö}|jr7|  |¡ |j}|jdupF|jtjuoF|
}|j}t	|j
tƒ}|rX|j
jrXdnd}|jdurkt	|jtƒskt|jƒ}n|j}|jdu rÜ|r°t|jf }|dur™|  |||d|› d	� ||ƒ¡ |j|| |j¡< n|  |||d|› d	� |ƒ¡ |j
j||< �n.|durÍ|  ||d
|› d�||ƒ¡ |j|| |j¡< �n|  ||d
|› d�|ƒ¡ �n|j
tu�r#|�s#|› d|› d�}|jrö|  |¡ n
|  |¡ |  |¡ |du�r|  |||||ƒ¡ |j|| |j¡< nÅ|  ||||ƒ¡ n»|�r¨|› d�}|j�r5|  |¡ n
|  |¡ |  |¡ |  d|› d�¡ t|jf }|du�r€|  d|||||ƒ ¡ |  d¡ |  d|||d | d	 ||ƒ ¡ |j|| |j¡< n!|  d||||ƒ ¡ |  d¡ |  d|||d | d	 |ƒ ¡ |j
j||< n6|j�r²|  |¡ n
|  |¡ |  |¡ |du�rÕ|  |||||ƒ¡ |j|| |j¡< n	|  ||||ƒ¡ |jdu �r|jdu�rõ|du �rõ|j||< q,|du�r|j�r|j||< q,|�r9t|d< |  d¡ |D ]&}d|j }d|j }|  d|› d|› d|j› d	�¡ |j||< |||< �q|�rA|  d¡ |�rc|�rX|�rQdt› d�} ndt› d�} ndt› d�} |  | ¡ |�ryd  d!d"„ | D ƒ¡}!|  d#|!› d	�¡ d$ |¡}d$ |¡}|�r³||�rŒd$nd› d%d$ |¡› �7 }d$ d&d'„ d(d"„ |D ƒD ƒ¡}"||�r¬d$nd7 }||"7 }|�rÁ|�rÁd)|› d	�|d*< d+}#d,|› d|› d-|�rÒ|# |¡nd.› d/�||fS )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.
    zself.__attrs_pre_init__()z$_setattr = _cached_setattr_get(self)rT   Nr   rL   Frî  rË  zattr_dict['z
'].defaultz=attr_dict['z=NOTHINGzif z is not NOTHING:rÐ  zelse:Tr   z#if _config._run_validators is True:Z__attr_validator_Z__attr_z(self, z, self.zself.__attrs_post_init__()r  z', None)r  z	'] = Noner×  z = NonerÌ  c                 s  s"   � | ]}|j rd |j› �V  qdS )r×  N)r4   r‰   r°   r   r   r   r¥   P	  s   €  z(_attrs_to_init_script.<locals>.<genexpr>zBaseException.__init__(self, r�   z*, c                 S  s   g | ]	}|› d |› �‘qS )ú=r   )rš   Zkw_arg_namer   r   r   r­   Z	  s    þÿz)_attrs_to_init_script.<locals>.<listcomp>c                 s  s   � | ]
}|  d ¡d V  qdS )r  r   N)Úsplit)rš   Zkwar   r   r   r¥   ]	  s   € zself.__attrs_pre_init__(r   z
    zdef z):
    ÚpassrË   )r‹   r  rÎ   r0   r‰   r<   r   r•  r=   rC   r/   rB   Ú
takes_selfr5   r  r4   Ú_INIT_FACTORY_PATÚ_get_global_namerI   r   r7   r-   Ú_first_param_typer   rB  r¸   )$rt   r  r  r  rý  r  r  r�   r¶  r   rÿ  r  rÐ   Úextra_linesr  r  rà   Zpre_init_argsZkw_only_argsZattrs_to_validateZnames_for_globalsr   r’   rq   r  Úarg_nameZhas_factoryZ
maybe_selfr5   Zinit_factory_nameÚargÚval_nameZinit_hash_cacheÚvalsZpre_init_kw_only_argsÚNLr   r   r   rú  j  st  ü
ÿ



ÿ
üÿ	ÿýÿ
üÿ	ÿ
ýÿ


ÿÿÿ



ÿÿÿ
üÿÿ
ÿÿ
ýÿÿ


ÿÿÿ
€


 




"ýÿÿûrú  r‰   c                 C  s
   |   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¯   r   r   r   rÂ   r	  s   
rÂ   c                   @  sn   e Zd ZdZdZ											ddd„Zdd„ Ze	dddd„ƒZdd„ Z	dd„ Z
dd„ Zdd„ ZdS )rº   az  
    *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.
    - ``alias_is_default`` (`bool`): Whether the ``alias`` was automatically
      generated (``True``) or explicitly provided by the user (``False``).
    - ``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*
    .. versionadded:: 26.1.0 *alias_is_default*

    For the full version history of the fields, see `attr.ib`.
    )r‰   r/   r0   r1   r8   r9   r:   r;   r3   r4   r6   r-   r5   r7   r…   r<   r=   r¶   NFc                 C  s  t ||p||p|dƒ\}}}}t | ¡}|d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d	|ƒ |d
|ƒ |d|ƒ |d|ƒ |d|	rVt t|	ƒ¡ntƒ |d|
ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|d u r|d u ƒ d S |ƒ d S )NTr‰   r/   r0   r1   r8   r9   r:   r;   r3   r4   r5   r6   r-   r7   r…   r<   r=   r¶   )r>   rÀ   rÁ   ÚtypesÚMappingProxyTyper  Ú_EMPTY_METADATA_SINGLETON)r   r‰   r/   r0   r1   r2   r3   r4   r…   r6   r-   r5   r7   r8   r9   r:   r;   r<   r=   r¶   Úbound_setattrr   r   r   r  Â	  s@   ÿ











ÿû




þþzAttribute.__init__c                 C  s   t ‚r)   )r   rÚ   r   r   r   rÙ   þ	  r    zAttribute.__setattr__r‰   rN   r©   rH   r7   rù   c                 C  sŠ   |d u r|j }n|j d urd|› d�}t|ƒ‚| ||j|j|jd |j|jd|j||j|j	d u r1|n|j	|j
|j|j|j|j|j|jd u ƒS )Nz>Type annotation and type argument cannot both be present for 'z'.F)r-   r@   Ú_defaultÚ
_validatorr1   r3   r4   r6   r5   r7   r8   r9   r:   r;   r<   r=   )r€   r‰   r©   r7   r-   rJ   r   r   r   r»   
  s4   
ízAttribute.from_counting_attrc                 K  sl   t   | ¡}| | ¡ ¡ d|v rd|vrt |¡ddƒ |S d|v r4d|vr4| jr4t |¡dt|jƒƒ |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
        r=   r¶   Fr‰   )ÚcopyÚ	_setattrsr·   rÀ   rÁ   r¶   rÂ   r‰   )r   rá   Únewr   r   r   rŠ   $
  s   
öþ
ÿzAttribute.evolvec                   ó   t ‡ fdd„ˆ jD ƒƒS )ú(
        Play nice with pickle.
        c                 3  s,   � | ]}|d krt ˆ |ƒntˆ jƒV  qdS )r6   N)rˆ   r  r6   r5  r   r   r   r¥   H
  s
   € ÿ
ÿz)Attribute.__getstate__.<locals>.<genexpr>©rE   r6  r   r   r   r   rþ   D
  s   þzAttribute.__getstate__c                 C  sj   t |ƒt | jƒk r*tt| j|ƒƒ}| d¡du p"| d¡t|d ƒk}g |¢|‘R }|  t| j|ƒ¡ dS )r0  r=   Nr‰   )r`   r6  r  rc  rž   rÂ   r-  )r   rd  Ú
state_dictr¶   r   r   r   rÿ   M
  s   ÿþ
ÿþzAttribute.__setstate__c                 C  sL   t  | ¡}|D ]\}}|dkr|||ƒ q|||r t t|ƒ¡ntƒ qd S )Nr6   )rÀ   rÁ   r&  r'  r  r(  )r   Zname_values_pairsr)  r‰   rÛ   r   r   r   r-  ^
  s   
ÿûüzAttribute._setattrs)NNNFNNNNNNNr)   )r‰   rN   r©   rH   r7   rù   )r"   r#   r$   r%   r6  r  rÙ   rF  r»   rŠ   rþ   rÿ   r-  r   r   r   r   rº   }	  s.    /
ì<ÿ" 	rº   c                 C  s6   g | ]}t |td |dkd dd|dkddt|ƒd�‘qS )Nr¶   TFr6   ©r‰   r/   r0   r1   r2   r8   r:   r3   r4   r…   r=   ©rº   r   rÂ   r5  r   r   r   r­   n
  s     óõÿr­   rä  c                 C  s   g | ]	}|j d kr|‘qS r„   r¯   r°   r   r   r   r­   ‚
  s    c                 C  s    g | ]}|j r|jd kr|‘qS r„   )r3   r‰   r°   r   r   r   r­   „
  s     c                   @  sn   e Zd ZdZdZg edd„ dD ƒƒ¢eddddddd	dd	ddd	dd	dd
�‘R ZdZdd„ Z	dd„ Z
dd„ ZdS )rH   a  
    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.
    )r*  r+  r=   r5   rŸ   r8   r9   r3   r4   r7   r6   r<   r:   r;   r1   r-   c                 c  s:   � | ]}t |t|ƒtd dd ddddd dd dd d�V  qd S )NTF©r‰   r=   r/   r0   r1   r2   r3   r4   r7   r8   r9   r:   r;   r…   r<   )rº   rÂ   r   r5  r   r   r   r¥   ¤
  s*   € ïñ
ÿz_CountingAttr.<genexpr>)	rŸ   r*  r1   r8   r:   r3   r4   r<   r=   r6   NTFr5  r   c                 C  st   t  jd7  _t j| _|| _|| _|| _|| _|| _|| _|| _	|| _
|| _|| _|| _|	| _|
| _|| _|| _d S r¦   )rH   Úcls_counterrŸ   r*  r+  r5   r1   r8   r9   r:   r;   r3   r4   r6   r-   r7   r<   r=   )r   r/   r0   r1   r2   r3   r4   r5   r6   r-   r7   r8   r9   r:   r;   r<   r=   r   r   r   r  Ö
  s"   
z_CountingAttr.__init__c                 C  s&   | j du r
|| _ |S t| j |ƒ| _ |S )zŒ
        Decorator that adds *meth* to the list of validators.

        Returns *meth* unchanged.

        .. versionadded:: 17.1.0
        N)r+  rG   ©r   rŠ  r   r   r   r0   û
  s
   
ÿz_CountingAttr.validatorc                 C  s    | j turt‚t|dd�| _ |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  )r*  r   r   rB   r7  r   r   r   r/   	  s   
z_CountingAttr.default)r"   r#   r$   r%   r6  rE   rº   rƒ   r6  r  r0   r/   r   r   r   r   rH   ˆ
  s<    îÿñá1%rH   c                   @  sL   e Zd ZdZG dd„ dejƒZG dd„ dejƒZdZdd„ Z	e
d	d
„ ƒZdS )r¼   a¥  
    Effective class properties as derived from parameters to `attr.s()` or
    `define()` decorators.

    This is the same data structure that *attrs* uses internally to decide how
    to construct the final class.

    Warning:

        This feature is currently **experimental** and is not covered by our
        strict backwards-compatibility guarantees.


    Attributes:
        is_exception (bool):
            Whether the class is treated as an exception class.

        is_slotted (bool):
            Whether the class is `slotted <slotted classes>`.

        has_weakref_slot (bool):
            Whether the class has a slot for weak references.

        is_frozen (bool):
            Whether the class is frozen.

        kw_only (KeywordOnly):
            Whether / how the class enforces keyword-only arguments on the
            ``__init__`` method.

        collected_fields_by_mro (bool):
            Whether the class fields were collected by method resolution order.
            That is, correctly but unlike `dataclasses`.

        added_init (bool):
            Whether the class has an *attrs*-generated ``__init__`` method.

        added_repr (bool):
            Whether the class has an *attrs*-generated ``__repr__`` method.

        added_eq (bool):
            Whether the class has *attrs*-generated equality methods.

        added_ordering (bool):
            Whether the class has *attrs*-generated ordering methods.

        hashability (Hashability): How `hashable <hashing>` the class is.

        added_match_args (bool):
            Whether the class supports positional `match <match>` over its
            fields.

        added_str (bool):
            Whether the class has an *attrs*-generated ``__str__`` method.

        added_pickling (bool):
            Whether the class has *attrs*-generated ``__getstate__`` and
            ``__setstate__`` methods for `pickle`.

        on_setattr_hook (Callable[[Any, Attribute[Any], Any], Any] | None):
            The class's ``__setattr__`` hook.

        field_transformer (Callable[[Attribute[Any]], Attribute[Any]] | None):
            The class's `field transformers <transform-fields>`.

    .. versionadded:: 25.4.0
    c                   @  s&   e Zd ZdZdZ	 dZ	 dZ	 dZdS )zClassProps.HashabilityzO
        The hashability of a class.

        .. versionadded:: 25.4.0
        ÚhashableZhashable_cacheZ
unhashableZleave_aloneN)r"   r#   r$   r%   r²  r  r³  r±  r   r   r   r   r  d  s    r  c                   @  s    e Zd ZdZdZ	 dZ	 dZdS )zClassProps.KeywordOnlyzw
        How attributes should be treated regarding keyword-only parameters.

        .. versionadded:: 25.4.0
        r¬   ÚyesÚforceN)r"   r#   r$   r%   r¾   r´  r¿   r   r   r   r   r½   t  s    r½   ©r  r  r  r  r7   r   r¨  rª  r«  r¬  r  r­  r®  r  r  rÆ   c                 C  sd   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
|| _|| _|| _|| _|| _d S r)   r;  )r   r  r  r  r  r7   r   r¨  rª  r«  r¬  r  r­  r®  r  r  rÆ   r   r   r   r  •  s    
zClassProps.__init__c                 C  s   | j tjju p| j tjju S r)   )r  r¼   r  r²  r  r   r   r   r   rµ  ¹  s   þzClassProps.is_hashableN)r"   r#   r$   r%   r&   ÚEnumr  r½   r6  r  ro   rµ  r   r   r   r   r¼     s    D$r¼   c                 C  s.   g | ]}t |td dd dddddt|ƒd�‘qS )NTFr3  r4  r5  r   r   r   r­   Á  s     óõÿc                   @  s.   e Zd ZdZdZddd„Zdd„ Zdd	„ Zd
S )rB   a÷  
    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*
    ©rI   r  Fc                 C  s   || _ || _d S r)   r=  )r   rI   r  r   r   r   r  ê  s   
zFactory.__init__c                   r/  )r0  c                 3  s   � | ]}t ˆ |ƒV  qd S r)   r4  r5  r   r   r   r¥   ò  ó   € z'Factory.__getstate__.<locals>.<genexpr>r1  r   r   r   r   rþ   î  s   zFactory.__getstate__c                 C  s&   t | j|ƒD ]
\}}t| ||ƒ qdS )r0  N)rc  r6  r+  )r   rd  r‰   rÛ   r   r   r   rÿ   ô  s   ÿzFactory.__setstate__N)F)r"   r#   r$   r%   r6  r  rþ   rÿ   r   r   r   r   rB   Õ  s    
rB   c                 C  ó(   g | ]}t |td dd dddddd�
‘qS ©NTF)
r‰   r/   r0   r1   r2   r8   r:   r3   r4   r…   ©rº   r   r5  r   r   r   r­   ü  ó    ôöÿc                   @  sL   e Zd ZdZdZdddœdd„Zedd
d„ƒZddd„Zdd„ Z	dd„ Z
dS )r  ae  
    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__r  Z_global_namer5   Útakes_fieldr  F©r  rD  c                  s¤   |ˆ _ |ˆ _|ˆ _t|ƒ}| ¡ ˆ _ˆ js ˆ js ‡ fdd„ˆ _n ˆ jr.ˆ js.‡ fdd„ˆ _nˆ js<ˆ jr<‡ fdd„ˆ _nˆ j ˆ _| ¡ }|d urP|ˆ jjd< d S d S )Nc                   s
   ˆ   | ¡S r)   ©r5   )rÛ   r  Ú__r   r   r   r¢   6  r¨   z$Converter.__init__.<locals>.<lambda>c                   s   ˆ   | |¡S r)   rF  )rÛ   ÚinstancerG  r   r   r   r¢   8  ó    ÿc                   s   ˆ   | |¡S r)   rF  )rÛ   rG  r  r   r   r   r¢   <  rI  rT   )	r5   r  rD  r   Úget_first_param_typer  rC  Úget_return_typerx   )r   r5   r  rD  ÚexÚrtr   r   r   r  -  s    
ÿzConverter.__init__rq   rN   rT   c                 C  s
   d| › �S )zh
        Return the name that a converter for an attribute name *attr_name*
        would have.
        Z__attr_converter_r   )rq   r   r   r   r  F  s   
zConverter._get_global_namer  c                 C  s‚   | j s| js|  |¡› d|› d�S | j r%| jr%|  |¡› d|› d|› d�S | j r3|  |¡› 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  rD  r  )r   rq   r  r   r   r   r  N  s   zConverter._fmt_converter_callc                 C  s   | j | j| jdœS )zx
        Return a dict containing only converter and takes_self -- the rest gets
        computed when loading.
        ©r5   r  rD  rN  r   r   r   r   rþ   _  s   ýzConverter.__getstate__c                 C  s   | j di |¤Ž dS )z+
        Load instance from state.
        Nr   r©  )r   rd  r   r   r   rÿ   j  s   zConverter.__setstate__N)rq   rN   rT   rN   )rq   rN   r  rN   rT   rN   )r"   r#   r$   r%   r6  r  rG  r  r  rþ   rÿ   r   r   r   r   r    s    	
c                 C  r?  r@  rA  r5  r   r   r   r­   q  rB  rN  c                   sj  t  d| ¡} t|tƒr|}nt|ttfƒrdd„ |D ƒ}nd}t|ƒ‚| dd¡}| dd¡}| dd¡}	i ‰ |dur@ˆ  |¡ |durH|ˆ d< |durP|ˆ d< |	durX|	ˆ d< t	 
| |i ‡ fd	d
„¡}
t tt¡� t d¡j dd¡|
_W d  ƒ n1 s€w   Y  | dd¡}t|| d¡| d¡dƒ\|d< |d< tdd|i|¤Ž|
ƒ}dd„ | ¡ 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.
    ÚNFKCc                 S  s   i | ]}|t ƒ “qS r   )rK   r°   r   r   r   r1  »  r  zmake_class.<locals>.<dictcomp>z(attrs argument must be a dict or a list.rü   Nrý   r  c                   s
   |   ˆ ¡S r)   )r  )rY  ©rp   r   r   r¢   Î  r¨   zmake_class.<locals>.<lambda>r	   r"   Ú__main__r2   r8   r:   TrÃ   c                 S  s"   i | ]\}}|j d ur||j “qS r)   )r-   r.  r   r   r   r1  ç  s    r   )ÚunicodedataÚ	normalizerC   r  rD   rE   r?   Úpopr  r&  Ú	new_classr'  r(  r)  r@   r=  Ú	_getframeÚ	f_globalsrž   r#   r   rç   r·   rx   )r‰   rt   ÚbasesZ
class_bodyZattributes_argumentsrU  rJ   rü  rþ  Z	user_initrô  r2   r€   r   rP  r   Ú
make_class†  sP   0

ÿÿüýÿrY  )rÀ  rÆ  c                   @  s   e Zd ZdZeƒ Zdd„ ZdS )Ú_AndValidatorz2
    Compose many validators to a single one.
    c                 C  s   | j D ]}||||ƒ qd S r)   )Ú_validators)r   râ   r›   rÛ   r0  r   r   r   rC  ù  s   
ÿz_AndValidator.__call__N)r"   r#   r$   r%   rK   r[  rC  r   r   r   r   rZ  ñ  s    rZ  c                  G  s6   g }| D ]}|  t|tƒr|jn|g¡ qtt|ƒƒ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Î   rC   rZ  r[  rE   )Ú
validatorsr#  r0   r   r   r   rG   þ  s   ÿýrG   c                    sº   t dd„ ˆ D ƒƒ}|r‡ fdd„}n‡ fdd„}ˆ s(tdƒ}|j ||dœ¡ n*tˆ d ƒ ¡ }|r7||jd	< ˆ d
 }tsEt|tƒrE|j	}t|ƒ 
¡ }|rR||jd< |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
    c                 s  s   � | ]}t |tƒV  qd S r)   ©rC   r  )rš   Úcr   r   r   r¥   %  r>  zpipe.<locals>.<genexpr>c                   s,   ˆ D ]}t |tƒr|| ||ƒn|| ƒ} q| S r)   r]  )r’  râ   r  r^  ©Ú
convertersr   r   Úpipe_converter)  s   ÿzpipe.<locals>.pipe_converterc                   s   ˆ D ]}|| ƒ} q| S r)   r   )r’  r^  r_  r   r   ra  3  s   
ÚA)r’  rT   r   r’  r]   rT   TrE  )rž  r   rx   r  r   rJ  r   rC   r  rC  rK  )r`  Zreturn_instancera  rb  ÚtÚlastrM  r   r_  r   rF     s&   


rF   )NrL   )
rM   rN   rO   rP   rQ   rR   rS   rN   rT   rU   r)   )
rM   rN   rS   rN   rO   rP   r[   rR   rT   r\   )rh   rN   ri   rj   rT   r-   )rT   r‚   )rT   rs   )T)NNNNNNNFFTFFFFFNNFFNNNTNT)r€   r-   rÇ  rN   rT   rN   )
r€   r-   rt   ru   rk  rù   rl  rù   rT   rÉ  )r€   r-   rt   ru   )rt   rD   rT   rÉ  )rT   rÉ  )NN)rT   rø  r  r  )rq   rN   rÛ   rN   r  rù   rT   rN   )rk  rù   rÀ  rù   r�   rw   )rt   ru   r  rù   r  rù   r  rù   rý  rù   r  rù   r  rù   r�   rw   r¶  rù   r   rù   rÿ  rù   r  rN   rT   rø  )r‰   rN   rT   rN   )lÚ
__future__r   r"  r'  r,  r&   r  rC  rb   r=  r&  rR  r  Úcollections.abcr   r   Ú	functoolsr   Útypingr   r   r   rL   r
   r   r   r   r   r   r   r   r   Ú
exceptionsr   r   r   r   ÚobjectrÙ   rÀ   r  r}   rB  r'  r(  r&  rF   r  r  r  r<  r   r   Úintr(   rK   rZ   rg   rr   rs   r~   r�   r•   r–   rÇ   rÒ   rÜ   rÞ   rŠ   rä   r   r>   r¥  rt   rç   r¯  rÏ   rn  rÜ  r‡  rˆ  r�  rë  rX  rñ  rß   rõ  r÷  rz  r  r	  r
  r  r  rú  rÂ   rº   r6  Ú_arH   r¼   Z_casrB   Ú_fr  rY  rZ  rG   r   r   r   r   Ú<module>   sH   		

ñqüü
#
!
 4:    K,
ÿ
ç  



H
%
8

93

E





/  

 rò
þû	  #ò'óbóÿ
ÿ
k