U
     T‚gÍo ã                   @  s  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 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j)¡Z*G dd„ dej+ƒZ,e,j-Z-G dd„ de.ƒZ/e-ddddddddddddddfdd„Z0d‰dd„Z1dŠdd„Z2dd„ Z3e3ddddgƒZ4dd„ Z5d d!„ Z6d"d#„ Z7d$d%„ Z8d&d'„ Z9d(d)„ Z:d*d+„ Z;d,d-„ Z<d.d/„ Z=G d0d1„ d1ƒZ>d2d3„ Z?d4d5„ Z@d‹d6d7„ZAdŒd8d„ZBeBZCd9d:„ ZDd;d<„ ZEd=d>„ ZFd?d@„ ZGdAdB„ ZHdCdD„ ZIdEdF„ ZJd�dGdH„ZKdIdJ„ ZLdŽdKdL„ZMdMdN„ ZNdOdP„ ZOdQdR„ Z)dSdT„ ZPdUdV„ ZQdWdWdXdWdYœdZd[„ZRdWdWdXd\dWd]œd^d_„ZSdWdWdXdWd`œdadb„ZTdWdWdXd\dWd]œdcdd„ZUdXdXdedfœdgdh„ZVdidXdXdXdXdXdXdedXdXdXdWdjdkœdldm„ZWdWdWdnœdodp„ZXG dqdr„ drƒZYdsdt„ eYjZD ƒZ[eGeKeMeYe[du�dvdt„ e[D ƒdu�dwdt„ e[D ƒdu�ZYG dxdy„ dyƒZ\eKeMe\ƒƒZ\G dzd{„ d{ƒZ]d|dt„ e]jZD ƒZ^eGeKeMe]e^du�e^du�e^du�Z]G d}d\„ d\ƒZ_d~dt„ dD ƒZ^eGeKeMe_e^du�e^du�e^du�Z_efdfd€d�„Z`eBddd‚�G dƒd„„ d„ƒƒZad…d†„ Zbd‡dˆ„ Z'dS )�é    )ÚannotationsN)Ú
itemgetteré   )Ú_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  s   dS )NÚNOTHING© ©Úselfr   r   ú./tmp/pip-unpacked-wheel-4oxga7l2/attr/_make.pyÚ__repr__I   s    z_Nothing.__repr__c                 C  s   dS )NFr   r   r   r   r   Ú__bool__L   s    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__d   s    z_CacheHashWrapper.__reduce__)r   r   r   r   Útyper$   r   r   r   r   r!   X   s   r!   TFc                 C  sò   t |||dƒ\}}}}|dk	r:|dk	r:|dk	r:d}t|ƒ‚|	dk	rr| tk	rVd}t|ƒ‚t|	ƒsjd}t|ƒ‚t|	ƒ} |dkr~i }t|ttfƒr–t	j
|Ž }|r°t|ttfƒr°t|Ž }|rÊt|ttfƒrÊt
|Ž }t| ||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Úalias)Ú_determine_attrib_eq_orderÚ	TypeErrorr   Ú
ValueErrorÚcallableÚFactoryÚ
isinstanceÚlistÚtupler   ÚpipeÚand_Ú_CountingAttr)r'   r(   r)   r*   r+   r,   r.   r%   r-   Úfactoryr/   r0   r2   r4   r5   r1   r3   Úmsgr   r   r   Úattribh   sX    7   ÿÿ
ðrC   Ú c                 C  s   t | |dƒ}t|||ƒ dS )z[
    Evaluate the script with the given global (globs) and local (locs)
    variables.
    ÚexecN)ÚcompileÚeval)ÚscriptÚglobsÚlocsÚfilenameÚbytecoder   r   r   Ú_compile_and_evalÓ   s    rM   c           
      C  s~   |dkri n|}d}|}t |ƒd| d¡|f}tj ||¡}	|	|krFqh|dd… › d|› d�}|d7 }qt||||ƒ ||  S )zO
    Create the method with the script given and return the method object.
    Nr   Téÿÿÿÿú-ú>)ÚlenÚ
splitlinesÚ	linecacheÚcacheÚ
setdefaultrM   )
ÚnamerH   rK   rI   ÚlocalsrJ   ÚcountÚbase_filenameZlinecache_tupleZold_valr   r   r   Ú_make_methodÜ   s    ü
rZ   c                 C  sv   | › d�}d|› d�dg}|rJt |ƒD ] \}}| d|› d|› d�¡ q&n
| d¡ ttd	œ}td
 |¡|ƒ || 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))
    Z
Attributeszclass z(tuple):z    __slots__ = ()ú    z% = _attrs_property(_attrs_itemgetter(ú))z    pass)Z_attrs_itemgetterZ_attrs_propertyÚ
)Ú	enumerateÚappendr   ÚpropertyrM   Újoin)Zcls_nameÚ
attr_namesZattr_class_nameZattr_class_templateÚiÚ	attr_namerI   r   r   r   Ú_make_attr_tuple_classù   s    


þÿ

re   Ú_AttributesÚattrsÚ
base_attrsZbase_attrs_mapc                 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   rN   )ÚstrÚ
startswithÚendswithÚ_CLASSVAR_PREFIXES)Zannotr   r   r   Ú_is_class_var#  s    ro   c                 C  s
   || j kS )zR
    Check whether *cls* defines *attrib_name* (and doesn't just inherit it).
    )Ú__dict__)ÚclsZattrib_namer   r   r   Ú_has_own_attribute4  s    rr   c                 C  s¨   g }i }t | jdd… ƒD ]H}t|dg ƒD ]6}|js*|j|kr@q*|jdd�}| |¡ |||j< q*qg }tƒ }t |ƒD ](}|j|kr†qv| d|¡ | 	|j¡ qv||fS )zQ
    Collect attr.ibs from base classes of *cls*, except *taken_attr_names*.
    r   rN   Ú__attrs_attrs__T©Ú	inheritedr   )
ÚreversedÚ__mro__Úgetattrru   rV   Úevolver_   ÚsetÚinsertÚadd)rq   Útaken_attr_namesrh   Úbase_attr_mapÚbase_clsÚaÚfilteredÚseenr   r   r   Ú_collect_base_attrs;  s"    

rƒ   c                 C  sn   g }i }| j dd… D ]N}t|dg ƒD ]<}|j|kr6q&|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   rN   rs   Trt   )rw   rx   rV   ry   r|   r_   )rq   r}   rh   r~   r   r€   r   r   r   Ú_collect_base_attrs_brokenZ  s    

