/ lib / attr / _make.pyc
_make.pyc
   1  o

   2  b��cP��@s�ddlmZmZmZddlZddlZddlZddlZddlZddl	m
   3  Z
   4  ddlmZm
Z
mZddlmZmZmZmZmZmZmZmZmZmZddlmZmZmZmZmZesZddlZe j!Z"dZ#d	Z$d
   5  Z%dZ&dZ'ei�Z(e �Z)e�*ej+ej,�Z-Gd
d�de �Z.e.�Z/	Gdd�de0�Z1e/dddddddddddddfdd�Z2d�dd�Z3d�dd�Z4dd�Z5e5dgd��Z6dd�Z7d d!�Z8d"d#�Z9d$d%�Z:d&d'�Z;d(d)�Z<d*d+�Z=er�d,d-�Z>nd.d-�Z>d/d0�Z?Gd1d2�d2e �Z@d3ZAd4d5�ZBd6d7�ZC	d�d8d9�ZD																							d�d:d;�ZEeEZF	e�rd<d=�ZGnd>d=�ZGd?d@�ZHdAdB�ZIdCdD�ZJdEdF�ZKdGdH�ZLdIdJ�ZMd�dKdL�ZNe�rEdMdN�ZOndOdN�ZOd�dPdQ�ZPdRdS�ZQdTdU�ZRdVdW�Z,dXdY�ZSdZd[�ZTd\d]�ZUd^d_�ZVd`da�ZWdbdc�ZXddde�ZYe�r�d�dfdg�ZZdhdi�Z[djdk�Z\Gdldm�dme �Z]dndo�e]j^D�Z_eJeNePe]e_dp�dqdo�e_D�dp�drdo�e_D�dp�Z]Gdsdt�dte �Z`eNePe`��Z`Gdudv�dve �Zadwdo�eaj^D�ZbeJeNePeaebdp�ebdp�ebdp�Zae ffdxdy�ZceEdddz�Gd{d|�d|e ��Zdd}d~�Zedd��Z*dS)��)�absolute_import�division�print_functionN)�
   6  itemgetter�)�_compat�_config�setters)
   7  �
HAS_F_STRINGS�PY2�PY310�PYPY�isclass�	iteritems�metadata_proxy�	new_class�ordered_dict�set_closure_cell)�DefaultAlreadySetError�FrozenInstanceError�NotAnAttrsClassError�PythonTooOldError�UnannotatedAttributeErrorz__attr_converter_%sz__attr_factory_{}z=    {attr_name} = _attrs_property(_attrs_itemgetter({index})))ztyping.ClassVarz
   8  t.ClassVar�ClassVarztyping_extensions.ClassVarZ_attrs_cached_hashcs<eZdZdZdZ�fdd�Zdd�Zdd�Zd	d
   9  �Z�Z	S)�_Nothingz�
  10      Sentinel class to indicate the lack of a value when ``None`` is ambiguous.
  11  
  12      ``_Nothing`` is a singleton. There is only ever one of it.
  13  
  14      .. versionchanged:: 21.1.0 ``bool(NOTHING)`` is now False.
  15      Ncs"tjdurtt|��|�t_tjS�N)r�
  16  _singleton�super�__new__��cls��	__class__���C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\attr\_make.pyrNs
  17  z_Nothing.__new__cC�dS)N�NOTHINGr#��selfr#r#r$�__repr__S�z_Nothing.__repr__cCr%)NFr#r'r#r#r$�__bool__Vr*z_Nothing.__bool__cCr%)Nrr#r'r#r#r$�__len__Yr*z_Nothing.__len__)
  18  �__name__�
  19  __module__�__qualname__�__doc__rrr)r+r,�
__classcell__r#r#r!r$rCsrc@s8eZdZdZeredfdd�ZdSed�dfdd�ZdS)�_CacheHashWrappera�
  20      An integer subclass that pickles / copies as None
  21  
  22      This is used for non-slots classes with ``cache_hash=True``, to avoid
  23      serializing a potentially (even likely) invalid hash value. Since ``None``
  24      is the default value for uncalculated hashes, whenever this is copied,
  25      the copy's value for the hash should automatically reset.
  26  
  27      See GH #613 for more details.
  28      )r�NcC�||fSrr#�r(Z_none_constructor�_argsr#r#r$�
  29  __reduce__s�z_CacheHashWrapper.__reduce__Nr#cCr4rr#r5r#r#r$r7xr8)r-r.r/r0r�getattrr7�typer#r#r#r$r2cs
  30  r2TFcCs�t|||d�\}}}}|dur|dur|durtd��|	dur3|tur'td��t|	�s/td��t|	�}|dur9i}t|
ttf�rEt	j
  31  |
�}
|rRt|ttf�rRt|�}|r_t|ttf�r_t
  32  |�}t|||d||||||
  33  |||||
d�S)a�
  34      Create a new attribute on a class.
  35  
  36      ..  warning::
  37  
  38          Does *not* do anything unless the class is also decorated with
  39          `attr.s`!
  40  
  41      :param default: A value that is used if an ``attrs``-generated ``__init__``
  42          is used and no value is passed while instantiating or the attribute is
  43          excluded using ``init=False``.
  44  
  45          If the value is an instance of `attrs.Factory`, its callable will be
  46          used to construct a new value (useful for mutable data types like lists
  47          or dicts).
  48  
  49          If a default is not set (or set manually to `attrs.NOTHING`), a value
  50          *must* be supplied when instantiating; otherwise a `TypeError`
  51          will be raised.
  52  
  53          The default can also be set using decorator notation as shown below.
  54  
  55      :type default: Any value
  56  
  57      :param callable factory: Syntactic sugar for
  58          ``default=attr.Factory(factory)``.
  59  
  60      :param validator: `callable` that is called by ``attrs``-generated
  61          ``__init__`` methods after the instance has been initialized.  They
  62          receive the initialized instance, the :func:`~attrs.Attribute`, and the
  63          passed value.
  64  
  65          The return value is *not* inspected so the validator has to throw an
  66          exception itself.
  67  
  68          If a `list` is passed, its items are treated as validators and must
  69          all pass.
  70  
  71          Validators can be globally disabled and re-enabled using
  72          `get_run_validators`.
  73  
  74          The validator can also be set using decorator notation as shown below.
  75  
  76      :type validator: `callable` or a `list` of `callable`\ s.
  77  
  78      :param repr: Include this attribute in the generated ``__repr__``
  79          method. If ``True``, include the attribute; if ``False``, omit it. By
  80          default, the built-in ``repr()`` function is used. To override how the
  81          attribute value is formatted, pass a ``callable`` that takes a single
  82          value and returns a string. Note that the resulting string is used
  83          as-is, i.e. it will be used directly *instead* of calling ``repr()``
  84          (the default).
  85      :type repr: a `bool` or a `callable` to use a custom function.
  86  
  87      :param eq: If ``True`` (default), include this attribute in the
  88          generated ``__eq__`` and ``__ne__`` methods that check two instances
  89          for equality. To override how the attribute value is compared,
  90          pass a ``callable`` that takes a single value and returns the value
  91          to be compared.
  92      :type eq: a `bool` or a `callable`.
  93  
  94      :param order: If ``True`` (default), include this attributes in the
  95          generated ``__lt__``, ``__le__``, ``__gt__`` and ``__ge__`` methods.
  96          To override how the attribute value is ordered,
  97          pass a ``callable`` that takes a single value and returns the value
  98          to be ordered.
  99      :type order: a `bool` or a `callable`.
 100  
 101      :param cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the
 102          same value. Must not be mixed with *eq* or *order*.
 103      :type cmp: a `bool` or a `callable`.
 104  
 105      :param Optional[bool] hash: Include this attribute in the generated
 106          ``__hash__`` method.  If ``None`` (default), mirror *eq*'s value.  This
 107          is the correct behavior according the Python spec.  Setting this value
 108          to anything else than ``None`` is *discouraged*.
 109      :param bool init: Include this attribute in the generated ``__init__``
 110          method.  It is possible to set this to ``False`` and set a default
 111          value.  In that case this attributed is unconditionally initialized
 112          with the specified default value or factory.
 113      :param callable converter: `callable` that is called by
 114          ``attrs``-generated ``__init__`` methods to convert attribute's value
 115          to the desired format.  It is given the passed-in value, and the
 116          returned value will be used as the new value of the attribute.  The
 117          value is converted before being passed to the validator, if any.
 118      :param metadata: An arbitrary mapping, to be used by third-party
 119          components.  See `extending_metadata`.
 120      :param type: The type of the attribute.  In Python 3.6 or greater, the
 121          preferred method to specify the type is using a variable annotation
 122          (see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_).
 123          This argument is provided for backward compatibility.
 124          Regardless of the approach used, the type will be stored on
 125          ``Attribute.type``.
 126  
 127          Please note that ``attrs`` doesn't do anything with this metadata by
 128          itself. You can use it as part of your own code or for
 129          `static type checking <types>`.
 130      :param kw_only: Make this attribute keyword-only (Python 3+)
 131          in the generated ``__init__`` (if ``init`` is ``False``, this
 132          parameter is ignored).
 133      :param on_setattr: Allows to overwrite the *on_setattr* setting from
 134          `attr.s`. If left `None`, the *on_setattr* value from `attr.s` is used.
 135          Set to `attrs.setters.NO_OP` to run **no** `setattr` hooks for this
 136          attribute -- regardless of the setting in `attr.s`.
 137      :type on_setattr: `callable`, or a list of callables, or `None`, or
 138          `attrs.setters.NO_OP`
 139  
 140      .. versionadded:: 15.2.0 *convert*
 141      .. versionadded:: 16.3.0 *metadata*
 142      .. versionchanged:: 17.1.0 *validator* can be a ``list`` now.
 143      .. versionchanged:: 17.1.0
 144         *hash* is ``None`` and therefore mirrors *eq* by default.
 145      .. versionadded:: 17.3.0 *type*
 146      .. deprecated:: 17.4.0 *convert*
 147      .. versionadded:: 17.4.0 *converter* as a replacement for the deprecated
 148         *convert* to achieve consistency with other noun-based arguments.
 149      .. versionadded:: 18.1.0
 150         ``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``.
 151      .. versionadded:: 18.2.0 *kw_only*
 152      .. versionchanged:: 19.2.0 *convert* keyword argument removed.
 153      .. versionchanged:: 19.2.0 *repr* also accepts a custom callable.
 154      .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.
 155      .. versionadded:: 19.2.0 *eq* and *order*
 156      .. versionadded:: 20.1.0 *on_setattr*
 157      .. versionchanged:: 20.3.0 *kw_only* backported to Python 2
 158      .. versionchanged:: 21.1.0
 159         *eq*, *order*, and *cmp* also accept a custom callable
 160      .. versionchanged:: 21.1.0 *cmp* undeprecated
 161      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�
 162  on_setattr)
