U
    |Ha                     @   s   d 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 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ZdS )zr
These are Python 3.6+-only and keyword-only APIs that call `attr.s` and
`attr.ib` with different default values.
    )partial)UnannotatedAttributeError   )setters)NOTHING_frozen_setattrsattribattrsNTF)thesereprhashinitslotsfrozenweakref_slotstrauto_attribskw_only
cache_hashauto_exceqorderauto_detectgetstate_setstate
on_setattrfield_transformerc                   sV   	
fdd fdd}| dkrJ|S || S dS )aD  
    The only behavioral differences are the handling of the *auto_attribs*
    option:

    :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 `attr.ib`\ s
          are found, it assumes *auto_attribs=True*.
       2. Otherwise it assumes *auto_attribs=False* and tries to collect
          `attr.ib`\ s.

    and that mutable classes (``frozen=False``) validate on ``__setattr__``.

    .. versionadded:: 20.1.0
    c                    s0   t | |	 d
dS )NT)	maybe_clsr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zcollect_by_mror   r   r   )r	   )clsr   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r    2/tmp/pip-unpacked-wheel-96tojw90/attr/_next_gen.pydo_it5   s,    zdefine.<locals>.do_itc                    s   dt jfk}dkr$dkr$t j| jD ]$}|jtkr*|rDtdt j qPq* dk	rb|  S z| dW S  tk
r   | d Y S X 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_OPvalidate	__bases____setattr__r   
ValueErrorr   )r   Zhad_on_setattrZbase_cls)r   r    r   r   r   r   wrapM   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   define   s
    ',%r&   )r   r   defaultZ	validatorr   r   r   metadata	converterfactoryr   r   r   r   c                 C   s    t | |||||||||	|
|dS )zx
    Identical to `attr.ib`, except keyword-only and with some arguments
    removed.

    .. versionadded:: 20.1.0
    r'   )r   r'   r   r   r   field|   s    r,   )N)__doc__	functoolsr   Zattr.exceptionsr    r   _maker   r   r   r	   r&   Zmutabler   r,   r   r   r   r   <module>   sP    j