r„   c              	     s"  | j ‰t| ƒ‰ |dk	r$t| ¡ ƒ}nà|dkrædd„ ˆ ¡ D ƒ}g }tƒ }ˆ  ¡ D ]X\}	}
t|
ƒrbqP| |	¡ ˆ |	t¡}t	|t
ƒsš|tkr�tƒ nt|d�}| |	|f¡ qP|| }t|ƒdkrätdd t|‡fd	d
„d�¡ d ƒ‚ntdd„ ˆ ¡ D ƒdd
„ d�}‡ fdd„|D ƒ}|�r6t| dd„ |D ƒƒ\}}nt| dd„ |D ƒƒ\}}|�rpdd„ |D ƒ}dd„ |D ƒ}|| }d}dd„ |D ƒD ]H}|dk�r¶|jtk�r¶d|›�}t|ƒ‚|dk�rŠ|jtk	�rŠd}�qŠ|dk	�rè|| |ƒ}dd„ |D ƒ}dd„ |D ƒ}t| j|ƒ}t||ƒ||fƒ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 | ]\}}t |tƒr|’qS r   ©r;   r@   ©Ú.0rV   Úattrr   r   r   Ú	<setcomp>‰  s   
þz#_transform_attrs.<locals>.<setcomp>©r'   r   z1The following `attr.ib`s lack a type annotation: ú, c                   s   ˆ   | ¡jS r"   )ÚgetÚcounter)Ún)Úcdr   r   Ú<lambda>Ÿ  ó    z"_transform_attrs.<locals>.<lambda>)ÚkeyÚ.c                 s  s$   | ]\}}t |tƒ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�   ª  r‘   c                   s&   g | ]\}}t j||ˆ  |¡d �‘qS ))rV   Úcar%   )Ú	AttributeÚfrom_counting_attrrŒ   )r‡   rd   r—   )Úannsr   r   Ú
<listcomp>­  s   ý  ÿz$_transform_attrs.<locals>.<listcomp>c                 S  s   h | ]
}|j ’qS r   ©rV   ©r‡   r€   r   r   r   r‰   ¶  s     c                 S  s   h | ]
}|j ’qS r   rœ   r�   r   r   r   r‰   º  s     c                 S  s   g | ]}|j d d�‘qS ©T)r/   ©ry   r�   r   r   r   r›   ¾  s     c                 S  s   g | ]}|j d d�‘qS rž   rŸ   r�   r   r   r   r›   ¿  s     Fc                 s  s&   | ]}|j d k	r|jd kr|V  qdS )FN)r,   r/   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 s |jt|jƒd �n|‘qS ))r5   )r5   ry   Ú_default_init_alias_forrV   r�   r   r   r   r›   Ö  s   ÿc                 S  s   g | ]
}|j ‘qS r   rœ   r�   r   r   r   r›   Ý  s     )rp   r   r<   Úitemsrz   ro   r|   rŒ   r   r;   r@   rC   r_   rQ   r   ra   Úsortedrƒ   r„   r'   r8   re   r   rf   )rq   ÚtheseÚauto_attribsr/   Úcollect_by_mroÚfield_transformerZca_listZca_namesZannot_namesrd   r%   r€   ZunannotatedZ	own_attrsrh   r~   rg   Zhad_defaultrB   rb   Z
AttrsClassr   )rš   r�   r   Ú_transform_attrsv  s„    þ

ÿÿüÿþú	
ü ÿ
 ÿ


þr§   c              
   C  s†   ddddddddd	g	}|d k	r*|  d
¡ n| ddddddddg¡ | ddg¡ t|dƒ}| tj|dœ}tdd |¡||d|id�S )Nz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)rx   )Úcached_propertiesÚ_cached_setattr_getÚoriginal_getattrÚ__getattr__r]   Ú_cls)rW   )r_   ÚextendÚ_generate_unique_filenameÚ_OBJ_SETATTRÚ__get__rZ   ra   )r¨   rª   rq   ÚlinesÚunique_filenameÚglobr   r   r   Ú_make_cached_property_getattrã  sX    õÿøÿþÿ
ý ÿûr´   c                 C  s,   t | tƒr$|dkr$t | ||¡ dS t‚dS )z4
    Attached to frozen classes as __setattr__.
    )Ú	__cause__Ú__context__Ú__traceback__Ú__suppress_context__Ú	__notes__N)r;   ÚBaseExceptionÚ__setattr__r   ©r   rV   Úvaluer   r   r   Ú_frozen_setattrs  s    r¾   c                 C  s*   t | tƒr"|dkr"t | |¡ dS t‚dS )z4
    Attached to frozen classes as __delattr__.
    )r¹   N)r;   rº   Ú__delattr__r   )r   rV   r   r   r   Ú_frozen_delattrs.  s    rÀ   c            	      O  s†   z
| \}W n. t k
r8   dt| ƒ› d�}t|ƒd‚Y nX |j}t|ƒ}|D ].}|jsXqL|j}|j}||krLt||ƒ||< qL|f |Ž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 givenN)	r8   rQ   r7   Ú	__class__Úfieldsr,   rV   r5   rx   )	ÚargsÚchangesÚinstrB   rq   rg   r€   rd   Z	init_namer   r   r   ry   9  s     %
ÿry   c                   @  s¤   e Zd ZdZ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d!d"„ Zd#d$„ Zd%d&„ Zd'S )(Ú_ClassBuilderz(
    Iteratively build *one* class.
    )Ú_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Ú_slotsÚ_weakref_slotÚ_wrote_own_setattrc                 C  sØ  t ||||||ƒ\}}}|| _|r,t|jƒni | _|| _dd„ |D ƒ| _|| _tdd„ |D ƒƒ| _	|| _
|| _|| _|	| _tt|ddƒƒ| _d| _| jr¸|j}t |¡}t|jƒdk| _tt|ddƒƒ| _t|ƒ | _|
| _|| _|| _d| _| j| jd	< |�rt| jd
< t| jd< d| _nš|tt j!t j"fk�r¶d }}|D ]8}|j#d k	�rPd}|j$d k	�r`d}|�r<|�r< �qv�q<|tk�rŒ|�sŒ|�r°|t j!k�rž|�r°|t j"k�r¶|�s¶d | _|�rÔ|  %¡ \| jd< | jd< d S )Nc                 S  s   h | ]
}|j ’qS r   rœ   r�   r   r   r   r‰   ª  s     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__rs   r»   r¿   TÚ__getstate__Ú__setstate__)&r§   r¬   Údictrp   rÌ   rÈ   rÊ   rÉ   r=   rÇ   rÕ   rÎ   rÖ   rË   Úboolrx   rÑ   rÔ   rØ   ÚinspectÚ	signaturerQ   Ú
parametersrÐ   rÍ   rÒ   rÓ   rÏ   r×   r¾   rÀ   Ú_DEFAULT_ON_SETATTRr   ÚvalidateÚconvertr(   r-   Ú_make_getstate_setstate)r   rq   r£   ÚslotsÚfrozenÚweakref_slotÚgetstate_setstater¤   r/   Ú
cache_hashÚis_excr¥   r4   Zhas_custom_setattrr¦   rg   rh   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__c                 C  sL   | j dkr|  ¡ }n|  ¡ }tr*t |¡}t|ddƒrHd|jkrH| ¡  |S )zƒ
        Finalize class based on the accumulated configuration.

        Builder cannot be used after calling this method.
        TÚ__attrs_init_subclass__N)	rÕ   Ú_create_slots_classÚ_patch_original_classr   ÚabcZupdate_abstractmethodsrx   rp   rì   )r   rq   r   r   r   Úbuild_classì  s    