�_determine_attrib_eq_order�	TypeErrorr&�
 163  ValueError�callable�Factory�
 164  isinstance�list�tupler	�pipe�and_�
_CountingAttr)r<r=r>r?r@rArCr:rB�factoryrDrErGrIrFrHr#r#r$�attrib|sR���
 165  �rVr3cCst||d�}t|||�dS)zU
 166      "Exec" the script with the given global (globs) and local (locs) variables.
 167      �execN)�compile�eval)�script�globs�locs�filename�bytecoder#r#r$�_compile_and_eval@sr_c	Cs|i}|duri}d}|}	t|�d|�d�|f}tj�||�}||kr$nd�|dd�|�}|d7}q
t||||�||S)zO
 168      Create the method with the script given and return the method object.
 169      NrTz{}-{}>�����)�len�
 170  splitlines�	linecache�cache�
 171  setdefault�formatr_)	�namerZr]r[r\�count�
base_filenameZlinecache_tupleZold_valr#r#r$�_make_methodHs&��rjcCspd�|�}d�|�dg}|r"t|�D]\}}|�tj||d��qn|�d�ttd�}td�|�|�||S)z�
 172      Create a tuple subclass to hold `Attribute`s for an `attrs` class.
 173  
 174      The subclass is a bare tuple with properties for names.
 175  
 176      class MyClassAttributes(tuple):
 177          __slots__ = ()
 178          x = property(itemgetter(0))
 179      z{}Attributeszclass {}(tuple):z    __slots__ = ())�index�	attr_namez    pass)Z_attrs_itemgetterZ_attrs_property�
 180  )rf�	enumerate�append�_tuple_property_patr�propertyr_�join)�cls_name�
 181  attr_namesZattr_class_nameZattr_class_template�irlr[r#r#r$�_make_attr_tuple_classgs
 182  
 183  ���
 184  
 185  rv�_Attributes)�attrs�
 186  base_attrsZbase_attrs_mapcCs2t|�}|�d�r|�d�r|dd�}|�t�S)z�
 187      Check whether *annot* is a typing.ClassVar.
 188  
 189      The string comparison hack is used to avoid evaluating all string
 190      annotations which would put attrs-based classes at a performance
 191      disadvantage compared to plain old classes.
 192      )�'�"rr`)�str�
 193  startswith�endswith�_classvar_prefixes)Zannotr#r#r$�
_is_class_var�s
 194  r�cCsJt||t�}|turdS|jdd�D]}t||d�}||ur"dSqdS)zj
 195      Check whether *cls* defines *attrib_name* (and doesn't just inherit it).
 196  
 197      Requires Python 3.
 198      FrNT)r9�	_sentinel�__mro__)r Zattrib_name�attr�base_cls�ar#r#r$�_has_own_attribute�s�r�cCst|d�r|jSiS)z$
 199      Get annotations for *cls*.
 200      �__annotations__)r�r�rr#r#r$�_get_annotations�s
 201  r�cC�
 202  |djS)zQ
 203      Key function for sorting to avoid re-creating a lambda for every class.
 204      r��counter��er#r#r$�_counter_getter�s
 205  r�cCs�g}i}t|jdd��D]$}t|dg�D]}|js|j|vr q|jdd�}|�|�|||j<qq
g}t�}t|�D]}|j|vrCq;|�d|�|�	|j�q;||fS)zQ
 206      Collect attr.ibs from base classes of *cls*, except *taken_attr_names*.
 207      rr`�__attrs_attrs__T��	inheritedr)
 208  �reversedr�r9r�rg�evolvero�set�insert�add)r �taken_attr_namesry�
base_attr_mapr�r��filtered�seenr#r#r$�_collect_base_attrs�s$
 209  �
 210  r�cCsng}i}|jdd�D]'}t|dg�D]}|j|vrq|jdd�}|�|j�|�|�|||j<qq||fS)a-
 211      Collect attr.ibs from base classes of *cls*, except *taken_attr_names*.
 212  
 213      N.B. *taken_attr_names* will be mutated.
 214  
 215      Adhere to the old incorrect behavior.
 216  
 217      Notably it collects from the front and considers inherited attributes which
 218      leads to the buggy behavior reported in #428.
 219      rr`r�Tr�)r�r9rgr�r�ro)r r�ryr�r�r�r#r#r$�_collect_base_attrs_broken�s
 220  
 221  �	r�c	s|j�t|��|dur dd�t|�D�}t|t�s|jtd�nq|dur�dd����D�}g}t�}���D]-\}	}
 222  t	|
 223  �r?q6|�
 224  |	���|	t�}t|t
�s\|turWt�}nt|d�}|�|	|f�q6||}t|�d	kr�td
 225  d�t|�fdd
�d��d��ntdd����D�dd
�d�}�fdd�|D�}
|r�t|dd�|
D��\}}nt|dd�|
D��\}}|r�dd�|
D�}
dd�|D�}||
}d}dd�|D�D]}|dur�|jtur�td|f��|dur�|jtur�d}q�|dur�|||�}dd�|D�}t|j|�}t||�||f�S)a0
 226      Transform all `_CountingAttr`s on a class into `Attribute`s.
 227  
 228      If *these* is passed, use that and don't look for them on the class.
 229  
 230      *collect_by_mro* is True, collect them in the correct MRO order, otherwise
 231      use the old -- incorrect -- order.  See #428.
 232  
 233      Return an `_Attributes`.
 234      NcSsg|]\}}||f�qSr#r#)�.0rg�car#r#r$�
 235  <listcomp>�z$_transform_attrs.<locals>.<listcomp>)�keyTcSsh|]\}}t|t�r|�qSr#�rOrT�r�rgr�r#r#r$�	<setcomp>s��z#_transform_attrs.<locals>.<setcomp>�r<rz1The following `attr.ib`s lack a type annotation: �, cs��|�jSr)�getr�)�n)�cdr#r$�<lambda>/sz"_transform_attrs.<locals>.<lambda>�.css&�|]\}}t|t�r||fVqdSrr�r�r#r#r$�	<genexpr>5s��
 236  �z#_transform_attrs.<locals>.<genexpr>cSr��Nrr�r�r#r#r$r�:�
 237  cs&g|]\}}tj||��|�d��qS))rgr�r:)�	Attribute�from_counting_attrr�)r�rlr�)�annsr#r$r�=s���cS�h|]}|j�qSr#�rg�r�r�r#r#r$r�F�cSr�r#r�r�r#r#r$r�Jr�cS�g|]}|jdd��qS�T)rD�r�r�r#r#r$r�Nr�cSr�r�r�r�r#r#r$r�Or�Fcss(�|]}|jdur|jdur|VqdS)FN)rArDr�r#r#r$r�Xs�&znNo mandatory attributes allowed after an attribute with a default value or factory.  Attribute in question: %rcSsg|]}|j�qSr#r�r�r#r#r$r�gr�)�__dict__r�rrOr�sortr��itemsr�r�r�r�r&rTrVrorarrr�sortedr�r�r<rLrvr-rw)r �these�auto_attribsrD�collect_by_mro�field_transformerZca_listZca_namesZannot_namesrlr:r�ZunannotatedZ	own_attrsryr�rxZhad_defaultrtZ
 238  AttrsClassr#)r�r�r$�_transform_attrss�

 239  ��
 240  
 241  
 242  �����	��
 243  	�
 244  �����
 245  r�cCs*t|t�r|dvrt�|||�dSt��)�<
 246          Attached to frozen classes as __setattr__.
 247          )�	__cause__�__context__N)rO�
BaseException�__setattr__r�r(rg�valuer#r#r$�_frozen_setattrsosr�cC�t��)r��rr�r#r#r$r�~�cCr�)z4
 248      Attached to frozen classes as __delattr__.
 249      r�)r(rgr#r#r$�_frozen_delattrs�r�r�c@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
 250  �Zdd�Z	d
d�Z
 251  dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)&�
_ClassBuilderz(
 252      Iteratively build *one* class.
 253      )�_attr_names�_attrs�_base_attr_map�_base_names�_cache_hash�_cls�	_cls_dict�_delete_attribs�_frozen�
