ó
¦áVc           @   sE   d  Z  d d l Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   sP   
requests.structures
~~~~~~~~~~~~~~~~~~~

Data structures that power Requests.

iÿÿÿÿNt   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
    ``collections.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(   t   dictt   _storet   Nonet   update(   t   selft   datat   kwargs(    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   __init__*   s    	c         C   s   | | f |  j  | j ƒ  <d  S(   N(   R   t   lower(   R   t   keyt   value(    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   __setitem__0   s    c         C   s   |  j  | j ƒ  d S(   Ni   (   R   R	   (   R   R
   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   __getitem__5   s    c         C   s   |  j  | j ƒ  =d  S(   N(   R   R	   (   R   R
   (    (    s<   /tmp/pip-build-xhEtIN/pip/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(    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pys	   <genexpr><   s    (   R   t   values(   R   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   __iter__;   s    c         C   s   t  |  j ƒ S(   N(   t   lenR   (   R   (    (    s<   /tmp/pip-build-xhEtIN/pip/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(    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pys	   <genexpr>D   s   (   R   t   items(   R   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   lower_itemsA   s    c         C   sG   t  | t j ƒ r! t | ƒ } n t St |  j ƒ  ƒ t | j ƒ  ƒ k S(   N(   t
   isinstancet   collectionst   MappingR    t   NotImplementedR   R   (   R   t   other(    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   __eq__I   s    c         C   s   t  |  j j ƒ  ƒ S(   N(   R    R   R   (   R   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   copyR   s    c         C   s   t  t |  j ƒ  ƒ ƒ S(   N(   t   strR   R   (   R   (    (    s<   /tmp/pip-build-xhEtIN/pip/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"   (    (    (    s<   /tmp/pip-build-xhEtIN/pip/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'   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyR   [   s    	c         C   s   d |  j  S(   Ns   <lookup '%s'>(   R'   (   R   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyR"   _   s    c         C   s   |  j  j | d  ƒ S(   N(   t   __dict__t   getR   (   R   R
   (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyR   b   s    c         C   s   |  j  j | | ƒ S(   N(   R)   R*   (   R   R
   t   default(    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyR*   g   s    N(   R#   R$   R%   R   R   R"   R   R*   (    (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyR&   X   s
   		(   R%   R   t   MutableMappingR    R   R&   (    (    (    s<   /tmp/pip-build-xhEtIN/pip/pip/_vendor/requests/structures.pyt   <module>	   s   J