ó
Ż²k^c           @` s"  d  Z  d d l m Z m Z m Z d d l m Z y d d l m Z m	 Z	 Wn' e
 k
 ru d d l m Z m	 Z	 n Xd d l m Z m Z m Z m Z d   Z d e f d	     YZ d
 e f d     YZ d   d d   d  Z d   d d   d  Z d   d d   d  Z d   Z d S(   s   Common collection classes.i    (   t   print_functiont   divisiont   absolute_import(   t   reduce(   t   Mappingt   Seti   (   t
   isiterablet	   iteritemst   odictt	   text_typec         C` s­   t  |  t  r< t  |  t  r" |  St d   t |   D  St  |  t  rr t  |  t  r^ |  St d   |  D  St |   r„ t  |  t  r |  St d   |  D  S|  Sd  S(   Nc         s` s'   |  ] \ } } | t  |  f Vq d  S(   N(   t   make_immutable(   t   .0t   kt   v(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>   s    c         s` s   |  ] } t  |  Vq d  S(   N(   R
   (   R   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>   s    c         s` s   |  ] } t  |  Vq d  S(   N(   R
   (   R   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>   s    (   t
   isinstanceR   t
   frozendictR   R   t	   frozensetR   t   tuple(   t   value(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR
      s    t   AttrDictc           B` s   e  Z d  Z d   Z RS(   s÷   Sub-classes dict, and further allows attribute-like access to dictionary items.

    Examples:
        >>> d = AttrDict({'a': 1})
        >>> d.a, d['a'], d.get('a')
        (1, 1, 1)
        >>> d.b = 2
        >>> d.b, d['b']
        (2, 2)
    c         O` s&   t  t |   j | |   |  |  _ d  S(   N(   t   superR   t   __init__t   __dict__(   t   selft   argst   kwargs(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR   ,   s    (   t   __name__t
   __module__t   __doc__R   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR   !   s   
R   c           B` s#   e  Z d    Z d   Z d   Z RS(   c         ` s    t    f d   t    D  S(   Nc         3` s   |  ] } |   | f Vq d  S(   N(    (   R   R   (   R   (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>4   s    (   R   t   sorted(   R   (    (   R   s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   __key3   s    c         C` s   t  |  j    S(   N(   t   hasht   _frozendict__key(   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   __hash__6   s    c         C` s^   y |  j    | j    k SWn= t k
 rY t | t  rU |  j    t |  j    k St SXd  S(   N(   R    t   AttributeErrorR   R   R   t   False(   R   t   other(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   __eq__9   s    (   R   R   R    R!   R%   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR   1   s   		c         C` s
   t  |   S(   N(   t   bool(   t   x(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   <lambda>B   s    c         C` s   |  S(   N(    (   R'   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR(   B   s    c         ` s5   t     f d   |  D t |  r. |   n |  S(   sŪ  Give the first value that satisfies the key test.

    Args:
        seq (iterable):
        key (callable): test for each element of iterable
        default: returned when all elements fail test
        apply (callable): applied to element before return, but not to default value

    Returns: first element in seq that passes key, mutated with optional apply

    Examples:
        >>> first([0, False, None, [], (), 42])
        42
        >>> first([0, False, None, [], ()]) is None
        True
        >>> first([0, False, None, [], ()], default='ohai')
        'ohai'
        >>> import re
        >>> m = first(re.match(regex, 'abc') for regex in ['b.*', 'a(.*)'])
        >>> m.group(1)
        'bc'

        The optional `key` argument specifies a one-argument predicate function
        like that used for `filter()`.  The `key` argument, if supplied, must be
        in keyword form.  For example:
        >>> first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
        4

    c         3` s'   |  ] }  |  r   |  Vq d  S(   N(    (   R   R'   (   t   applyt   key(    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>`   s    (   t   nextt   callable(   t   seqR*   t   defaultR)   (    (   R)   R*   s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   firstB   s    c         C` s
   t  |   S(   N(   R&   (   R   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR(   c   s    c         C` s
   |  | f S(   N(    (   R   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR(   c   s    c         ` s    t     f d   |  D |  S(   Nc         3` s3   |  ]) \ } }  | |  r   | |  Vq d  S(   N(    (   R   R   R   (   R)   R*   (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>d   s    (   R+   (   t   mapR*   R.   R)   (    (   R)   R*   s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt	   firstitemc   s    c         C` s
   t  |   S(   N(   R&   (   R'   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR(   g   s    c         C` s   |  S(   N(    (   R'   (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR(   g   s    c         ` s&   t     f d   t |   D |  S(   Nc         3` s'   |  ] }  |  r   |  Vq d  S(   N(    (   R   R'   (   R)   R*   (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pys	   <genexpr>h   s    (   R+   t   reversed(   R-   R*   R.   R)   (    (   R)   R*   s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   lastg   s    c         C` sF   y t  d   |   Wn+ t k
 rA } t |  d k rB   qB n Xd S(   sj   Calls each element of sequence to invoke the side effect.

    Args:
        seq:

    Returns: None

    c         S` s   |   S(   N(    (   t   _t   y(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyR(   u   s    s0   reduce() of empty sequence with no initial valueN(   R   t	   TypeErrorR	   (   R-   t   e(    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt	   call_eachk   s
    	N(   R   t
   __future__R    R   R   t	   functoolsR   t   collections.abcR   R   t   ImportErrort   collectionst   compatR   R   R   R	   R
   t   dictR   R   t   NoneR/   R1   R3   R8   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/auxlib/collection.pyt   <module>   s   "	!