_has_pre_init�_has_post_init�_is_exc�_on_setattr�_slots�
_weakref_slot�_wrote_own_setattr�_has_custom_setattrcCs�t||||||�\}}}||_|rt|j�ni|_||_tdd�|D��|_||_t	dd�|D��|_
 254  ||_||_||_
|	|_tt|dd��|_tt|dd��|_t|�|_|
 255  |_||_|
|_d|_|j|jd<|ryt|jd<t|jd	<d
 256  |_n?|ttjtjfvr�d}}|D]}|jdur�d
 257  }|jdur�d
 258  }|r�|r�nq�|tkr�|s�|r�|tjkr�|r�|tjkr�|s�d|_|r�|� �\|jd<|jd<dSdS)
Ncs��|]}|jVqdSrr�r�r#r#r$r����z)_ClassBuilder.__init__.<locals>.<genexpr>csr�rr�r�r#r#r$r��r��__attrs_pre_init__F�__attrs_post_init__r�r��__delattr__T�__getstate__�__setstate__)!r�r��dictr�r�r�r�r�r�rQr�r�r�r�r��boolr9r�r�r�r�r�r�r�r�r��_ng_default_on_setattrr	�validate�convertr=rB�_make_getstate_setstate)r(r r��slots�frozen�weakref_slot�getstate_setstater�rD�
 259  cache_hash�is_excr�rIZhas_custom_setattrr�rxryZbase_mapZ
has_validatorZ
has_converterr�r#r#r$�__init__�st
 260  �	
 261  
 262  �
 263  
 264  �����z_ClassBuilder.__init__cCsdj|jjd�S)Nz<_ClassBuilder(cls={cls})>r)rfr�r-r'r#r#r$r)�sz_ClassBuilder.__repr__cCs|jdur	|��S|��S)z�
 265          Finalize class based on the accumulated configuration.
 266  
 267          Builder cannot be used after calling this method.
 268          T)r��_create_slots_class�_patch_original_classr'r#r#r$�build_class�s
 269  z_ClassBuilder.build_classc	Cs�|j}|j}|jr,|jD]}||vr+t||t�tur+zt||�Wqty*Yqwq|j�	�D]
 270  \}}t
 271  |||�q1|jsOt|dd�rOd|_|j
sOtj|_|S)zA
 272          Apply accumulated methods and return the class.
 273          �__attrs_own_setattr__F)r�r�r�r�r9r��delattr�AttributeErrorr�r��setattrr�r�r��objectr�)r(r �
 274  base_namesrgr�r#r#r$r�s*
 275  ���z#_ClassBuilder._patch_original_classc
 276  s�fdd�t�j�D�}�js+d|d<�js+�jjD]��j�dd�r*tj	|d<nqt
 277  �}d}�jjdd�D]��j�dd	�d	urEd
 278  }|��fdd�t
�dg�D��q8t�j���j}�jrtdt
�jdd
�vrtd|vrt|st|d7}�fdd�|D���fdd�t|�D���fdd��D��|����jr���t�t��|d<t
�jdd	�}|d	ur�||d<t�j��jj�jj|�}|j��D]G}t|ttf�r�t
|jdd	�}nt|t�r�t
|jdd	�}nt
|dd	�}|s�q�|D]}	z|	j�ju}
 279  Wn
 280  t �yYq�w|
 281  �rt!|	|�q�q�|S)zL
 282          Build and return a new class with a `__slots__` attribute.
 283          cs(i|]\}}|t�j�dvr||�qS))r��__weakref__)rQr�)r��k�vr'r#r$�
 284  <dictcomp>2s
 285  �z5_ClassBuilder._create_slots_class.<locals>.<dictcomp>Fr�r�rr`r�NTcsi|]}|t�|��qSr#�r9�r�rg)r�r#r$rQs
 286  ���	__slots__r#)r�c�g|]}|�vr|�qSr#r#r)r�r#r$r�dr�z5_ClassBuilder._create_slots_class.<locals>.<listcomp>csi|]\}}|�vr||�qSr#r#)r��slot�slot_descriptor)�
 287  slot_namesr#r$ris
 288  �crr#r#r)�reused_slotsr#r$r�nr�r/�__closure__)"rr�r�r�r��	__bases__r�r�r�r�r�r��updater9r�r�r�r�r�ro�_hash_cache_fieldrQr:r-�valuesrO�classmethod�staticmethod�__func__rq�fget�
cell_contentsrLr)r(r�Zexisting_slotsZweakref_inherited�names�qualnamer �itemZ
closure_cells�cell�matchr#)r�r�rr(rr$r�.s|
 289  �
 290  �
 291  
 292  ��
 293  ��
 294  �
 295  
 296  
 297  �
 298  ��	z!_ClassBuilder._create_slots_classcCs |�t|j||j��|jd<|S)Nr))�_add_method_dunders�
 299  _make_reprr�r�r�)r(�nsr#r#r$�add_repr�s
 300  �z_ClassBuilder.add_reprcCs8|j�d�}|durtd��dd�}|�|�|jd<|S)Nr)z3__str__ can only be generated if a __repr__ exists.cSs|��Sr�r)r'r#r#r$�__str__�r8z&_ClassBuilder.add_str.<locals>.__str__r)r�r�rLr)r(r>rr#r#r$�add_str�s�z_ClassBuilder.add_strcs<tdd�|jD����fdd�}|j���fdd�}||fS)zF
 301          Create custom __setstate__ and __getstate__ methods.
 302          css�|]	}|dkr|VqdS)r�Nr#)r��anr#r#r$r��s��z8_ClassBuilder._make_getstate_setstate.<locals>.<genexpr>cst�fdd��D��S)�9
 303              Automatically created by attrs.
 304              c3��|]}t�|�VqdSrrrr'r#r$r����zP_ClassBuilder._make_getstate_setstate.<locals>.slots_getstate.<locals>.<genexpr>�rQr')�state_attr_namesr'r$�slots_getstate��z=_ClassBuilder._make_getstate_setstate.<locals>.slots_getstatecs@t�|t�}t�|�D]	\}}|||�q�r|td�dSdS)r N)�_obj_setattr�__get__r��zipr)r(�stateZ_ClassBuilder__bound_setattrrgr��Zhash_caching_enabledr$r#r$�slots_setstate�s�z=_ClassBuilder._make_getstate_setstate.<locals>.slots_setstate)rQr�r�)r(r%r,r#r+r$r��s�z%_ClassBuilder._make_getstate_setstatecCsd|jd<|S)N�__hash__)r�r'r#r#r$�make_unhashable�s
 305  z_ClassBuilder.make_unhashablecCs(|�t|j|j|j|jd��|jd<|S)N�r�r�r-)r�
 306  _make_hashr�r�r�r�r�r'r#r#r$�add_hash�s�
 307  �	z_ClassBuilder.add_hashcC�B|�t|j|j|j|j|j|j|j|j	|j
 308  |jdd��|jd<|S)NF��
 309  attrs_initr��
r�
 310  _make_initr�r�r�r�r�r�r�r�r�r�r�r'r#r#r$�add_init�� �
 311  �z_ClassBuilder.add_initcCstdd�|jD��|jd<dS)Ncss"�|]}|jr|js|jVqdSr)rArDrg)r��fieldr#r#r$r��s���
 312  �z/_ClassBuilder.add_match_args.<locals>.<genexpr>�__match_args__)rQr�r�r'r#r#r$�add_match_args�s�z_ClassBuilder.add_match_argscCr2)NTr3�__attrs_init__r5r'r#r#r$�add_attrs_init�r8z_ClassBuilder.add_attrs_initcCs2|j}|�t|j|j��|d<|�t��|d<|S)N�__eq__�__ne__)r�r�_make_eqr�r��_make_ne�r(r�r#r#r$�add_eqs�z_ClassBuilder.add_eqcs>�j}�fdd�t�j�j�D�\|d<|d<|d<|d<�S)Nc3s�|]}��|�VqdSr)r)r��methr'r#r$r�s
 313  ��
 314  �z*_ClassBuilder.add_order.<locals>.<genexpr>�__lt__�__le__�__gt__�__ge__)r��_make_orderr�r�rBr#r'r$�	add_orders
 315  
 316  �z_ClassBuilder.add_ordercs�|jr|Si�|jD]}|jp|j}|r |tjur ||f�|j<q
 317  �s%|S|jr,td���fdd�}d|j	d<|�
 318  |�|j	d<d|_|S)Nz7Can't combine custom __setattr__ with on_setattr hooks.csDz�|\}}Wnty|}Ynw||||�}t|||�dSr)�KeyErrorr')r(rg�valr��hookZnval�Zsa_attrsr#r$r�4s�z._ClassBuilder.add_setattr.<locals>.__setattr__Tr�r�)r�r�rIr�r	�NO_OPrgr�rLr�rr�)r(r�rIr�r#rNr$�add_setattr s&
 319  ��
 320  
 321  z_ClassBuilder.add_setattrcCs|z|jj|_Wn	tyYnwz
d�|jj|jf�|_Wn	ty'Ynwzd|jjf|_W|Sty=Y|Sw)zL
 322          Add __module__ and __qualname__ to a *method* if possible.
 323          r�z'Method generated by attrs for class %s.)r�r.r�rrr/r-r0)r(�methodr#r#r$rDs*�
 324  ��
 325  ���z!_ClassBuilder._add_method_dundersN)r-r.r/r0rr�r)r�r�r�rrr�r.r1r7r;r=rCrJrPrr#r#r#r$r��s(U&l
"
 326  
 327  $r�zrThe usage of `cmp` is deprecated and will be removed on or after 2021-06-01.  Please use `eq` and `order` instead.cCsl|durt|du|duf�rtd��|dur||fS|dur |}|dur&|}|dur2|dur2td��||fS)��
 328      Validate the combination of *cmp*, *eq*, and *order*. Derive the effective
 329      values of eq and order.  If *eq* is None, set it to *default_eq*.
 330      N�&Don't mix `cmp` with `eq' and `order`.FT�-`order` can only be True if `eq` is True too.��anyrL)r?rErG�
 331  default_eqr#r#r$�_determine_attrs_eq_orderdsrXcCs�|durt|du|duf�rtd��dd�}|dur&||�\}}||||fS|dur0|d}}n||�\}}|dur@||}}n||�\}}|durR|durRtd��||||fS)rRNrScSs&t|�r
