ó
^†êWc           @   sU   d  Z  d d l Z d d l m Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d S(	   sP   
requests.structures
~~~~~~~~~~~~~~~~~~~

Data structures that power Requests.

iÿÿÿÿNi   (   t   OrderedDictt   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(   R    t   _storet   Nonet   update(   t   selft   datat   kwargs(    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __init__,   s    	c         C   s   | | f |  j  | j ƒ  <d  S(   N(   R   t   lower(   R   t   keyt   value(    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __setitem__2   s    c         C   s   |  j  | j ƒ  d S(   Ni   (   R   R	   (   R   R
   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __getitem__7   s    c         C   s   |  j  | j ƒ  =d  S(   N(   R   R	   (   R   R
   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __delitem__:   s    c         C   s   d „  |  j  j ƒ  Dƒ S(   Nc         s   s   |  ] \ } } | Vq d  S(   N(    (   t   .0t   casedkeyt   mappedvalue(    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pys	   <genexpr>>   s    (   R   t   values(   R   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __iter__=   s    c         C   s   t  |  j ƒ S(   N(   t   lenR   (   R   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/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(    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pys	   <genexpr>F   s   (   R   t   items(   R   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   lower_itemsC   s    c         C   sG   t  | t j ƒ r! t | ƒ } n t St |  j ƒ  ƒ t | j ƒ  ƒ k S(   N(   t
   isinstancet   collectionst   MappingR   t   NotImplementedt   dictR   (   R   t   other(    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __eq__K   s    c         C   s   t  |  j j ƒ  ƒ S(   N(   R   R   R   (   R   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   copyT   s    c         C   s   t  t |  j ƒ  ƒ ƒ S(   N(   t   strR   R   (   R   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   __repr__W   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   R   R    R!   R#   (    (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/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(   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyR   ]   s    	c         C   s   d |  j  S(   Ns   <lookup '%s'>(   R(   (   R   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyR#   a   s    c         C   s   |  j  j | d  ƒ S(   N(   t   __dict__t   getR   (   R   R
   (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyR   d   s    c         C   s   |  j  j | | ƒ S(   N(   R*   R+   (   R   R
   t   default(    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyR+   i   s    N(   R$   R%   R&   R   R   R#   R   R+   (    (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyR'   Z   s
   		(   R&   R   t   compatR    t   MutableMappingR   R   R'   (    (    (    sp   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/requests/structures.pyt   <module>	   s   J