ÿþz_ClassBuilder.build_classc              
   C  sž   | j }| j}| jrV| jD ]<}||krt||tƒtk	rt t¡� t	||ƒ W 5 Q R X q| j
 ¡ D ]\}}t|||ƒ q`| jsšt|ddƒršd|_| jsšt|_|S )zA
        Apply accumulated methods and return the class.
        Ú__attrs_own_setattr__F)r¬   rÊ   rÍ   rÇ   rx   Ú	_SENTINELÚ
contextlibÚsuppressÚAttributeErrorÚdelattrrÌ   r¡   Úsetattrr×   rñ   rÏ   r¯   r»   )r   rq   Ú
base_namesrV   r½   r   r   r   rî     s*    
ÿþ  ÿz#_ClassBuilder._patch_original_classc              
     sÂ  ‡fdd„ˆj  ¡ D ƒ}ˆjsTd|d< ˆjsTˆjjD ]‰ ˆ j dd¡r4t|d<  qTq4i }d}ˆjj	dd… D ]:‰ ˆ j dd	¡d	k	r†d
}| 
‡ fdd„tˆ dg ƒD ƒ¡ qltˆjƒ‰ˆj}ˆjrädtˆjddƒkräd|krä|sä|d7 }dd„ | ¡ D ƒ}g }|�rŠtˆjƒ}| ¡ D ]F\}}	||f7 }||= | |	¡ t |	¡j}
|
tjjk	�r|
||< �q| d¡}|d	k	�rx| |¡ 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 ]˜}t!|t"t#fƒ�rHt|j$dd	ƒ}n(t!|t%ƒ�rdt|j&dd	ƒ}nt|dd	ƒ}|�sz�q$|D ]:}z|j'ˆjk}W n t(k
�r¨   Y nX |�r~||_'�q~�q$|S )zL
        Build and return a new class with a `__slots__` attribute.
        c                   s(   i | ] \}}|t ˆ jƒd˜kr||“qS )rp   Ú__weakref__)rp   rù   )r=   rÇ   ©r‡   ÚkÚvr   r   r   Ú
<dictcomp>+  s   þ z5_ClassBuilder._create_slots_class.<locals>.<dictcomp>Frñ   r»   r   rN   rù   NTc                   s   i | ]}|t ˆ |ƒ“qS r   ©rx   ©r‡   rV   )r   r   r   rý   J  s   ÿ Ú	__slots__r   )rù   c                 S  s$   i | ]\}}t |tjƒr||j“qS r   )r;   Ú	functoolsÚcached_propertyÚfunc)r‡   rV   r  r   r   r   rý   [  s   þ r«   c                   s   g | ]}|ˆ kr|‘qS r   r   rÿ   )rø   r   r   r›   z  s      z5_ClassBuilder._create_slots_class.<locals>.<listcomp>c                   s   i | ]\}}|ˆ kr||“qS r   r   )r‡   ZslotZslot_descriptor)Ú
slot_namesr   r   rý   €  s   þ c                   s   g | ]}|ˆ kr|‘qS r   r   rÿ   )Úreused_slotsr   r   r›   …  s      r   Ú__closure__))rÌ   r¡   r×   rÏ   r¬   Ú	__bases__rp   rŒ   r¯   rw   Úupdaterx   rz   rÊ   rÇ   rÖ   r   r_   rÞ   rß   Úreturn_annotationÚ	ParameterÚemptyr´   rË   Ú_HASH_CACHE_FIELDr=   r   r%   r   Ú	itertoolsÚchainÚvaluesr;   ÚclassmethodÚstaticmethodÚ__func__r`   ÚfgetÚcell_contentsr8   )r   r�   Zexisting_slotsZweakref_inheritedÚnamesr¨   Z&additional_closure_functions_to_updateZclass_annotationsrV   r  Ú
annotationrª   rq   ÚitemZclosure_cellsÚcellÚmatchr   )r   rø   r  r   r  r   rí   '  s¤    
þ

þÿ
ÿþýüþ





  ÿ
þ

 ÿz!_ClassBuilder._create_slots_classc                 C  s    |   t| j|| jƒ¡| jd< | S )Nr   )Ú_add_method_dundersÚ
_make_reprrÈ   r¬   rÌ   )r   Únsr   r   r   Úadd_repr²  s    ÿ
z_ClassBuilder.add_reprc                 C  s<   | j  d¡}|d kr d}t|ƒ‚dd„ }|  |¡| j d< | S )Nr   z3__str__ can only be generated if a __repr__ exists.c                 S  s   |   ¡ S r"   ©r   r   r   r   r   Ú__str__¾  s    z&_ClassBuilder.add_str.<locals>.__str__r  )rÌ   rŒ   r8   r  )r   r)   rB   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‡   Z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                   s   i | ]}|t ˆ |ƒ“qS r   rþ   rÿ   r   r   r   rý   Ñ  s      zQ_ClassBuilder._make_getstate_setstate.<locals>.slots_getstate.<locals>.<dictcomp>r   r   )Ústate_attr_namesr   r   Úslots_getstateÍ  s    z=_ClassBuilder._make_getstate_setstate.<locals>.slots_getstatec                   sf   t  | ¡}t|tƒr4tˆ|ƒD ]\}}|||ƒ qn ˆD ]}||kr8|||| ƒ q8ˆ rb|tdƒ dS )r!  N)r¯   r°   r;   r=   Úzipr  )r   ÚstateZ_ClassBuilder__bound_setattrrV   r½   ©Zhash_caching_enabledr"  r   r   Úslots_setstateÕ  s    

z=_ClassBuilder._make_getstate_setstate.<locals>.slots_setstate)r=   rÇ   rË   )r   r#  r'  r   r&  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                 C  s(   |   t| j| j| j| jd�¡| jd< | S )N©ræ   ré   r(  )r  Ú
_make_hashr¬   rÈ   rÎ   rË   rÌ   r   r   r   r   Úadd_hashñ  s    üÿ
	z_ClassBuilder.add_hashc                 C  sF   |   t| j| j| j| j| j| j| j| j	| j