d|}}||fSd}||fS)z8
 332          Decide whether a key function is used.
 333          TN)rM)r�r�r#r#r$�decide_callable_or_boolean�s
 334  
 335  �z>_determine_attrib_eq_order.<locals>.decide_callable_or_booleanFTrTrU)r?rErGrWrYZcmp_keyrFrHr#r#r$rJ~srJcCsF|dus|dur
 336  |S|dur|dur|S|D]
 337  }t||�r dSq|S)a�
 338      Check whether we should implement a set of methods for *cls*.
 339  
 340      *flag* is the argument passed into @attr.s like 'init', *auto_detect* the
 341      same as passed into @attr.s and *dunders* is a tuple of attribute names
 342      whose presence signal that the user has implemented it themselves.
 343  
 344      Return *default* if no reason for either for or against is found.
 345  
 346      auto_detect must be False on Python 2.
 347      TFN)r�)r �flag�auto_detectZdundersr<Zdunderr#r#r$�_determine_whether_to_implement�s
 348  �r\cs��rtrtd��t|||d�\��|�	t�
ttf�rtj�
��
����������	�
 349  ���
�������fdd�}|dur?|S||�S)av4
 350      A class decorator that adds `dunder
 351      <https://wiki.python.org/moin/DunderAlias>`_\ -methods according to the
 352      specified attributes using `attr.ib` or the *these* argument.
 353  
 354      :param these: A dictionary of name to `attr.ib` mappings.  This is
 355          useful to avoid the definition of your attributes within the class body
 356          because you can't (e.g. if you want to add ``__repr__`` methods to
 357          Django models) or don't want to.
 358  
 359          If *these* is not ``None``, ``attrs`` will *not* search the class body
 360          for attributes and will *not* remove any attributes from it.
 361  
 362          If *these* is an ordered dict (`dict` on Python 3.6+,
 363          `collections.OrderedDict` otherwise), the order is deduced from
 364          the order of the attributes inside *these*.  Otherwise the order
 365          of the definition of the attributes is used.
 366  
 367      :type these: `dict` of `str` to `attr.ib`
 368  
 369      :param str repr_ns: When using nested classes, there's no way in Python 2
 370          to automatically detect that.  Therefore it's possible to set the
 371          namespace explicitly for a more meaningful ``repr`` output.
 372      :param bool auto_detect: Instead of setting the *init*, *repr*, *eq*,
 373          *order*, and *hash* arguments explicitly, assume they are set to
 374          ``True`` **unless any** of the involved methods for one of the
 375          arguments is implemented in the *current* class (i.e. it is *not*
 376          inherited from some base class).
 377  
 378          So for example by implementing ``__eq__`` on a class yourself,
 379          ``attrs`` will deduce ``eq=False`` and will create *neither*
 380          ``__eq__`` *nor* ``__ne__`` (but Python classes come with a sensible
 381          ``__ne__`` by default, so it *should* be enough to only implement
 382          ``__eq__`` in most cases).
 383  
 384          .. warning::
 385  
 386             If you prevent ``attrs`` from creating the ordering methods for you
 387             (``order=False``, e.g. by implementing ``__le__``), it becomes
 388             *your* responsibility to make sure its ordering is sound. The best
 389             way is to use the `functools.total_ordering` decorator.
 390  
 391  
 392          Passing ``True`` or ``False`` to *init*, *repr*, *eq*, *order*,
 393          *cmp*, or *hash* overrides whatever *auto_detect* would determine.
 394  
 395          *auto_detect* requires Python 3. Setting it ``True`` on Python 2 raises
 396          an `attrs.exceptions.PythonTooOldError`.
 397  
 398      :param bool repr: Create a ``__repr__`` method with a human readable
 399          representation of ``attrs`` attributes..
 400      :param bool str: Create a ``__str__`` method that is identical to
 401          ``__repr__``.  This is usually not necessary except for
 402          `Exception`\ s.
 403      :param Optional[bool] eq: If ``True`` or ``None`` (default), add ``__eq__``
 404          and ``__ne__`` methods that check two instances for equality.
 405  
 406          They compare the instances as if they were tuples of their ``attrs``
 407          attributes if and only if the types of both classes are *identical*!
 408      :param Optional[bool] order: If ``True``, add ``__lt__``, ``__le__``,
 409          ``__gt__``, and ``__ge__`` methods that behave like *eq* above and
 410          allow instances to be ordered. If ``None`` (default) mirror value of
 411          *eq*.
 412      :param Optional[bool] cmp: Setting *cmp* is equivalent to setting *eq*
 413          and *order* to the same value. Must not be mixed with *eq* or *order*.
 414      :param Optional[bool] hash: If ``None`` (default), the ``__hash__`` method
 415          is generated according how *eq* and *frozen* are set.
 416  
 417          1. If *both* are True, ``attrs`` will generate a ``__hash__`` for you.
 418          2. If *eq* is True and *frozen* is False, ``__hash__`` will be set to
 419             None, marking it unhashable (which it is).
 420          3. If *eq* is False, ``__hash__`` will be left untouched meaning the
 421             ``__hash__`` method of the base class will be used (if base class is
 422             ``object``, this means it will fall back to id-based hashing.).
 423  
 424          Although not recommended, you can decide for yourself and force
 425          ``attrs`` to create one (e.g. if the class is immutable even though you
 426          didn't freeze it programmatically) by passing ``True`` or not.  Both of
 427          these cases are rather special and should be used carefully.
 428  
 429          See our documentation on `hashing`, Python's documentation on
 430          `object.__hash__`, and the `GitHub issue that led to the default \
 431          behavior <https://github.com/python-attrs/attrs/issues/136>`_ for more
 432          details.
 433      :param bool init: Create a ``__init__`` method that initializes the
 434          ``attrs`` attributes. Leading underscores are stripped for the argument
 435          name. If a ``__attrs_pre_init__`` method exists on the class, it will
 436          be called before the class is initialized. If a ``__attrs_post_init__``
 437          method exists on the class, it will be called after the class is fully
 438          initialized.
 439  
 440          If ``init`` is ``False``, an ``__attrs_init__`` method will be
 441          injected instead. This allows you to define a custom ``__init__``
 442          method that can do pre-init work such as ``super().__init__()``,
 443          and then call ``__attrs_init__()`` and ``__attrs_post_init__()``.
 444      :param bool slots: Create a `slotted class <slotted classes>` that's more
 445          memory-efficient. Slotted classes are generally superior to the default
 446          dict classes, but have some gotchas you should know about, so we
 447          encourage you to read the `glossary entry <slotted classes>`.
 448      :param bool frozen: Make instances immutable after initialization.  If
 449          someone attempts to modify a frozen instance,
 450          `attr.exceptions.FrozenInstanceError` is raised.
 451  
 452          .. note::
 453  
 454              1. This is achieved by installing a custom ``__setattr__`` method
 455                 on your class, so you can't implement your own.
 456  
 457              2. True immutability is impossible in Python.
 458  
 459              3. This *does* have a minor a runtime performance `impact
 460                 <how-frozen>` when initializing new instances.  In other words:
 461                 ``__init__`` is slightly slower with ``frozen=True``.
 462  
 463              4. If a class is frozen, you cannot modify ``self`` in
 464                 ``__attrs_post_init__`` or a self-written ``__init__``. You can
 465                 circumvent that limitation by using
 466                 ``object.__setattr__(self, "attribute_name", value)``.
 467  
 468              5. Subclasses of a frozen class are frozen too.
 469  
 470      :param bool weakref_slot: Make instances weak-referenceable.  This has no
 471          effect unless ``slots`` is also enabled.
 472      :param bool auto_attribs: If ``True``, collect `PEP 526`_-annotated
 473          attributes (Python 3.6 and later only) from the class body.
 474  
 475          In this case, you **must** annotate every field.  If ``attrs``
 476          encounters a field that is set to an `attr.ib` but lacks a type
 477          annotation, an `attr.exceptions.UnannotatedAttributeError` is
 478          raised.  Use ``field_name: typing.Any = attr.ib(...)`` if you don't
 479          want to set a type.
 480  
 481          If you assign a value to those attributes (e.g. ``x: int = 42``), that
 482          value becomes the default value like if it were passed using
 483          ``attr.ib(default=42)``.  Passing an instance of `attrs.Factory` also
 484          works as expected in most cases (see warning below).
 485  
 486          Attributes annotated as `typing.ClassVar`, and attributes that are
 487          neither annotated nor set to an `attr.ib` are **ignored**.
 488  
 489          .. warning::
 490             For features that use the attribute name to create decorators (e.g.
 491             `validators <validators>`), you still *must* assign `attr.ib` to
 492             them. Otherwise Python will either not find the name or try to use
 493             the default value to call e.g. ``validator`` on it.
 494  
 495             These errors can be quite confusing and probably the most common bug
 496             report on our bug tracker.
 497  
 498          .. _`PEP 526`: https://www.python.org/dev/peps/pep-0526/
 499      :param bool kw_only: Make all attributes keyword-only (Python 3+)
 500          in the generated ``__init__`` (if ``init`` is ``False``, this
 501          parameter is ignored).
 502      :param bool cache_hash: Ensure that the object's hash code is computed
 503          only once and stored on the object.  If this is set to ``True``,
 504          hashing must be either explicitly or implicitly enabled for this
 505          class.  If the hash code is cached, avoid any reassignments of
 506          fields involved in hash code computation or mutations of the objects
 507          those fields point to after object creation.  If such changes occur,
 508          the behavior of the object's hash code is undefined.
 509      :param bool auto_exc: If the class subclasses `BaseException`
 510          (which implicitly includes any subclass of any exception), the
 511          following happens to behave like a well-behaved Python exceptions
 512          class:
 513  
 514          - the values for *eq*, *order*, and *hash* are ignored and the
 515            instances compare and hash by the instance's ids (N.B. ``attrs`` will
 516            *not* remove existing implementations of ``__hash__`` or the equality
 517            methods. It just won't add own ones.),
 518          - all attributes that are either passed into ``__init__`` or have a
 519            default value are additionally available as a tuple in the ``args``
 520            attribute,
 521          - the value of *str* is ignored leaving ``__str__`` to base classes.
 522      :param bool collect_by_mro: Setting this to `True` fixes the way ``attrs``
 523         collects attributes from base classes.  The default behavior is
 524         incorrect in certain cases of multiple inheritance.  It should be on by
 525         default but is kept off for backward-compatibility.
 526  
 527         See issue `#428 <https://github.com/python-attrs/attrs/issues/428>`_ for
 528         more details.
 529  
 530      :param Optional[bool] getstate_setstate:
 531         .. note::
 532            This is usually only interesting for slotted classes and you should
 533            probably just set *auto_detect* to `True`.
 534  
 535         If `True`, ``__getstate__`` and
 536         ``__setstate__`` are generated and attached to the class. This is
 537         necessary for slotted classes to be pickleable. If left `None`, it's
 538         `True` by default for slotted classes and ``False`` for dict classes.
 539  
 540         If *auto_detect* is `True`, and *getstate_setstate* is left `None`,
 541         and **either** ``__getstate__`` or ``__setstate__`` is detected directly
 542         on the class (i.e. not inherited), it is set to `False` (this is usually
 543         what you want).
 544  
 545      :param on_setattr: A callable that is run whenever the user attempts to set
 546          an attribute (either by assignment like ``i.x = 42`` or by using
 547          `setattr` like ``setattr(i, "x", 42)``). It receives the same arguments
 548          as validators: the instance, the attribute that is being modified, and
 549          the new value.
 550  
 551          If no exception is raised, the attribute is set to the return value of
 552          the callable.
 553  
 554          If a list of callables is passed, they're automatically wrapped in an
 555          `attrs.setters.pipe`.
 556  
 557      :param Optional[callable] field_transformer:
 558          A function that is called with the original class object and all
 559          fields right before ``attrs`` finalizes the class.  You can use
 560          this, e.g., to automatically add converters or validators to
 561          fields based on their types.  See `transform-fields` for more details.
 562  
 563      :param bool match_args:
 564          If `True` (default), set ``__match_args__`` on the class to support
 565          `PEP 634 <https://www.python.org/dev/peps/pep-0634/>`_ (Structural
 566          Pattern Matching). It is a tuple of all positional-only ``__init__``
 567          parameter names on Python 3.10 and later. Ignored on older Python
 568          versions.
 569  
 570      .. versionadded:: 16.0.0 *slots*
 571      .. versionadded:: 16.1.0 *frozen*
 572      .. versionadded:: 16.3.0 *str*
 573      .. versionadded:: 16.3.0 Support for ``__attrs_post_init__``.
 574      .. versionchanged:: 17.1.0
 575         *hash* supports ``None`` as value which is also the default now.
 576      .. versionadded:: 17.3.0 *auto_attribs*
 577      .. versionchanged:: 18.1.0
 578         If *these* is passed, no attributes are deleted from the class body.
 579      .. versionchanged:: 18.1.0 If *these* is ordered, the order is retained.
 580      .. versionadded:: 18.2.0 *weakref_slot*
 581      .. deprecated:: 18.2.0
 582         ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now raise a
 583         `DeprecationWarning` if the classes compared are subclasses of
 584         each other. ``__eq`` and ``__ne__`` never tried to compared subclasses
 585         to each other.
 586      .. versionchanged:: 19.2.0
 587         ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now do not consider
 588         subclasses comparable anymore.
 589      .. versionadded:: 18.2.0 *kw_only*
 590      .. versionadded:: 18.2.0 *cache_hash*
 591      .. versionadded:: 19.1.0 *auto_exc*
 592      .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.
 593      .. versionadded:: 19.2.0 *eq* and *order*
 594      .. versionadded:: 20.1.0 *auto_detect*
 595      .. versionadded:: 20.1.0 *collect_by_mro*
 596      .. versionadded:: 20.1.0 *getstate_setstate*
 597      .. versionadded:: 20.1.0 *on_setattr*
 598      .. versionadded:: 20.3.0 *field_transformer*
 599      .. versionchanged:: 21.1.0
 600         ``init=False`` injects ``__attrs_init__``
 601      .. versionchanged:: 21.1.0 Support for ``__attrs_pre_init__``
 602      .. versionchanged:: 21.1.0 *cmp* undeprecated
 603      .. versionadded:: 21.3.0 *match_args*
 604      z-auto_detect only works on Python 3 and later.Ncs�t|dd�durtd���pt|�}�duot|t�}�o!t|d�}|r*|r*td��t|��|�t|��d�d����|��
