
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    #IGZÖ  ã                   @   sˆ   d dl mZmZmZ d dlZddlmZ ddlmZm	Z	m
Z
 ddlmZ ddedfd	d
„Zddedfdd„Zdd„ Zdd„ Zdd„ ZdS )é    )Úabsolute_importÚdivisionÚprint_functionNé   )Ú	iteritems)ÚNOTHINGÚ_obj_setattrÚfields)ÚAttrsAttributeNotFoundErrorTFc           
         sð   t | jƒ}ˆƒ }|D ]Ö}t| |jƒ}ˆdk	r8ˆ||ƒs8q|dkràt|jƒrbt|dˆˆd�||j< qêt|ttt	fƒr¤|dkr€|jnt}	|	‡‡fdd„|D ƒƒ||j< qêt|t
ƒrÔˆ‰ ˆ ‡ fdd„t|ƒD ƒƒ||j< qê|||j< q|||j< q|S )a´  
    Return the ``attrs`` attribute values of *inst* as a dict.

    Optionally recurse into other ``attrs``-decorated classes.

    :param inst: Instance of an ``attrs``-decorated class.
    :param bool recurse: Recurse into classes that are also
        ``attrs``-decorated.
    :param callable filter: A callable whose return code determines whether an
        attribute or element is included (``True``) or dropped (``False``).  Is
        called with the :class:`attr.Attribute` as the first argument and the
        value as the second argument.
    :param callable dict_factory: A callable to produce dictionaries from.  For
        example, to produce ordered dictionaries instead of normal Python
        dictionaries, pass in ``collections.OrderedDict``.
    :param bool retain_collection_types: Do not convert to ``list`` when
        encountering an attribute whose type is ``tuple`` or ``set``.  Only
        meaningful if ``recurse`` is ``True``.

    :rtype: return type of *dict_factory*

    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  versionadded:: 16.0.0 *dict_factory*
    ..  versionadded:: 16.1.0 *retain_collection_types*
    NT©ÚrecurseÚfilterÚdict_factoryc                    s*   g | ]"}t |jƒr"t|d ˆˆ d�n|‘qS )Tr   ©ÚhasÚ	__class__Úasdict)Ú.0Úi)r   r   © ú</opt/alt/python38/lib/python3.8/site-packages/attr/_funcs.pyÚ
<listcomp>3   s   ÿþ
ÿzasdict.<locals>.<listcomp>c                 3   sF   | ]>\}}t |jƒr t|ˆ d �n|t |jƒr8t|ˆ d �n|fV  qdS ))r   Nr   ©r   ZkkÚvv)Údfr   r   Ú	<genexpr>;   s   þþzasdict.<locals>.<genexpr>)r	   r   ÚgetattrÚnamer   r   Ú
isinstanceÚtupleÚlistÚsetÚdictr   )
Úinstr   r   r   Úretain_collection_typesÚattrsÚrvÚaÚvÚcfr   )r   r   r   r   r   
   s0    

ÿü
ýr   c              
      s  t | jƒ}g }|‰|D ]ê}t| |jƒ}ˆ dk	r:ˆ ||ƒs:q|dkröt|jƒrf| t|dˆ ˆˆd�¡ nŽt|tt	t
fƒrªˆdkr„|jnt	}	| |	‡ ‡‡fdd„|D ƒƒ¡ nJt|tƒrêˆdkrÂ|jnt}
| |
‡‡fdd„t|ƒD ƒƒ¡ n
| |¡ q| |¡ qˆt	k�r|S ˆ|ƒS )a8  
    Return the ``attrs`` attribute values of *inst* as a tuple.

    Optionally recurse into other ``attrs``-decorated classes.

    :param inst: Instance of an ``attrs``-decorated class.
    :param bool recurse: Recurse into classes that are also
        ``attrs``-decorated.
    :param callable filter: A callable whose return code determines whether an
        attribute or element is included (``True``) or dropped (``False``).  Is
        called with the :class:`attr.Attribute` as the first argument and the
        value as the second argument.
    :param callable tuple_factory: A callable to produce tuples from.  For
        example, to produce lists instead of tuples.
    :param bool retain_collection_types: Do not convert to ``list``
        or ``dict`` when encountering an attribute which type is
        ``tuple``, ``dict`` or ``set``.  Only meaningful if ``recurse`` is
        ``True``.

    :rtype: return type of *tuple_factory*

    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  versionadded:: 16.2.0
    NT©r   r   Útuple_factoryr$   c              	      s,   g | ]$}t |jƒr$t|d ˆ ˆˆd�n|‘qS )Tr*   ©r   r   Úastuple)r   Új©r   Úretainr+   r   r   r   p   s   ÿý
þzastuple.<locals>.<listcomp>c                 3   sJ   | ]B\}}t |jƒr"t|ˆˆ d �n|t |jƒr<t|ˆˆ d �n|fV  qdS ))r+   r$   Nr,   r   )r0   r+   r   r   r   y   s    ùüýüýözastuple.<locals>.<genexpr>)r	   r   r   r   r   Úappendr-   r   r   r    r!   r"   r   )r#   r   r   r+   r$   r%   r&   r'   r(   r)   r   r   r/   r   r-   F   s4    

þ
û
ór-   c                 C   s   t | ddƒdk	S )z¸
    Check whether *cls* is a class with ``attrs`` attributes.

    :param type cls: Class to introspect.
    :raise TypeError: If *cls* is not a class.

    :rtype: :class:`bool`
    Z__attrs_attrs__N)r   )Úclsr   r   r   r   Ž   s    	r   c                 K   sv   ddl }|jdtdd� t | ¡}t| jƒ}t|ƒD ]<\}}t||tƒ}|tkrdt	dj
||jd�ƒ‚t|||ƒ q4|S )aä  
    Copy *inst* and apply *changes*.

    :param inst: Instance of a class with ``attrs`` attributes.
    :param changes: Keyword changes in the new copy.

    :return: A copy of inst with *changes* incorporated.

    :raise attr.exceptions.AttrsAttributeNotFoundError: If *attr_name* couldn't
        be found on *cls*.
    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  deprecated:: 17.1.0
        Use :func:`evolve` instead.
    r   Nz6assoc is deprecated and will be removed after 2018/01.é   )Ú
stacklevelz&{k} is not an attrs attribute on {cl}.)ÚkZcl)ÚwarningsÚwarnÚDeprecationWarningÚcopyr	   r   r   r   r   r
   Úformatr   )r#   Úchangesr6   Únewr%   r5   r(   r'   r   r   r   Úassocš   s$     ÿ

 ÿÿr=   c                 K   sb   | j }t|ƒ}|D ]D}|jsq|j}|d dkr4|n
|dd… }||krt| |ƒ||< q|f |ŽS )aÏ  
    Create a new instance, based on *inst* with *changes* applied.

    :param inst: Instance of a class with ``attrs`` attributes.
    :param changes: Keyword changes in the new copy.

    :return: A copy of inst with *changes* incorporated.

    :raise TypeError: If *attr_name* couldn't be found in the class
        ``__init__``.
    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  versionadded:: 17.1.0
    r   Ú_r   N)r   r	   Úinitr   r   )r#   r;   r2   r%   r'   Ú	attr_nameZ	init_namer   r   r   Úevolve»   s    rA   )Ú
__future__r   r   r   r9   Ú_compatr   Ú_maker   r   r	   Ú
exceptionsr
   r"   r   r   r-   r   r=   rA   r   r   r   r   Ú<module>   s   ÿ
<ÿ
H!