| j| jdd�¡| jd< | S )NF©Ú
attrs_initrë   ©r  Ú
_make_initr¬   rÈ   rÑ   rÔ   rÐ   rÎ   rÕ   rË   rÉ   rÒ   rÓ   rÌ   r   r   r   r   Úadd_initý  s"    ôÿ
z_ClassBuilder.add_initc                 C  s   |   dd„ ¡| jd< | S )Nc                 [  s   t | f|ŽS r"   rŸ   )r   rÄ   r   r   r   r�     r‘   z+_ClassBuilder.add_replace.<locals>.<lambda>Ú__replace__)r  rÌ   r   r   r   r   Úadd_replace  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"   )r,   r/   rV   )r‡   Úfieldr   r   r   r”     s    þz/_ClassBuilder.add_match_args.<locals>.<genexpr>Ú__match_args__)r=   rÈ   rÌ   r   r   r   r   Úadd_match_args  s    þz_ClassBuilder.add_match_argsc                 C  sF   |   t| j| j| j| j| j| j| j| j	| j
| j| jdd�¡| jd< | S )NTr-  Ú__attrs_init__r/  r   r   r   r   Úadd_attrs_init  s"    ôÿ
z_ClassBuilder.add_attrs_initc                 C  s2   | j }|  t| j| jƒ¡|d< |  tƒ ¡|d< | S )NÚ__eq__Ú__ne__)rÌ   r  Ú_make_eqr¬   rÈ   Ú_make_ne©r   r�   r   r   r   Úadd_eq2  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"   )r  )r‡   Úmethr   r   r   r”   ?  s   ÿz*_ClassBuilder.add_order.<locals>.<genexpr>Ú__lt__Ú__le__Ú__gt__Ú__ge__)rÌ   Ú_make_orderr¬   rÈ   r=  r   r   r   Ú	add_order<  s
    
þz_ClassBuilder.add_orderc                   sŒ   | j r
| S i ‰ | jD ],}|jp"| j}|r|tjk	r||fˆ |j< qˆ sJ| 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                   sF   zˆ | \}}W n t k
r(   |}Y nX || ||ƒ}t| ||ƒ d S r"   )ÚKeyErrorr¯   )r   rV   Úvalr€   ÚhookÚnval©Zsa_attrsr   r   r»   Y  s    
z._ClassBuilder.add_setattr.<locals>.__setattr__Trñ   r»   )rÎ   rÈ   r4   rÓ   r   ÚNO_OPrV   rÏ   r8   rÌ   r  r×   )r   r€   r4   rB   r»   r   rJ  r   Úadd_setattrF  s"    


z_ClassBuilder.add_setattrc              	   C  sx   t  t¡� | jj|_W 5 Q R X t  t¡� | jj› d|j› �|_W 5 Q R X t  t¡� d| jj› d�|_W 5 Q R X |S )zL
        Add __module__ and __qualname__ to a *method* if possible.
        r“   z$Method generated by attrs for class )ró   rô   rõ   r¬   r   r   r   r   )r   Úmethodr   r   r   r  i  s     ÿz!_ClassBuilder._add_method_dundersN)r   r   r   r   r   rë   r   rð   rî   rí   r  r   rä   r)  r,  r1  r3  r6  r8  r>  rE  rL  r  r   r   r   r   rÆ   s  s*   \$ )

#rÆ   c                 C  st   | dk	r(t |dk	|dk	fƒr(d}t|ƒ‚| dk	r8| | fS |dkrD|}|dkrP|}|dkrl|dkrld}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.©Úanyr8   )r*   r0   r2   Ú
default_eqrB   r   r   r   Ú_determine_attrs_eq_order|  s    rT  c           	      C  s¸   | dk	r(t |dk	|dk	fƒr(d}t|ƒ‚dd„ }| dk	rP|| ƒ\} }| || |fS |dkrd|d }}n||ƒ\}}|dkr„|| }}n||ƒ\}}|dkr¬|dkr¬d}t|ƒ‚||||fS )rN  NrO  c                 S  s    t | ƒrd|  } }nd}| |fS )z8
        Decide whether a key function is used.
        TN)r9   )r½   r’   r   r   r   Údecide_callable_or_boolean¡  s    z>_determine_attrib_eq_order.<locals>.decide_callable_or_booleanFTrP  rQ  )	r*   r0   r2   rS  rB   rU  Zcmp_keyr1   r3   r   r   r   r6   ˜  s"    r6   c                 C  sF   |dks|dkr|S |dkr(|dk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)rr   )rq   ÚflagÚauto_detectZdundersr'   Zdunderr   r   r   Ú_determine_whether_to_implementÃ  s    
rX  c                   s    ˆdk	r"ddl }|jtdƒdd� t|||dƒ\‰‰|dk	r@|‰	tˆttfƒrXtjˆŽ ‰‡ ‡‡‡‡‡‡‡‡‡	‡
‡‡‡‡‡‡‡‡‡‡fdd„}| dkr˜|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*.
    Nr   zQThe `repr_ns` argument is deprecated and will be removed in or after August 2025.é   )Ú
stacklevelc                   s  ˆp
t | ƒ}ˆdkot| tƒ}ˆo*t| dƒ}|r@|r@d}t|ƒ‚t| ˆˆ|ˆt| ˆˆdˆd�ˆ ˆˆ|ˆˆ|ˆƒ}t| ˆˆdƒrˆ| ˆ¡ ˆdkr˜| ¡  t| ˆˆdƒ}|sº|dkrº| 	¡  |sÔt| ˆˆdƒrÔ| 
¡  | ¡  ˆ	d krúˆdkrút| d	ƒrúd
‰	ˆ	dk	�r$ˆ	d
k	�r$ˆ	d k	�r$d}t|ƒ‚ˆ	d
k�sHˆ	d k�rB|d
k�sH|�r\ˆ�r¨d}t|ƒ‚nLˆ	dk�s„ˆ	d k�rŽ|dk�rŽ|dk�rŽ| ¡  nˆ�r d}t|ƒ‚| ¡  t| ˆ
ˆdƒ�rÂ| ¡  n| ¡  ˆ�rÜd}t|ƒ‚t�röt| dƒ�sö| ¡  t�rˆ�rt| dƒ�s| ¡  | ¡ S )NTr»   z/Can't freeze a class with a custom __setattr__.)rÚ   rÛ   rŠ   r  )r9  r:  )r@  rA  rB  rC  r(  Fr&   zlInvalid value for cache_hash.  To use hash caching, hashing must be either explicitly or implicitly enabled.©rë   zFInvalid value for cache_hash.  To use hash caching, init must be True.r2  r5  )Ú_has_frozen_base_classÚ
issubclassrº   rr   r8   rÆ   rX  r  r   r>  rE  rL  r7   r,  r)  r1  r8  r
   r3  r   r6  rð   )rq   Ú	is_frozenrê   Zhas_own_setattrrB   Zbuilderr0   ©r¤   rW  Úauto_excré   r¥   Zeq_r¦   ræ   rè   r+   r,   r/   Ú
match_argsr4   Zorder_r)   Úrepr_nsrå   rk   r£   rç   r   r   ÚwrapL  sÎ     ÿûì   ÿ
   ÿ   ÿÿþý$

ÿÿÿ
   ÿ