|��}t|��d�rN|�	���durV|�
 605  �t|��d	�}|sg|durg|��|stt|��d
 606  �rt|��|�
��	dur��dur�t|d�r�d}n�	}|dur�|dur�|dur�td
��|dus�|dur�|dus�|r��r�td��n|dus�|dur�|dur�|dur�|��n
 607  �r�td��|��t|�
 608  �d�r�|��n
 609  |���r�td��tr�r�t|d�s�|��|��S)Nr"z(attrs only works with new-style classes.Tr�z/Can't freeze a class with a custom __setattr__.)r�r�r�r)r>r?)rErFrGrHr-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.r:)r9rK�_has_frozen_base_class�
 610  issubclassr�r�rLr�r\rrrCrJrPr1r.r7r=rr;r�)r �	is_frozenr�Zhas_own_setattr�builderrEr@�r�r[�auto_excr�r�Zeq_r�r�r��hash_rArD�
 611  match_argsrIZorder_r>�repr_nsr�r|r�r�r#r$�wrap�s�����
 612  ������
 613  ��
 614  ����zattrs.<locals>.wrap)rrrXrOrPrQr	rR)�	maybe_clsr�rer>r?r@rAr�r�r�r|r�rDr�rbrErGr[r�r�rIr�rdrfr#rar$rx�s�
 615  4srxcCs"t|jdd�tjko|jjtjkS)�b
 616          Check whether *cls* has a frozen ancestor by looking at its
 617          __setattr__.
 618          r.N)r9r�r�r.r-rr#r#r$r]is
 619  ��r]cCs
 620  |jtkS)rh)r�r�rr#r#r$r]vs
 621  cCsd�||jt|d|j��}|S)zF
 622      Create a "filename" suitable for a function being generated.
 623      z<attrs generated {0} {1}.{2}>r/)rfr.r9r-)r �	func_name�unique_filenamer#r#r$�_generate_unique_filename~s�rkc	stdd��D���d}t|d�}t|��d}d�d�|s!|d7}nts'|d	7}|d
 624  7}d���d7�|g������fd
