ó
j·Ã^c           @   s\   d  Z  d d l m Z d d l m Z m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 S(
   sO   
requests.structures
~~~~~~~~~~~~~~~~~~~

Data structures that power Requests.
iÿÿÿÿ(   t   OrderedDicti   (   t   Mappingt   MutableMappingt   CaseInsensitiveDictc           B   sk   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z RS(   sÖ  A case-insensitive ``dict``-like object.

    Implements all methods and operations of
    ``MutableMapping`` as well as dict's ``copy``. Also
    provides ``lower_items``.

    All keys are expected to be strings. The structure remembers the
    case of the last key to be set, and ``iter(instance)``,
    ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()``
    will contain case-sensitive keys. However, querying and contains
    testing is case insensitive::

        cid = CaseInsensitiveDict()
        cid['Accept'] = 'application/json'
        cid['aCCEPT'] == 'application/json'  # True
        list(cid) == ['Accept']  # True

    For example, ``headers['content-encoding']`` will return the
    value of a ``'Content-Encoding'`` response header, regardless
    of how the header name was originally stored.

    If the constructor, ``.update``, or equality comparison
    operations are given keys that have equal ``.lower()``s, the
    behavior is undefined.
    c         K   s5   t  ƒ  |  _ | d  k r! i  } n  |  j | |  d  S(   N(   R    t   _storet   Nonet   update(   t   selft   datat   kwargs(    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __init__*   s    	c         C   s   | | f |  j  | j ƒ  <d  S(   N(   R   t   lower(   R   t   keyt   value(    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __setitem__0   s    c         C   s   |  j  | j ƒ  d S(   Ni   (   R   R   (   R   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __getitem__5   s    c         C   s   |  j  | j ƒ  =d  S(   N(   R   R   (   R   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __delitem__8   s    c         C   s   d „  |  j  j ƒ  Dƒ S(   Nc         s   s   |  ] \ } } | Vq d  S(   N(    (   t   .0t   casedkeyt   mappedvalue(    (    s0   site-packages/pip/_vendor/requests/structures.pys	   <genexpr><   s    (   R   t   values(   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __iter__;   s    c         C   s   t  |  j ƒ S(   N(   t   lenR   (   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __len__>   s    c         C   s   d „  |  j  j ƒ  Dƒ S(   s.   Like iteritems(), but with all lowercase keys.c         s   s%   |  ] \ } } | | d  f Vq d S(   i   N(    (   R   t   lowerkeyt   keyval(    (    s0   site-packages/pip/_vendor/requests/structures.pys	   <genexpr>D   s   (   R   t   items(   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   lower_itemsA   s    c         C   sD   t  | t ƒ r t | ƒ } n t St |  j ƒ  ƒ t | j ƒ  ƒ k S(   N(   t
   isinstanceR   R   t   NotImplementedt   dictR   (   R   t   other(    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __eq__I   s    c         C   s   t  |  j j ƒ  ƒ S(   N(   R   R   R   (   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   copyR   s    c         C   s   t  t |  j ƒ  ƒ ƒ S(   N(   t   strR   R   (   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   __repr__U   s    N(   t   __name__t
   __module__t   __doc__R   R
   R   R   R   R   R   R   R    R!   R#   (    (    (    s0   site-packages/pip/_vendor/requests/structures.pyR      s   									t
   LookupDictc           B   s8   e  Z d  Z d d „ Z d „  Z d „  Z d d „ Z RS(   s   Dictionary lookup object.c         C   s    | |  _  t t |  ƒ j ƒ  d  S(   N(   t   namet   superR'   R
   (   R   R(   (    (    s0   site-packages/pip/_vendor/requests/structures.pyR
   \   s    	c         C   s   d |  j  S(   Ns   <lookup '%s'>(   R(   (   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyR#   `   s    c         C   s   |  j  j | d  ƒ S(   N(   t   __dict__t   getR   (   R   R   (    (    s0   site-packages/pip/_vendor/requests/structures.pyR   c   s    c         C   s   |  j  j | | ƒ S(   N(   R*   R+   (   R   R   t   default(    (    s0   site-packages/pip/_vendor/requests/structures.pyR+   h   s    N(   R$   R%   R&   R   R
   R#   R   R+   (    (    (    s0   site-packages/pip/_vendor/requests/structures.pyR'   Y   s
   		N(	   R&   t   collectionsR    t   compatR   R   R   R   R'   (    (    (    s0   site-packages/pip/_vendor/requests/structures.pyt   <module>   s   J