ÿþýzattrs.<locals>.wrap)	ÚwarningsÚwarnÚDeprecationWarningrT  r;   r<   r=   r   r>   )Z	maybe_clsr£   rb  r)   r*   r+   r,   rå   ræ   rç   rk   r¤   r/   ré   r`  r0   r2   rW  r¥   rè   r4   r¦   ra  Úunsafe_hashrd  rc  r   r_  r   rg   Ý  s"    \ÿü
4kc                 C  s
   | j tkS )zV
    Check whether *cls* has a frozen ancestor by looking at its
    __setattr__.
    )r»   r¾   )rq   r   r   r   r\  Ä  s    r\  c              	   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   rP   )r   rx   r   )rq   Ú	func_namer   r   r   r®   Ì  s    "ÿr®   c           	        s  t dd„ ˆ D ƒƒ‰ d}t| dƒ}t|ƒ‰i ‰d}d‰d‰|sF|d7 }n |d	7 }|d
7 }dˆ ‰ˆd7 ‰|g‰‡ ‡‡‡‡‡fdd„}|röˆ |dt› d� ¡ |rÊ|dt› d�|d ƒ ˆ |d d ¡ n|dt› d�|d ƒ ˆ |dt› � ¡ n
|d|ƒ d ˆ¡}td||ˆƒS )Nc                 s  s0   | ](}|j d ks$|j dkr|jd kr|V  qdS )TN)r+   r0   r�   r   r   r   r”   ×  s
    
 
 
 z_make_hash.<locals>.<genexpr>ú        r+   zdef __hash__(selfzhash((r\   z):z, *zC, _cache_wrapper=__import__('attr._make')._make._CacheHashWrapper):z_cache_wrapper(ú)c              	     s˜   ˆ  ||  ˆ |dˆ› d� g¡ ˆ D ]Z}|jrhd|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
        rj  ú,Ú_Ú_keyú(self.z),ú        self.r[   N)r­   r1   rV   r_   )ÚprefixÚindentr€   Úcmp_name©rg   Zclosing_bracesrI   Z	hash_funcZmethod_linesZ	type_hashr   r   Úappend_hash_computation_linesð  s    
þÿ
ÿz1_make_hash.<locals>.append_hash_computation_lineszif self.z	 is None:zobject.__setattr__(self, 'ú', rY  úself.ú = zreturn self.zreturn r]   r(  )r=   r®   r+   r_   r  ra   rZ   )	rq   rg   ræ   ré   Útabr²   Zhash_defru  rH   r   rt  r   r+  Ö  sD    ÿ


 ÿ
 ÿ

r+  c                 C  s   t | |ddd�| _| S )z%
    Add a hash method to *cls*.
    Fr*  )r+  r(  ©rq   rg   r   r   r   Ú	_add_hash  s    r{  c                  C  s   dd„ } | S )z
    Create __ne__ method.
    c                 S  s   |   |¡}|tkrtS | S )zj
        Check equality and either forward a NotImplemented or
        return the result negated.
        )r9  ÚNotImplemented)r   ÚotherÚresultr   r   r   r:  *  s    
z_make_ne.<locals>.__ne__r   )r:  r   r   r   r<  %  s    r<  c                 C  sì   dd„ |D ƒ}t | dƒ}dddg}i }|rÊ| d¡ |D ]„}|jr„d|j› d	�}|j||< | d
|› d|j› d|› d|j› d�	¡ n| d|j› d|j› �¡ ||d k	r8|d › d�|d< q8| d¡ n
| d¡ d |¡}td|||ƒS )z6
    Create __eq__ method for *cls* with *attrs*.
    c                 S  s   g | ]}|j r|‘qS r   )r0   r�   r   r   r   r›   <  s      z_make_eq.<locals>.<listcomp>r0   zdef __eq__(self, other):z-    if other.__class__ is not self.__class__:z        return NotImplementedz    return  (rm  rn  rj  ro  z) == z(other.rk  rp  z
 == other.rN   z andz    )z    return Truer]   r9  )r®   r_   r1   rV   ra   rZ   )rq   rg   r²   r±   rI   r€   rs  rH   r   r   r   r;  8  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  s   g | ]}|j r|‘qS r   )r2   r�   r   r   r   r›   b  s      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”   h  s   ÿz6_make_order.<locals>.attrs_to_tuple.<locals>.<genexpr>c                 3  s    | ]}t ˆ |jƒ|jfV  qd S r"   )rx   rV   r3   r�   ©Úobjr   r   r”   j  s    )r=   r  ©rg   r  r   Úattrs_to_tupled  s
    
ÿþz#_make_order.<locals>.attrs_to_tuplec                   s    |j | j krˆ | ƒˆ |ƒk S tS ©z1
        Automatically created by attrs.
        ©rÁ   r|  ©r   r}  ©r‚  r   r   r@  o  s    z_make_order.<locals>.__lt__c                   s    |j | j krˆ | ƒˆ |ƒkS tS rƒ  r„  r…  r†  r   r   rA  x  s    z_make_order.<locals>.__le__c                   s    |j | j krˆ | ƒˆ |ƒkS tS rƒ  r„  r…  r†  r   r   rB  �  s    z_make_order.<locals>.__gt__c                   s    |j | j krˆ | ƒˆ |ƒkS tS rƒ  r„  r…  r†  r   r   rC  Š  s    z_make_order.<locals>.__ge__r   )rq   rg   r@  rA  rB  rC  r   )rg   r‚  r   rD  ^  s    				rD  c                 C  s&   |dkr| j }t| |ƒ| _tƒ | _| S )z5
    Add equality methods to *cls* with *attrs*.
    N)rs   r;  r9  r<  r:  rz  r   r   r   Ú_add_eq–  s
    r‡  c                 C  s   t |dƒ}tdd„ | D ƒƒ}dd„ |D ƒ}t|d< t|d< t|d< g }|D ]N\}}}	|	r`d	| n
d
| d }
|tkr€d||
f nd|||
f }| |¡ qJd |¡}|d kr²d}n|d }ddddddddddddd|› d|› d�dd g}td!d" |¡||d#�S )$Nr)   c                 s  s6   | ].}|j d k	r|j|j dkr"t n|j |jfV  qdS )FTN)r)   rV   r,   r�   r   r   r   r”   ¨  s   
þz_make_repr.<locals>.<genexpr>c                 S  s$   i | ]\}}}|t kr|d  |“qS )Ú_repr)r)   )r‡   rV   Úrrm  r   r   r   rý   ­  s      z_make_repr.<locals>.<dictcomp>r   rõ   r   rw  zgetattr(self, "z", NOTHING)z	%s={%s!r}z%s={%s_repr(%s)}r‹   z1{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   r]   )rI   )	r®   r=   r   rõ   r   r)   r_   ra   rZ   )rg   r  rq   r²   Zattr_names_with_reprsrI   Zattribute_fragmentsrV   r‰  rc   ÚaccessorÚfragmentZrepr_fragmentZcls_name_fragmentr±   r   r   r   r  £  sZ    
þÿÿÿý
ñ   ÿr  c                 C  s    |dkr| j }t||| ƒ| _| S )z%
    Add a repr method to *cls*.
    N)rs   r  r   )rq   r  rg   r   r   r   Ú	_add_reprÜ  s    r�  c                 C  sv   t | ƒ}|dkr&t| tƒs&d}t|ƒ‚t| ddƒ}|dkrr|dk	r`t|ddƒ}|dk	r`|| _|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.rs   ú! is not an attrs-decorated class.)r   r;   r%   r7   rx   rs   r   )rq   Zgeneric_baserB   rg   r   r   r   rÂ   ç  s    