d�}|rs��|dt�|r`|dt|d���|dd�n	|dt|d���|dt�n|d|�d���}td||�S)Ncss2�|]}|jdus|jdur|jdur|VqdS)TN)r@rEr�r#r#r$r��s�(�z_make_hash.<locals>.<genexpr>z        r@zdef __hash__(selfzhash((z))z):z, *zC, _cache_wrapper=__import__('attr._make')._make._CacheHashWrapper):z_cache_wrapper(�)csT��||�|d�fg��D]}��|d|j�q��|d��dS)z�
 625          Generate the code for actually computing the hash code.
 626          Below this will either be returned directly or used to compute
 627          a value which is then cached, depending on the value of cache_hash
 628          z        %d,�        self.%s,�    N)�extendrorg)�prefix�indentr��rxZclosing_bracesZ	hash_funcZmethod_linesZ	type_hashr#r$�append_hash_computation_lines�s
 629  ��z1_make_hash.<locals>.append_hash_computation_lineszif self.%s is None:zobject.__setattr__(self, '%s', �z
 630  self.%s = zreturn self.%szreturn rmr-)rQrkr@rrorrrrj)	r rxr�r��tabrjZhash_defrsrZr#rrr$r0�sD�
 631  
 632  ���
 633  
 634  r0cCst||ddd�|_|S)z%
 635      Add a hash method to *cls*.
 636      Fr/)r0r-�r rxr#r#r$�	_add_hash�srwcCsdd�}|S)z
 637      Create __ne__ method.
 638      cSs|�|�}|turtS|S)zj
 639          Check equality and either forward a NotImplemented or
 640          return the result negated.
 641          )r>�NotImplemented)r(�other�resultr#r#r$r?�s
 642  z_make_ne.<locals>.__ne__r#)r?r#r#r$rA�srAc	Cs�dd�|D�}t|d�}gd�}i}|r^|�d�dg}|D]7}|jrCd|jf}|j||<|�d||jf�|�d	||jf�q|�d
 643  |jf�|�d|jf�q||dg7}n|�d
�d�|�}td|||�S)z6
 644      Create __eq__ method for *cls* with *attrs*.
 645      cS�g|]}|jr|�qSr#)rEr�r#r#r$r���z_make_eq.<locals>.<listcomp>rE)zdef __eq__(self, other):z-    if other.__class__ is not self.__class__:z        return NotImplementedz
    return  (z
 646      ) == (z_%s_keyz        %s(self.%s),z        %s(other.%s),rmz        other.%s,z    )z    return Truermr>)rkrorFrgrrrj)	r rxrj�linesr[�othersr�Zcmp_namerZr#r#r$r@�s>
 647  
 648  
 649  ������
 650  
 651  r@csVdd��D���fdd���fdd�}�fdd�}�fd	d
 652  �}�fdd�}||||fS)
z9
 653      Create ordering methods for *cls* with *attrs*.
 654      cSr{r#)rGr�r#r#r$r�r|z_make_order.<locals>.<listcomp>cs tdd��fdd��D�D��S)z&
 655          Save us some typing.
 656          css$�|]
\}}|r||�n|VqdSrr#)r�r�r�r#r#r$r�%s
 657  ��
 658  �z6_make_order.<locals>.attrs_to_tuple.<locals>.<genexpr>c3s"�|]}t�|j�|jfVqdSr)r9rgrHr���objr#r$r�'s�
 659  �r#r�rxrr$�attrs_to_tuple!s
 660  
 661  ��z#_make_order.<locals>.attrs_to_tuplecs |j|jur�|��|�kStS�z1
 662          Automatically created by attrs.
 663          �r"rx�r(ry�r�r#r$rE,�z_make_order.<locals>.__lt__cs |j|jur�|��|�kStSr�r�r�r�r#r$rF5r�z_make_order.<locals>.__le__cs |j|jur�|��|�kStSr�r�r�r�r#r$rG>r�z_make_order.<locals>.__gt__cs |j|jur�|��|�kStSr�r�r�r�r#r$rHGr�z_make_order.<locals>.__ge__r#)r rxrErFrGrHr#)rxr�r$rIs				rIcCs&|dur|j}t||�|_t�|_|S)z5
 664      Add equality methods to *cls* with *attrs*.
 665      N)r�r@r>rAr?rvr#r#r$�_add_eqSs
 666  r�cCs�t|d�}tdd�|D��}dd�|D�}t|d<t|d<t|d<g}|D]'\}}}	|	r0d	|nd
 667  |d}
 668  |tkr@d||
 669  fnd
|||
 670  f}|�|�q%d�|�}|durYd}
n|d}
ddddddddddddd|
|fddg}tdd �|�||d!�S)"Nr>css8�|]}|jdur|j|jdurtn|j|jfVqdS�FTN)r>rgrAr�r#r#r$r�gs�
 671  ���_make_repr.<locals>.<genexpr>cSs$i|]\}}}|tkr|d|�qS)�_repr)r>)r�rg�r�_r#r#r$rls
 672  �z_make_repr.<locals>.<dictcomp>rr�r&�self.zgetattr(self, "z", NOTHING)z	%s={%s!r}z%s={%s_repr(%s)}r�z1{self.__class__.__qualname__.rsplit(">.", 1)[-1]}z.{self.__class__.__name__}zdef __repr__(self):z  try:z:    already_repring = _compat.repr_context.already_repringz  except AttributeError:z!    already_repring = {id(self),}z:    _compat.repr_context.already_repring = already_repringz  else:z#    if id(self) in already_repring:z      return '...'z	    else:z#      already_repring.add(id(self))z    return f'%s(%s)'z
 673    finally:z$    already_repring.remove(id(self))r)rm)r[)	rkrQrr�r&r>rorrrj)rxrr rj�attr_names_with_reprsr[Zattribute_fragmentsrgr�ru�accessor�fragmentZ
repr_fragmentZcls_name_fragmentr}r#r#r$rbsZ
 674  ��
 675 676  ���
 677  �
 678  ��rcs$tdd�|D�����fdd�}|S)zj
 679          Make a repr method that includes relevant *attrs*, adding *ns* to the
 680          full name.
 681          css4�|]}|jdur|j|jdurtn|jfVqdSr�)r>rgr�r#r#r$r��s�
 682  ��r�c	
 683  sztjj}Wntyt�}|tj_Ynwt|�|vrdS|j}�dur=t|dd�}|dur9|�dd�d}n|j	}n�d|j	}|�
 684  t|��z4|dg}d	}�D]\}}|r]d
 685  }n|�d�|�|d|t||t
��f�qTd
�|�dW|�t|��S|�t|��w)r z...Nr/z>.rr`r��(TFr��=r3rl)r�repr_context�already_repringr�r��idr"r9�rsplitr-r�roror&rr�remove)	r(r�Zreal_clsr�
 686  class_namerz�firstrgZ	attr_repr�r�rr#r$r)�s8�
 687  � z_make_repr.<locals>.__repr__r#)rxrr�r)r#r�r$r�s
 688  	�.cCs |dur|j}t|||�|_|S)z%
 689      Add a repr method to *cls*.
 690      N)r�rr))r rrxr#r#r$�	_add_repr�sr�cCs8t|�std��t|dd�}|durtdj|d���|S)a�
 691      Return the tuple of ``attrs`` attributes for a class.
 692  
 693      The tuple also allows accessing the fields by their names (see below for
 694      examples).
 695  
 696      :param type cls: Class to introspect.
 697  
 698      :raise TypeError: If *cls* is not a class.
 699      :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
 700          class.
 701  
 702      :rtype: tuple (with name accessors) of `attrs.Attribute`
 703  
 704      ..  versionchanged:: 16.2.0 Returned tuple allows accessing the fields
 705          by name.
 706      �Passed object must be a class.r�N�({cls!r} is not an attrs-decorated class.r)rrKr9rrfrvr#r#r$�fields�s
 707  �r�cCsFt|�std��t|dd�}|durtdj|d���tdd�|D��S)a9
 708      Return an ordered dictionary of ``attrs`` attributes for a class, whose
 709      keys are the attribute names.
 710  
 711      :param type cls: Class to introspect.
 712  
 713      :raise TypeError: If *cls* is not a class.
 714      :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
 715          class.
 716  
 717      :rtype: an ordered dict where keys are attribute names and values are
 718          `attrs.Attribute`\ s. This will be a `dict` if it's
 719          naturally ordered like on Python 3.6+ or an
 720          :class:`~collections.OrderedDict` otherwise.
 721  
 722      .. versionadded:: 18.1.0
 723      r�r�Nr�rcss�|]}|j|fVqdSrr�r�r#r#r$r�"r"zfields_dict.<locals>.<genexpr>)rrKr9rrfrrvr#r#r$�fields_dict	s
 724  �r�cCsDtjdurdSt|j�D]}|j}|dur|||t||j��qdS)z�
 725      Validate all attributes on *inst* that have a validator.
 726  
 727      Leaves all exceptions through.
 728  
 729      :param inst: Instance of a class with ``attrs`` attributes.
 730      FN)r�_run_validatorsr�r"r=r9rg)�instr�r�r#r#r$r�%s
 731  ��r�cCs
 732  d|jvS)Nr)r�rr#r#r$�_is_slot_cls6s
 733  r�cCs||vo	t||�S)z>
 734      Check if the attribute name comes from a slot class.
 735      )r�)�a_namer�r#r#r$�
_is_slot_attr:sr�cCs|	duo|	tju}|r|rtd��|p|}g}
i}|D]/}|js&|jtur&q|
�|�|||j<|jdur@|dur=td��d}q|rJ|jtjurJd}qt	|d�}t
 736  |
||||||||||
 737  �\}}}|jtj
