ó
i€
\c           @` 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 e d e e d „ Z d „  Z e d e e d	 „ Z d
 „  Z d „  Z d „  Z d S(   i    (   t   absolute_importt   divisiont   print_functionNi   (   t	   iteritems(   t   NOTHINGt   _obj_setattrt   fields(   t   AttrsAttributeNotFoundErrorc      
   ` sm  t  |  j ƒ } | ƒ  } xN| D]F} t |  | j ƒ } ˆ d k	 rY ˆ | | ƒ rY q n  | t k rXt | j ƒ r– t | t ˆ | ˆ  ƒ | | j <qet | t	 t
 t f ƒ rˆ  t k rÃ | j n t
 }	 |	 g  | D] }
 t |
 ˆ | ˆ  ƒ ^ qÓ ƒ | | j <qet | t ƒ rH| ‰ ˆ ‡  ‡ ‡ f d †  t | ƒ Dƒ ƒ | | j <qe| | | j <q | | | j <q W| S(   s´  
    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*
    c         3` s?   |  ]5 \ } } t  | ˆ ˆ ˆ  ƒ t  | ˆ ˆ ˆ  ƒ f Vq d  S(   N(   t   _asdict_anything(   t   .0t   kkt   vv(   t   retain_collection_typest   filtert   df(    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pys	   <genexpr>D   s   N(   R   t	   __class__t   getattrt   namet   Nonet   Truet   hast   asdictt
   isinstancet   tuplet   listt   setR   t   dictR   (   t   instt   recurseR   t   dict_factoryR   t   attrst   rvt   at   vt   cft   i(    (   R   R   R   s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyR   
   s.    "	2c         ` sä   t  |  j d d ƒ d k	 r6 t |  t ˆ | ˆ  ƒ } nª t |  t t t f ƒ rš ˆ  t k rc |  j n t } | g  |  D] } t	 | ˆ | ˆ  ƒ ^ qs ƒ } nF t |  t
 ƒ rÚ | ‰ ˆ ‡  ‡ ‡ f d †  t |  ƒ Dƒ ƒ } n |  } | S(   sK   
    ``asdict`` only works on attrs instances, this works on anything.
    t   __attrs_attrs__c         3` s?   |  ]5 \ } } t  | ˆ ˆ ˆ  ƒ t  | ˆ ˆ ˆ  ƒ f Vq d  S(   N(   R   (   R	   R
   R   (   R   R   R   (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pys	   <genexpr>i   s   N(   R   R   R   R   R   R   R   R   R   R   R   R   (   t   valR   R   R   R   R"   R#   (    (   R   R   R   s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyR   U   s    +c         ` sÈ  t  |  j ƒ } g  } | ‰ x| D]ˆ} t |  | j ƒ } | d k	 r\ | | | ƒ r\ q" n  | t k rt | j ƒ r¥ | j t | d t d | d ˆ  d ˆ ƒƒ qªt	 | t
 t t f ƒ r4ˆ t k rÒ | j n t }	 | j |	 g  | D]? }
 t |
 j ƒ r!t |
 d t d | d ˆ  d ˆ ƒn |
 ^ qè ƒ ƒ qªt	 | t ƒ rˆ t k rX| j n t } | j | ‡  ‡ f d †  t | ƒ Dƒ ƒ ƒ qª| j | ƒ q" | j | ƒ q" Wˆ  t k r¾| Sˆ  | ƒ S(   s8  
    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
    R   R   t   tuple_factoryR   c         3` so   |  ]e \ } } t  | j ƒ r6 t | d  ˆ  d ˆ ƒn | t  | j ƒ r` t | d  ˆ  d ˆ ƒn | f Vq d S(   R&   R   N(   R   R   t   astuple(   R	   R
   R   (   R&   t   retain(    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pys	   <genexpr>½   s   N(   R   R   R   R   R   R   R   t   appendR'   R   R   R   R   R   R   (   R   R   R   R&   R   R   R   R    R!   R"   t   jR   (    (   R&   R(   s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyR'   t   s>    !	Pc         C` s   t  |  d d ƒ d k	 S(   s¸   
    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`
    R$   N(   R   R   (   t   cls(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyR   ×   s    	c         K` s³   d d l  } | j d t d d ƒt j |  ƒ } t |  j ƒ } xl t | ƒ D]^ \ } } t | | t ƒ } | t k r› t	 d j
 d | d | j ƒ ƒ ‚ n  t | | | ƒ qM W| S(	   sä  
    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.
    i    Ns6   assoc is deprecated and will be removed after 2018/01.t
   stackleveli   s&   {k} is not an attrs attribute on {cl}.t   kt   cl(   t   warningst   warnt   DeprecationWarningt   copyR   R   R   R   R   R   t   formatR   (   R   t   changesR/   t   newR   R-   R!   R    (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyt   assocã   s    	c         K` sŠ   |  j  } t | ƒ } xh | D]` } | j s1 q n  | j } | d d k rP | n | d } | | k r t |  | ƒ | | <q q W| |   S(   sÏ  
    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
    i    t   _i   (   R   R   t   initR   R   (   R   R4   R+   R   R    t	   attr_namet	   init_name(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyt   evolve	  s    			 (   t
   __future__R    R   R   R2   t   _compatR   t   _makeR   R   R   t
   exceptionsR   R   R   R   t   FalseR   R   R   R'   R   R6   R;   (    (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/attr/_funcs.pyt   <module>   s    F	!^		&