rÂ   c                 C  sJ   t | tƒsd}t|ƒ‚t| ddƒ}|dk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
    rŽ  rs   Nr�  c                 S  s   i | ]}|j |“qS r   rœ   r�   r   r   r   rý   /  s      zfields_dict.<locals>.<dictcomp>)r;   r%   r7   rx   r   )rq   rB   rg   r   r   r   Úfields_dict  s    

r�  c                 C  sD   t jdkrdS t| jƒD ]&}|j}|dk	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Á   r(   rx   rV   )rÅ   r€   rü   r   r   r   râ   2  s    	
râ   c                 C  s   |  | ¡}|od|jkS )z>
    Check if the attribute name comes from a slot class.
    r   )rŒ   rp   )Za_namer~   rq   r   r   r   Ú_is_slot_attrD  s    
r‘  c                 C  s6  |
d k	o|
t jk	}|r&|r&d}t|ƒ‚|p,|}g }i }|D ]b}|jsP|jtkrPq:| |¡ |||j< |jd k	rˆ|dkr‚d}t|ƒ‚d}q:|r:|jt jk	r:d}q:t	| dƒ}t
|||||||||	|||rÈdndƒ\}}}| jtjkrô| tj| j j¡ | t|dœ¡ |�rtj|d< t|�r dnd|||ƒ}||_|S )Nz$Frozen classes can't use on_setattr.Tr,   r7  rë   )r   Ú	attr_dictr©   )r   rK  r8   r,   r'   r   r_   rV   r4   r®   Ú_attrs_to_init_scriptr   ÚsysÚmodulesr  rp   r¯   r°   rZ   Ú__annotations__)rq   rg   Úpre_initÚpre_init_has_argsÚ	post_initræ   rå   ré   r~   rê   Zcls_on_setattrr.  Úhas_cls_on_setattrrB   Úneeds_cached_setattrZfiltered_attrsr’  r€   r²   rH   rI   r   r,   r   r   r   r0  L  s`    ÿ




ô

ür0  rk   rÝ   ©rd   Ú	value_varÚhas_on_setattrÚreturnc                 C  s   d| › d|› d�S )zJ
    Use the cached object.setattr to set *attr_name* to *value_var*.
    ú
_setattr('rv  rk  r   ©rd   r�  rž  r   r   r   Ú_setattr›  s    r¢  Ú	Converter©rd   r�  rž  r-   rŸ  c                 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   rv  rk  )Ú_fmt_converter_call©rd   r�  rž  r-   r   r   r   Ú_setattr_with_converter¢  s    r§  )rd   r½   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.
    Trw  rx  )r¢  )rd   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.
    Trw  rx  )r§  r¥  r¦  r   r   r   Ú_assign_with_converter·  s    r©  zdict[str, type])ræ   rå   r~   c                   s`   | dkrV|dkrdt tfS dddddœ‡ fdd„}ddd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   rk   rÝ   rœ  c                   s&   t | ˆ ƒrt| ||ƒS d| › d|› �S ©Nú_inst_dict['z'] = )r‘  r¢  r¡  ©r~   r   r   Ú
fmt_setterÔ  s    
z&_determine_setters.<locals>.fmt_setterr£  r¤  c                   s4   |st | ˆ ƒrt| |||ƒS d| › d| | |¡› �S rª  )r‘  r§  r¥  r¦  r¬  r   r   Úfmt_setter_with_converterÜ  s       ÿz5_determine_setters.<locals>.fmt_setter_with_converter)z_inst_dict = self.__dict__)r¢  r§  r¨  r©  )ræ   rå   r~   r­  r®  r   r¬  r   Ú_determine_settersÄ  s    
ýr¯  zlist[Attribute]ztuple[str, dict, dict])rg   r^  Ú
is_slottedÚcall_pre_initr˜  Úcall_post_initÚdoes_cache_hashr~   rê   r›  rš  Úmethod_namerŸ  c           $   
   C  sŽ  |r
dgng }|	r|  d¡ t|||ƒ\}}}| |¡ g }g }g }i }ddi}| D �]�}|jrj|  |¡ |j}|jdk	pˆ|jtjk	oˆ|
}|j}t	|j
tƒ}|r¬|j
jr¬dnd}|jdk	rÒt	|jtƒsÒt|jƒ}n|j}|jdk�r¸|�r`t|jf }|dk	�r4|  |||d|› d	� ||ƒ¡ |j|| |j¡< n|  |||d|› d	� |ƒ¡ |j
j||< nT|dk	�rš|  ||d
|› d�||ƒ¡ |j|| |j¡< n|  ||d
|› d�|ƒ¡ �nê|j
tk	�r@|�s@|› d|› d�}|j�rî|  |¡ n
|  |¡ |dk	�r*|  |||||ƒ¡ |j|| |j¡< n|  ||||ƒ¡ �nb|�r@|› d�}|j�rd|  |¡ n
|  |¡ |  d|› d�¡ t|jf }|dk	�rð|  d|||||ƒ ¡ |  d¡ |  d|||d | d	 ||ƒ ¡ |j|| |j¡< nB|  d||||ƒ ¡ |  d¡ |  d|||d | d	 |ƒ ¡ |j
j||< nb|j�rT|  |¡ n
|  |¡ |dk	�r�|  |||||ƒ¡ |j|| |j¡< n|  ||||ƒ¡ |jdkrT|jdk	�rÎ|dk�rÎ|j||< qT|dk	rT|jrT|j||< qT|�rRt|d< |  d¡ |D ]L}d|j }d|j }|  d|› d|› d|j› d	�¡ |j||< |||< �q|�rb|  d¡ |�r¦|�r�|�r‚dt› d�}ndt› d�}ndt› d�}|  |¡ |�rÒd  d!d"„ | D ƒ¡} |  d#| › d	�¡ d$ |¡}|}!|�r@||�ròd$nd› d%d$ |¡› �7 }d$ d&d'„ d(d"„ |D ƒD ƒ¡}"|!|!�r2d$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)rŸ  Nr   rD   FrŠ  rk  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	'] = Nonerw  z = Nonerl  c                 s  s    | ]}|j rd |j› �V  qdS )rw  N)r,   rV   r�   r   r   r   r”   Õ  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›   ß  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­   r(   rV   r4   r   rK  r5   r;   r'   r:   Ú
takes_selfr-   r£  r,   Ú_INIT_FACTORY_PATÚ_get_global_namerA   r   r/   r%   Ú_first_param_typer   r  ra   )$rg   r^  r°  r±  r˜  r²  r³  r~   rê   r›  rš  r´  r±   Zextra_linesr­  r®  rÃ   Zkw_only_argsZattrs_to_validateZnames_for_globalsr   r€   rd   rž  Zarg_nameZhas_factoryZ
maybe_selfr-   Zinit_factory_nameÚargZval_nameZinit_hash_cacheÚvalsZpre_init_argsZpre_init_kw_only_argsÚNLr   r   r   r“  ó  s€   ü  ÿ




ÿ
üÿ	ÿýÿ

üÿ	ÿ
ýÿ

   ÿÿÿ


   ÿÿÿ
üÿÿ
ÿÿ
ýÿÿ

   ÿÿÿ



 



"ýÿÿûr“  )rV   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.
    rm  )Úlstriprœ   r   r   r   r    ÷  s    r    c                
   @  sT   e Zd ZdZdZddd„Zdd„ Zedd	d
„ƒZdd„ Z	dd„ Z
dd„ Zdd„ ZdS )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`.
    )rV   r'   r(   r)   r0   r1   r2   r3   r+   r,   r.   r%   r-   r/   ru   r4   r5   NFc                 C  sè   t ||p