vrq|�tj
|jj�|�t|d��|rt|d<t|
 738  r�dnd|||�}||_|S)Nz$Frozen classes can't use on_setattr.TrA)r&�	attr_dictZ_cached_setattrr<r�)r	rOrLrAr<r&rorgrIrk�_attrs_to_init_scriptr.�sys�modulesrr�r'rjr�)r rx�pre_init�	post_initr�r�r�r�r�Zcls_on_setattrr4�has_cls_on_setattr�needs_cached_setattrZfiltered_attrsr�r�rjrZr[�annotationsrAr#r#r$r6As\�
 739  
 740  
 741  �
 742  
 743  �

 744  �r6cCsd||fS)zJ
 745      Use the cached object.setattr to set *attr_name* to *value_var*.
 746      �_setattr('%s', %s)r#�rlZ	value_var�has_on_setattrr#r#r$�_setattr�sr�cCsd|t|f|fS)zk
 747      Use the cached object.setattr to set *attr_name* to *value_var*, but run
 748      its converter first.
 749      z_setattr('%s', %s(%s)))�_init_converter_patr�r#r#r$�_setattr_with_converter�s
 750  �r�cCs|rt||d�Sd||fS)zo
 751      Unless *attr_name* has an on_setattr hook, use normal assignment. Otherwise
 752      relegate to _setattr.
 753      T�self.%s = %s)r�)rlr�r�r#r#r$�_assign�sr�cCs$|rt||d�Sd|t|f|fS)z�
 754      Unless *attr_name* has an on_setattr hook, use normal assignment after
 755      conversion. Otherwise relegate to _setattr_with_converter.
 756      Tzself.%s = %s(%s))r�r�r�r#r#r$�_assign_with_converter�s�r�cCs$|dur	d|}nd}d|||fS)z8
 757          Unpack *attr_name* from _kw_only dict.
 758          Nz, %sr3z%s = _kw_only.pop('%s'%s)r#)rlr<Zarg_defaultr#r#r$�_unpack_kw_only_py2�s
 759  �r�cCs,dg}|�dd�|D��|d�d�7}|S)a�
 760          Unpack all *kw_only_args* from _kw_only dict and handle errors.
 761  
 762          Given a list of strings "{attr_name}" and "{attr_name}={default}"
 763          generates list of lines of code that pop attrs from _kw_only dict and
 764          raise TypeError similar to builtin if required attr is missing or
 765          extra key is passed.
 766  
 767          >>> print("
 768  ".join(_unpack_kw_only_lines_py2(["a", "b=42"])))
 769          try:
 770              a = _kw_only.pop('a')
 771              b = _kw_only.pop('b', 42)
 772          except KeyError as _key_error:
 773              raise TypeError(
 774                  ...
 775          if _kw_only:
 776              raise TypeError(
 777                  ...
 778          ztry:css"�|]}dt|�d��VqdS)rnr�N)r��split)r��argr#r#r$r��s
 779  ��
 780  �z,_unpack_kw_only_lines_py2.<locals>.<genexpr>a	except KeyError as _key_error:
 781      raise TypeError(
 782          '__init__() missing required keyword-only argument: %s' % _key_error
 783      )
 784  if _kw_only:
 785      raise TypeError(
 786          '__init__() got an unexpected keyword argument %r'
 787          % next(iter(_kw_only))
 788      )
 789  rm)ror�)�kw_only_argsr}r#r#r$�_unpack_kw_only_lines_py2�s
 790  �
 791  ��
r�c!
 792  s�g}|r	|�d�|r|�d�|dur/|durt}t}
n|�d��fdd�}�fdd�}
nt}t}
g}g}g}i}d	d
 793  i}|D�]�}|jrL|�|�|j}|jd
 794  up[|jtj	uo[|	}|j�
 795  d�}t|jt
�}|rq|jjrqd}nd
}|jdur�|r�t�|j�}|jd
 796  ur�|�|
||d|f|��t|jf}|j||<n|�|||d|f|��|jj||<�n|jd
 797  ur�|�|
|d|f|��t|jf}|j||<n�|�||d|f|��n�|jtu�r|�sd||f}|jr�|�|�n|�|�|jd
 798  u�r|�|
|||��|j|t|jf<n�|�||||��n�|�r�d|f}|j�r1|�|�n|�|�|�d|f�t�|j�}|jd
 799  u�ru|�d|
|||��|�d�|�d|
||d|d|��|j|t|jf<n!|�d||||��|�d�|�d|||d|d|��|jj||<n1|j�r�|�|�n|�|�|jd
 800  u�r�|�|
|||��|j|t|jf<n	|�||||��|jdu�r$|jd
 801  u�r�|jd
 802  u�r�|j||<qA|jd
 803  u�r$t�s$d
 804  }zt�|j�}Wnttf�yYnw|�r$t|j���}|�r$|dj tj!j"u�r$|dj ||<qA|�rUt#|d<|�d�|D]!}d|j}d|j}|�d|||jf�|j||<|||<�q3|�r]|�d�|�rw|�rl|�rid}nd }nd!}|�|t$d"f�|�r�d#�%d$d%�|D��} |�d&| f�d'�%|�}|�r�t�r�t&|�|}|d(|�r�d'nd
f7}n|d)|�r�d'nd
d'�%|�f7}d*j|
 805  �r�d+nd,||�r�d-�%|�nd.d/�||fS)0z�
 806      Return a script of an initializer for *attrs* and a dict of globals.
 807  
 808      The globals are expected by the generated script.
 809  
 810      If *frozen* is True, we cannot set the attributes directly so we use
 811      a cached ``object.__setattr__``.
 812      zself.__attrs_pre_init__()z8_setattr = _cached_setattr.__get__(self, self.__class__)Tz_inst_dict = self.__dict__cs"t|��rt|||�Sd||fS)N�_inst_dict['%s'] = %s)r�r�r��r�r#r$�
 813  fmt_setter	s
 814  z)_attrs_to_init_script.<locals>.fmt_settercs.|st|��r
t|||�Sd|t|f|fS)Nz_inst_dict['%s'] = %s(%s))r�r�r�r�r�r#r$�fmt_setter_with_converter$	s��z8_attrs_to_init_script.<locals>.fmt_setter_with_converter�returnNr�r(r3Fz(%s)zattr_dict['%s'].defaultz%s=attr_dict['%s'].defaultz
 815  %s=NOTHINGzif %s is not NOTHING:rnzelse:r�rlrrz#if _config._run_validators is True:Z__attr_validator_Z__attr_z    %s(self, %s, self.%s)zself.__attrs_post_init__()r�r�r��None�,css �|]}|jrd|jVqdS)r�N)rArgr�r#r#r$r��	s�z(_attrs_to_init_script.<locals>.<genexpr>z BaseException.__init__(self, %s)r�z%s**_kw_onlyz%s*, %sz+def {init_name}(self, {args}):
 816      {lines}
 817  r<r�z
 818      �pass)�	init_name�argsr})'ror�r�r�r�r=rgrIr	rO�lstriprOr<rN�
 819  takes_selfrA�_init_factory_patrfrBr�rUr&rDr:r�inspect�	signaturerLrKrP�
 820  parametersr
�
 821  annotation�	Parameter�emptyrrrrr�)!rxr�r�r�r�r�r�r�r�r�r4r}r�r�r�r�Zattrs_to_validateZnames_for_globalsr�r�rlr��arg_nameZhas_factoryZ
 822  maybe_selfZinit_factory_nameZ	conv_namer��sig�
 823  sig_paramsZval_nameZinit_hash_cache�valsr#r�r$r��s�
 824  �
 825  
 826  
 827  
 828  �
 829  
 830  ����
 831  ����
 832  ���
 833  �
 834  
 835  ���
 836  ���
 837  �
 838  ��
 839  ���
 840  ���
 841  �����
 842  
 843  
 844  �
 845  
 846  
 847  ���r�c@sreZdZdZdZ									ddd�Zdd�Zedd	d
 848  ��Ze	dd��Z
 849  d
d�Zdd�Zdd�Z
dd�ZdS)r�a
 850      *Read-only* representation of an attribute.
 851  
 852      The class has *all* arguments of `attr.ib` (except for ``factory``
 853      which is only syntactic sugar for ``default=Factory(...)`` plus the
 854      following:
 855  
 856      - ``name`` (`str`): The name of the attribute.
 857      - ``inherited`` (`bool`): Whether or not that attribute has been inherited
 858        from a base class.
 859      - ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The callables
 860        that are used for comparing and ordering objects by this attribute,
 861        respectively. These are set by passing a callable to `attr.ib`'s ``eq``,
 862        ``order``, or ``cmp`` arguments. See also :ref:`comparison customization
 863        <custom-comparison>`.
 864  
 865      Instances of this class are frequently used for introspection purposes
 866      like:
 867  
 868      - `fields` returns a tuple of them.
 869      - Validators get them passed as the first argument.
 870      - The :ref:`field transformer <transform-fields>` hook receives a list of
 871        them.
 872  
 873      .. versionadded:: 20.1.0 *inherited*
 874      .. versionadded:: 20.1.0 *on_setattr*
 875      .. versionchanged:: 20.2.0 *inherited* is not taken into account for
 876          equality checks and hashing anymore.
 877      .. versionadded:: 21.1.0 *eq_key* and *order_key*
 878  
 879      For the full version history of the fields, see `attr.ib`.
 880      )rgr<r=r>rErFrGrHr@rArCr:rBrDr�rINFcCs�t||p|
|p|d�\}
}}}t�|t�}|d|�|d|�|d|�|d|�|d|
�|d|�|d|�|d	|�|d
 881  |�|d|�|d|�|d
|	rTt|	�nt�|d|
 882  �|d|�|d|�|d|�dS)NTrgr<r=r>rErFrGrHr@rArBrCr:rDr�rI)rJr'r(r�r�_empty_metadata_singleton)r(rgr<r=r>r?r@rAr�rCr:rBrDrErFrGrHrI�
bound_setattrr#r#r$r�P
 883  s2�
 884  
 885  
 886  
 887  
 888  
 889  
 890  
 891  
 892  
 893  
 894  
 895  ��
 896  
 897  
 898  zAttribute.__init__cCr�rr�r�r#r#r$r��
 899  szAttribute.__setattr__c	sV|dur�j}n	�jdurtd���fdd�tjD�}|d|�j�j|ddd�|��S)Nz8Type annotation and type argument cannot both be presentcs i|]}|dvr|t�|��qS))rgr=r<r:r�r)r�r��r�r#r$r�
 900  s�
 901  �z0Attribute.from_counting_attr.<locals>.<dictcomp>F)rgr=r<r:r?r�r#)r:rLr�r�
 902  _validator�_default)r rgr�r:�	inst_dictr#r�r$r��
 903  s&
 904  �
 905  ���zAttribute.from_counting_attrcCstjttdd�|jo
|jS)zD
 906          Simulate the presence of a cmp attribute and warn.
 907          rt)�
 908  stacklevel)�warnings�warn�_CMP_DEPRECATION�DeprecationWarningrErGr'r#r#r$r?�
 909  sz
