ó
sÒARc           @   sw   d  Z  d d l Z d d l Z d d l m Z d e f d „  ƒ  YZ d e j f d „  ƒ  YZ d e	 f d	 „  ƒ  YZ
 d S(
   sP   
requests.structures
~~~~~~~~~~~~~~~~~~~

Data structures that power Requests.

iÿÿÿÿN(   t   islicet   IteratorProxyc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s   docstring for IteratorProxyc         C   s   | |  _  d  S(   N(   t   i(   t   selfR   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __init__   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __iter__   s    c         C   sj   t  |  j d ƒ r t |  j ƒ St  |  j d ƒ r; |  j j St  |  j d ƒ rf t j |  j j ƒ  ƒ j Sd  S(   Nt   __len__t   lent   fileno(   t   hasattrR   R   t   ost   fstatR   t   st_size(   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR      s    
c         C   s   d j  t |  j d  | ƒ ƒ S(   Nt    (   t   joinR    R   t   None(   R   t   n(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   read!   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   (    (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR      s
   			t   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   _storeR   t   update(   R   t   datat   kwargs(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR   A   s    	c         C   s   | | f |  j  | j ƒ  <d  S(   N(   R   t   lower(   R   t   keyt   value(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __setitem__G   s    c         C   s   |  j  | j ƒ  d S(   Ni   (   R   R   (   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __getitem__L   s    c         C   s   |  j  | j ƒ  =d  S(   N(   R   R   (   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __delitem__O   s    c         C   s   d „  |  j  j ƒ  Dƒ S(   Nc         s   s   |  ] \ } } | Vq d  S(   N(    (   t   .0t   casedkeyt   mappedvalue(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pys	   <genexpr>S   s    (   R   t   values(   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR   R   s    c         C   s   t  |  j ƒ S(   N(   R   R   (   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR   U   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(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pys	   <genexpr>[   s   (   R   t   items(   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   lower_itemsX   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(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __eq__`   s    c         C   s   t  |  j j ƒ  ƒ S(   N(   R   R   R$   (   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   copyi   s    c         C   s    d |  j  j t |  j ƒ  ƒ f S(   Ns   %s(%r)(   t	   __class__R   R   R'   (   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   __repr__l   s    N(   R   R   R   R   R   R   R   R    R   R   R(   R.   R/   R1   (    (    (    s7   /usr/lib/python2.7/dist-packages/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   superR2   R   (   R   R3   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR   s   s    	c         C   s   d |  j  S(   Ns   <lookup '%s'>(   R3   (   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR1   w   s    c         C   s   |  j  j | d  ƒ S(   N(   t   __dict__t   getR   (   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR   z   s    c         C   s   |  j  j | | ƒ S(   N(   R5   R6   (   R   R   t   default(    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR6      s    N(   R   R   R   R   R   R1   R   R6   (    (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyR2   p   s
   		(   R   R
   R*   t	   itertoolsR    t   objectR   t   MutableMappingR   R   R2   (    (    (    s7   /usr/lib/python2.7/dist-packages/requests/structures.pyt   <module>	   s   K