||p|dƒ\}}}}t | ¡}|d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ |d	|ƒ |d
|ƒ |d|ƒ |d|ƒ |d|	r¬t t|	ƒ¡ntƒ |d|
ƒ |d|ƒ |d|ƒ |d|ƒ |d|ƒ d S )NTrV   r'   r(   r)   r0   r1   r2   r3   r+   r,   r-   r.   r%   r/   ru   r4   r5   )r6   r¯   r°   ÚtypesÚMappingProxyTyperÜ   Ú_EMPTY_METADATA_SINGLETON)r   rV   r'   r(   r)   r*   r+   r,   ru   r.   r%   r-   r/   r0   r1   r2   r3   r4   r5   Úbound_setattrr   r   r   rë   C	  s:       ÿ











ÿû



zAttribute.__init__c                 C  s   t ‚d S r"   )r   r¼   r   r   r   r»   z	  s    zAttribute.__setattr__c              	     sZ   |d krˆ j }nˆ j d k	r&d}t|ƒ‚‡ fdd„tjD ƒ}| f |ˆ jˆ j|d ddœ|—ŽS )Nz8Type annotation and type argument cannot both be presentc                   s    i | ]}|d kr|t ˆ |ƒ“qS ))rV   r(   r'   r%   ru   rþ   )r‡   rû   ©r—   r   r   rý   …	  s   ÿþ z0Attribute.from_counting_attr.<locals>.<dictcomp>F)rV   r(   r'   r%   r*   ru   )r%   r8   r˜   r   Ú
_validatorÚ_default)rq   rV   r—   r%   rB   Ú	inst_dictr   rÄ  r   r™   }	  s$    

þúùzAttribute.from_counting_attrc                 K  s   t   | ¡}| | ¡ ¡ |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¡   )r   rÄ   Únewr   r   r   ry   œ	  s    
zAttribute.evolvec                   s   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 )r.   N)rx   rÜ   r.   rÿ   r   r   r   r”   ²	  s   ÿz)Attribute.__getstate__.<locals>.<genexpr>©r=   r   r   r   r   r   rÚ   ®	  s    þzAttribute.__getstate__c                 C  s   |   t| j|ƒ¡ dS ©rË  N)rÉ  r$  r   ©r   r%  r   r   r   rÛ   ·	  s    zAttribute.__setstate__c                 C  sL   t  | ¡}|D ]8\}}|dkr*|||ƒ q|||r@t t|ƒ¡ntƒ qd S )Nr.   )r¯   r°   rÀ  rÁ  rÜ   rÂ  )r   Zname_values_pairsrÃ  rV   r½   r   r   r   rÉ  ½	  s    
ÿûzAttribute._setattrs)
NNNFNNNNNN)N)r   r   r   r   r   rë   r»   r  r™   ry   rÚ   rÛ   rÉ  r   r   r   r   r˜   	  s(   ,          í
7	r˜   c                 C  s2   g | ]*}t |td dd dd|dkddt|ƒd�‘qS )NTFr.   )rV   r'   r(   r)   r*   r0   r2   r+   r,   ru   r5   )r˜   r   r    rÿ   r   r   r   r›   Í	  s   óõr›   r�  c                 C  s   g | ]}|j d kr|‘qS rt   rœ   r�   r   r   r   r›   á	  s     
 c                 C  s    g | ]}|j r|jd kr|‘qS rt   )r+   rV   r�   r   r   r   r›   ã	  s      
 c                   @  sj   e Zd ZdZdZedd„ dD ƒƒeddddddd	dd	ddd	dd	dd
�f˜ZdZdd„ Z	dd„ Z
dd„ ZdS )r@   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Å  r5   r-   r�   r0   r1   r+   r,   r/   r.   r4   r2   r3   r)   r%   c                 c  s8   | ]0}t |t|ƒtd dd ddddd dd dd d�V  qd S )NTF©rV   r5   r'   r(   r)   r*   r+   r,   r/   r0   r1   r2   r3   ru   r4   )r˜   r    r   rÿ   r   r   r   r”   
  s$   ïñz_CountingAttr.<genexpr>)	r�   rÆ  r)   r0   r2   r+   r,   r4   r5   r.   NTFrÏ  r   c                 C  st   t  jd7  _t j| _|| _|| _|| _|| _|| _|| _|| _	|| _
|| _|| _|| _|	| _|
| _|| _|| _d S r•   )r@   Úcls_counterr�   rÆ  rÅ  r-   r)   r0   r1   r2   r3   r+   r,   r.   r%   r/   r4   r5   )r   r'   r(   r)   r*   r+   r,   r-   r.   r%   r/   r0   r1   r2   r3   r4   r5   r   r   r   rë   5
  s"    z_CountingAttr.__init__c                 C  s$   | j dkr|| _ nt| j |ƒ| _ |S )zŒ
        Decorator that adds *meth* to the list of validators.

        Returns *meth* unchanged.

        .. versionadded:: 17.1.0
        N)rÅ  r?   ©r   r?  r   r   r   r(   Z
  s    
z_CountingAttr.validatorc                 C  s    | j tk	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   r:   rÑ  r   r   r   r'   h
  s    
z_CountingAttr.default)r   r   r   r   r   r=   r˜   rs   rÐ  rë   r(   r'   r   r   r   r   r@   ç	  s6   îñá1%r@   c                   @  s.   e Zd ZdZdZddd„Zdd„ Zdd	„ Zd
S )r:   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*
    ©rA   r¸  Fc                 C  s   || _ || _d S r"   rÒ  )r   rA   r¸  r   r   r   rë   “
  s    zFactory.__init__c                   s   t ‡ fdd„ˆ jD ƒƒS )rË  c                 3  s   | ]}t ˆ |ƒV  qd S r"   rþ   rÿ   r   r   r   r”   ›
  s     z'Factory.__getstate__.<locals>.<genexpr>rÌ  r   r   r   r   rÚ   —
  s    zFactory.__getstate__c                 C  s&   t | j|ƒD ]\}}t| ||ƒ qdS rÍ  )r$  r   r÷   )r   r%  rV   r½   r   r   r   rÛ   �
  s    zFactory.__setstate__N)F)r   r   r   r   r   rë   rÚ   rÛ   r   r   r   r   r:   ~
  s
   