Attribute.cmpcKst�|�}|�|���|S)z�
 910          Copy *self* and apply *changes*.
 911  
 912          This works similarly to `attr.evolve` but that function does not work
 913          with ``Attribute``.
 914  
 915          It is mainly meant to be used for `transform-fields`.
 916  
 917          .. versionadded:: 20.3.0
 918          )�copy�	_setattrsr�)r(�changes�newr#r#r$r��
 919  s
 920  zAttribute.evolvec�t�fdd��jD��S)�(
 921          Play nice with pickle.
 922          c3s,�|]}|dkr
t�|�nt�j�VqdS)rCN)r9r�rCrr'r#r$r��
 923  s
 924  ��
 925  �z)Attribute.__getstate__.<locals>.<genexpr>�rQrr'r#r'r$r��
 926  s�zAttribute.__getstate__cCs|�t|j|��dS�r�N)r�r)r)r(r*r#r#r$r��
 927  r&zAttribute.__setstate__cCsHt�|t�}|D]\}}|dkr|||�q|||rt|�nt�qdS)NrC)r'r(r�rr�)r(Zname_values_pairsr�rgr�r#r#r$r��
 928  s
 929  ���zAttribute._setattrs)	NNNFNNNNNr)r-r.r/r0rr�r�rr�rqr?r�r�r�r�r#r#r#r$r�
 930  s,!
 931  �5
 932  		r�cCs,g|]}t|tddddd|dkddd�
 933  �qS)NTFrC�
 934  rgr<r=r>r?rErGr@rAr��r�r&rr#r#r$r��
 935  s
���r�r�cCsg|]	}|jdkr|�qSr�r�r�r#r#r$r��
 936  scCs g|]}|jr|jdkr|�qSr�)r@rgr�r#r#r$r��
 937  s c@sheZdZdZdZedd�dD��edddddd	dd	ddd	dd	dd
 938  �fZdZdd
�Z	dd�Z
 939  dd�ZdS)rTa
 940      Intermediate representation of attributes that uses a counter to preserve
 941      the order in which the attributes have been defined.
 942  
 943      *Internal* data structure of the attrs library.  Running into is most
 944      likely the result of a bug like a forgotten `@attr.s` decorator.
 945      )r�r�r>rErFrGrHr@rArCr�rBr:rDrIccs4�|]}t|tddddddddddddd�VqdS)NTF�rgr<r=r>r?r@rArDrErFrGrHr�rIr�rr#r#r$r�s(���
 946  �z_CountingAttr.<genexpr>)r�r�r>rErGr@rArIrCNTFr�rcCsntjd7_tj|_||_||_||_||_||_||_|
|_	||_
 947  ||_||_||_
|	|_|
 948  |_||_dSr�)rT�cls_counterr�r�r�rBr>rErFrGrHr@rArCr:rDrI)r(r<r=r>r?r@rArBrCr:rDrErFrGrHrIr#r#r$r�Bs 
 949  z_CountingAttr.__init__cCs&|jdur
 950  ||_|St|j|�|_|S)z�
 951          Decorator that adds *meth* to the list of validators.
 952  
 953          Returns *meth* unchanged.
 954  
 955          .. versionadded:: 17.1.0
 956          N)r�rS�r(rDr#r#r$r=es
 957  
 958  �z_CountingAttr.validatorcCs"|jturt��t|dd�|_|S)z�
 959          Decorator that allows to set the default for an attribute.
 960  
 961          Returns *meth* unchanged.
 962  
 963          :raises DefaultAlreadySetError: If default has been set before.
 964  
 965          .. versionadded:: 17.1.0
 966          T)r�)r�r&rrNr�r#r#r$r<ss
 967  
 968  z_CountingAttr.default)r-r.r/r0rrQr�r�r�r�r=r<r#r#r#r$rT�
 969  s8����-#rTc@s.eZdZdZdZddd�Zdd�Zdd	�Zd
 970  S)rNa�
 971      Stores a factory callable.
 972  
 973      If passed as the default value to `attrs.field`, the factory is used to
 974      generate a new value.
 975  
 976      :param callable factory: A callable that takes either none or exactly one
 977          mandatory positional argument depending on *takes_self*.
 978      :param bool takes_self: Pass the partially initialized instance that is
 979          being initialized as a positional argument.
 980  
 981      .. versionadded:: 17.1.0  *takes_self*
 982      �rUr�FcCs||_||_dS)z�
 983          `Factory` is part of the default machinery so if we want a default
 984          value here, we have to implement it ourselves.
 985          Nr�)r(rUr�r#r#r$r��s
 986  zFactory.__init__cr�)r�c3r!rrrr'r#r$r��r"z'Factory.__getstate__.<locals>.<genexpr>r�r'r#r'r$r��szFactory.__getstate__cCs&t|j|�D]
 987  \}}t|||�qdSr�)r)rr�)r(r*rgr�r#r#r$r��s�zFactory.__setstate__N)F)r-r.r/r0rr�r�r�r#r#r#r$rN�s
 988  rNcCs(g|]}t|tddddddddd�
 989  �qS)NTFr�r�rr#r#r$r��s
���c
 990  	s"t|t�r|}nt|ttf�rtdd�|D��}ntd��|�dd�}|�dd�}|�dd�}i�|dur9|�d<|durA|�d<|durI|�d<t||i�fdd	��}z
t�d
 991  �j	�
 992  dd�|_Wntt
fylYnw|�d
d�}	t|	|�
 993  d�|�
 994  d�d�\|d<|d<tdd|i|��|�S)aB
 995      A quick way to create a new class called *name* with *attrs*.
 996  
 997      :param str name: The name for the new class.
 998  
 999      :param attrs: A list of names or a dictionary of mappings of names to
1000          attributes.
1001  
1002          If *attrs* is a list or an ordered dict (`dict` on Python 3.6+,
1003          `collections.OrderedDict` otherwise), the order is deduced from
1004          the order of the names or attributes inside *attrs*.  Otherwise the
1005          order of the definition of the attributes is used.
1006      :type attrs: `list` or `dict`
1007  
1008      :param tuple bases: Classes that the new class will subclass.
1009  
1010      :param attributes_arguments: Passed unmodified to `attr.s`.
1011  
1012      :return: A new class with *attrs*.
1013      :rtype: type
1014  
1015      .. versionadded:: 17.1.0 *bases*
1016      .. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained.
1017      css�|]}|t�fVqdSr)rVr�r#r#r$r��r"zmake_class.<locals>.<genexpr>z(attrs argument must be a dict or a list.r�Nr�r�cs
1018  |���Sr)r)r��bodyr#r$r��r�zmake_class.<locals>.<lambda>rr-�__main__r?rErGTr�r#)rOr�rPrQrK�poprr��	_getframe�	f_globalsr�r.r�rLrXr�)
1019  rgrx�basesZattributes_arguments�cls_dictr�r�Z	user_init�type_r?r#r�r$�
1020  make_class�sD
1021  
1022  ����r�)r�r@c@seZdZdZe�Zdd�ZdS)�
_AndValidatorz2
1023      Compose many validators to a single one.
1024      cCs|jD]}||||�qdSr)�_validators)r(r�r�r�r�r#r#r$�__call__s
1025  �z_AndValidator.__call__N)r-r.r/r0rVr�r�r#r#r#r$r�sr�cGs6g}|D]}|�t|t�r|jn|g�qtt|��S)z�
1026      A validator that composes multiple validators into one.
1027  
1028      When called on a value, it runs all wrapped validators.
1029  
1030      :param callables validators: Arbitrary number of validators.
1031  
1032      .. versionadded:: 17.1.0
1033      )rorOr�r�rQ)�
1034  validatorsr�r=r#r#r$rSs
1035  ��rSc	s��fdd�}tsq�st�d�}||d�|_|Sd}z	t��d�}Wnttfy-Ynw|rJt|j	�
1036  ��}|rJ|djtjj
urJ|dj|jd<d}z	t��d�}Wnttfy`Ynw|rq|jt��j
urq|j|jd	<|S)
1037  aY
1038      A converter that composes multiple converters into one.
1039  
1040      When called on a value, it runs all wrapped converters, returning the
1041      *last* value.
1042  
1043      Type annotations will be inferred from the wrapped converters', if
1044      they have any.
1045  
1046      :param callables converters: Arbitrary number of converters.
1047  
1048      .. versionadded:: 20.1.0
1049      cs�D]}||�}q|Srr#)rLrB��
1050  convertersr#r$�pipe_converter?s
1051  zpipe.<locals>.pipe_converter�A)rLr�NrrLr`r�)r�typing�TypeVarr�r�r�rLrKrPr�r
r�r�r��return_annotation�	Signature)r�r�r�r��paramsr#r�r$rR0sD
1052  ��������rR)Nr3r)T)NNNNNNNFFTFFFFFNNFFNNNT)NN)f�
1053  __future__rrrr�r�rcr�r��operatorrr3rrr	r
1054  rrr
rrrrrr�
1055  exceptionsrrrrrr�r�r�r'r�r�rprrr�r�rRr�r�r�rr&�intr2rVr_rjrvrwr�r�r�r�r�r�r�r�r�r�r�rXrJr\rxr�r]rkr0rwrAr@rIr�rr�r�r�r�r�r6r�r�r�r�r�r�r�r�r�_arTrN�_fr�r�rSr#r#r#r$�<module>s40	�	
1056  �
1057  E
1058  �

1059  m
1060  V�*
1061  �
1062  � 
1063  
B4
1064  8
1065  @
1066  @K
1067  )+F
�
1068  ��	
'
�
1069  L