a
    �Ï?e  ã                   @   sò   d Z ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZmZmZmZmZ ddlmZ dd	d	d	d	d	d
dd
dd	ddd
d	dd
d	d	d	d
dœdd„ZeZeed
d	d�Zed	d
d	d
d	d	d	d	dd	d	d	d	dœdd„Zd
d	d	dœdd„Zd
d	dœdd„Zd	S )z]
These are keyword-only APIs that call `attr.s` and `attr.ib` with different
default values.
é    )Úpartialé   )Úsetters)Úasdict)Úastuple)ÚNOTHINGÚ_frozen_setattrsÚ_ng_default_on_setattrÚattribÚattrs)ÚUnannotatedAttributeErrorNTF)ÚtheseÚreprÚunsafe_hashÚhashÚinitÚslotsÚfrozenÚweakref_slotÚstrÚauto_attribsÚkw_onlyÚ
cache_hashÚauto_excÚeqÚorderÚauto_detectÚgetstate_setstateÚ
on_setattrÚfield_transformerÚ
match_argsc                   sZ   ‡‡‡‡‡‡‡‡	‡
‡‡‡‡‡‡‡‡‡‡fdd„‰‡ ‡‡‡fdd„}| du rN|S || ƒS dS )aå  
    Define an *attrs* class.

    Differences to the classic `attr.s` that it uses underneath:

    - Automatically detect whether or not *auto_attribs* should be `True` (c.f.
      *auto_attribs* parameter).
    - If *frozen* is `False`, run converters and validators when setting an
      attribute by default.
    - *slots=True*

      .. caution::

         Usually this has only upsides and few visible effects in everyday
         programming. But it *can* lead to some suprising behaviors, so please
         make sure to read :term:`slotted classes`.
    - *auto_exc=True*
    - *auto_detect=True*
    - *order=False*
    - Some options that were only relevant on Python 2 or were kept around for
      backwards-compatibility have been removed.

    Please note that these are all defaults and you can change them as you
    wish.

    :param Optional[bool] auto_attribs: If set to `True` or `False`, it behaves
       exactly like `attr.s`. If left `None`, `attr.s` will try to guess:

       1. If any attributes are annotated and no unannotated `attrs.fields`\ s
          are found, it assumes *auto_attribs=True*.
       2. Otherwise it assumes *auto_attribs=False* and tries to collect
          `attrs.fields`\ s.

    For now, please refer to `attr.s` for the rest of the parameters.

    .. versionadded:: 20.1.0
    .. versionchanged:: 21.3.0 Converters are also run ``on_setattr``.
    .. versionadded:: 22.2.0
       *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
    c                    s4   t | ˆˆˆˆˆˆˆˆˆ|ˆ	ˆˆˆˆˆ dˆˆˆˆ
d�S )NT)Ú	maybe_clsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zcollect_by_mror   r   r   r    )r   )Úclsr   )r   r   r   r   r   r   r   r   r   r   r    r   r   r   r   r   r   r   r   © úQ/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/attr/_next_gen.pyÚdo_itY   s0    êzdefine.<locals>.do_itc                    sŽ   ˆdt jfv}ˆdu r"ˆdu r"t‰| jD ]$}|jtu r(|rBtdƒ‚t j‰ qNq(ˆ dur`ˆ| ˆ ƒS zˆ| dƒW S  tyˆ   ˆ| dƒ Y S 0 dS )z—
        Making this a wrapper ensures this code runs during class creation.

        We also ensure that frozen-ness of classes is inherited.
        NFz@Frozen classes can't use on_setattr (frozen-ness was inherited).T)r   ZNO_OPr	   Ú	__bases__Ú__setattr__r   Ú
ValueErrorr   )r"   Zhad_on_setattrZbase_cls)r   r%   r   r   r#   r$   Úwraps   s"    

ÿ
zdefine.<locals>.wrapNr#   )r!   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r)   r#   )r   r   r   r   r%   r   r   r   r   r   r   r   r    r   r   r   r   r   r   r   r   r$   Údefine   s
    A0%r*   )r   r   ©ÚdefaultZ	validatorr   r   r   ÚmetadataÚtypeÚ	converterÚfactoryr   r   r   r   Úaliasc                 C   s$   t | |||||||||	|
|||d�S )a,  
    Identical to `attr.ib`, except keyword-only and with some arguments
    removed.

    .. versionadded:: 23.1.0
       The *type* parameter has been re-added; mostly for
       {func}`attrs.make_class`. Please note that type checkers ignore this
       metadata.
    .. versionadded:: 20.1.0
    r+   )r
   r+   r#   r#   r$   Úfield¢   s     òr2   )ÚrecurseÚfilterÚvalue_serializerc                C   s   t | |||dd�S )zŸ
    Same as `attr.asdict`, except that collections types are always retained
    and dict is always used as *dict_factory*.

    .. versionadded:: 21.3.0
    T)Úinstr3   r4   r5   Úretain_collection_types)Ú_asdict)r6   r3   r4   r5   r#   r#   r$   r   Ï   s    ûr   )r3   r4   c                C   s   t | ||dd�S )z¨
    Same as `attr.astuple`, except that collections types are always retained
    and `tuple` is always used as the *tuple_factory*.

    .. versionadded:: 21.3.0
    T)r6   r3   r4   r7   )Ú_astuple)r6   r3   r4   r#   r#   r$   r   ß   s    ÿr   )N)Ú__doc__Ú	functoolsr   Ú r   Z_funcsr   r8   r   r9   Ú_maker   r   r	   r
   r   Ú
exceptionsr   r*   Zmutabler   r2   r#   r#   r#   r$   Ú<module>   sb    ÿê ñ-