r:   c                 C  s(   g | ] }t |td dd dddddd�
‘qS ©NTF)
rV   r'   r(   r)   r*   r0   r2   r+   r,   ru   ©r˜   r   rÿ   r   r   r   r›   ¥
  s   ôöc                   @  sZ   e Zd ZdZdZdddœdd„Zedddœd	d
„ƒZddd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_namer-   Útakes_fieldr¸  F©r¸  rÖ  c                  s¦   |ˆ _ |ˆ _|ˆ _t|ƒ}| ¡ ˆ _ˆ js@ˆ js@‡ fdd„ˆ _nFˆ jr\ˆ js\‡ fdd„ˆ _n*ˆ jsxˆ jrx‡ fdd„ˆ _n‡ fdd„ˆ _| ¡ }|d k	r¢|ˆ jjd< d S )Nc                   s
   ˆ   | ¡S r"   ©r-   )r½   rm  Ú__r   r   r   r�   ß
  r‘   z$Converter.__init__.<locals>.<lambda>c                   s   ˆ   | |¡S r"   rØ  )r½   ÚinstancerÙ  r   r   r   r�   á
  s    ÿc                   s   ˆ   | |¡S r"   rØ  )r½   rÙ  r4  r   r   r   r�   å
  s    ÿc                   s   ˆ   | ||¡S r"   rØ  )r½   rÚ  r4  r   r   r   r�   é
  s     ÿrŸ  )	r-   r¸  rÖ  r   Úget_first_param_typer»  rÕ  Úget_return_typer–  )r   r-   r¸  rÖ  ÚexÚrtr   r   r   rë   Ö
  s    
zConverter.__init__rk   )rd   rŸ  c                 C  s
   d| › �S )zh
        Return the name that a converter for an attribute name *attr_name*
        would have.
        Z__attr_converter_r   )rd   r   r   r   rº  ñ
  s    zConverter._get_global_name)rd   r�  rŸ  c                 C  s‚   | j s"| js"|  |¡› d|› d�S | j rJ| jrJ|  |¡› d|› d|› d�S | j rf|  |¡› 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Š  rk  z, self, attr_dict['z'])z, self)z, attr_dict[')r¸  rÖ  rº  )r   rd   r�  r   r   r   r¥  ù
  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.
        ©r-   r¸  rÖ  rß  r   r   r   r   rÚ   
  s    ýzConverter.__getstate__c                 C  s   | j f |Ž dS )z+
        Load instance from state.
        Nr[  rÎ  r   r   r   rÛ     s    zConverter.__setstate__N)r   r   r   r   r   rë   r  rº  r¥  rÚ   rÛ   r   r   r   r   r£  ¸
  s   	c                 C  s(   g | ] }t |td dd dddddd�
‘qS rÓ  rÔ  rÿ   r   r   r   r›     s   ôörß  c              	     sJ  t |tƒr|}n*t |ttfƒr.dd„ |D ƒ}nd}t|ƒ‚| dd¡}| dd¡}| dd¡}	i ‰ |dk	rtˆ  |¡ |dk	r„|ˆ d< |dk	r”|ˆ d< |	dk	r¤|	ˆ d< t | |i ‡ fdd	„¡}
t	 
tt¡� t d
¡j dd¡|
_W 5 Q R X | dd¡}t|| d¡| d¡dƒ\|d< |d< tf 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)``

    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*
    c                 S  s   i | ]}|t ƒ “qS r   )rC   r�   r   r   r   rý   \  s      zmake_class.<locals>.<dictcomp>z(attrs argument must be a dict or a list.rØ   NrÙ   rë   c                   s
   |   ˆ ¡S r"   )r  )r  ©Úbodyr   r   r�   o  r‘   zmake_class.<locals>.<lambda>r   r   Ú__main__r*   r0   r2   Tr£   c                 S  s"   i | ]\}}|j d k	r||j “qS r"   )r%   rú   r   r   r   rý   ˆ  s    
  )r;   rÜ   r<   r=   r7   Úpopr  rÀ  Ú	new_classró   rô   rõ   r8   r”  Ú	_getframeÚ	f_globalsrŒ   r   rT  rÈ   r¡   r–  )rV   rg   ÚbasesZ
class_bodyZattributes_argumentsZcls_dictrB   r—  r™  Z	user_initÚtype_r*   rq   r   rà  r   Ú
make_class1  sN    (

 ÿüýÿré  )rå   rg  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½   rü   r   r   r   rÕ  š  s    
z_AndValidator.__call__N)r   r   r   r   rC   rë  rÕ  r   r   r   r   rê  ’  s   rê  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­   r;   rê  rë  r=   )Z
validatorsr½  r(   r   r   r   r?   Ÿ  s    ÿýr?   c                    s¼   t dd„ ˆ D ƒƒ}|r$‡ fdd„}n‡ fdd„}ˆ sRt d¡}|j ||dœ¡ nTtˆ d ƒ ¡ }|rp||jd	< ˆ d
 }tsŒt|t	ƒrŒ|j
}t|ƒ ¡ }|r¦||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"   ©r;   r£  )r‡   Úcr   r   r   r”   Æ  s     zpipe.<locals>.<genexpr>c                   s,   ˆ D ]"}t |tƒr|| ||ƒn|| ƒ} q| S r"   rì  )rG  rÅ   r4  rí  ©Ú
convertersr   r   Úpipe_converterÊ  s    ÿzpipe.<locals>.pipe_converterc                   s   ˆ D ]}|| ƒ} q| S r"   r   )rG  rí  rî  r   r   rð  Ô  s    
ÚA)rG  rŸ  r   rG  rN   rŸ  Tr×  )rR  ÚtypingÚTypeVarr–  r  r   rÛ  r	   r;   r£  rÕ  rÜ  )rï  Zreturn_instancerð  rñ  ÚtÚlastrÞ  r   rî  r   r>   ¶  s&    



r>   )NrD   )N)T)NNNNNNNFFTFFFFFNNFFNNNTN)N)NN)cÚ
__future__r   rï   ró   rÈ  r   r  rÞ   r  rS   r”  rÀ  rò  Úoperatorr   rD   r   r   r   r   r	   r
   r   r   r   Ú
exceptionsr   r   r   r   Úobjectr»   r¯   r¹  rn   r  rÁ  rÂ  rò   r>   rã   râ   rá   ÚEnumr   r   Úintr!   rC   rM   rZ   re   rf   ro   rr   rƒ   r„   r§   r´   r¾   rÀ   ry   rÆ   rT  r6   rX  rg   rÈ   r\  r®   r+  r{  r<  r;  rD  r‡  r  r�  rÂ   r�  r‘  r0  r¢  r§  r¨  r©  r¯  r“  r    r˜   r   Z_ar@   r:   Ú_fr£  ré  rê  r?   r   r   r   r   Ú<module>   s6   		
ñ
k
	
úþm::    , ÿ
                        è
 a
G&8
9
.O
/&   Lò
þû	 'ódó ÿ ÿ
a
