관리-도구
편집 파일: structures.cpython-34.pyc
� �Re� � @ sw d Z d d l Z d d l Z d d l m Z Gd d � d e � Z Gd d � d e j � Z Gd d � d e � Z d S) zP requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. � N)�islicec @ sF e Z d Z d Z d d � Z d d � Z d d � Z d d � Z d S)� IteratorProxyzdocstring for IteratorProxyc C s | | _ d S)N)�i)�selfr � r �:/tmp/pip-ztkk0jow-build/pip/_vendor/requests/structures.py�__init__ s zIteratorProxy.__init__c C s | j S)N)r )r r r r �__iter__ s zIteratorProxy.__iter__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)N�__len__�len�fileno)�hasattrr r �os�fstatr �st_size)r r r r r s zIteratorProxy.__len__c C s d j t | j d | � � S)N� )�joinr r )r �nr r r �read! s zIteratorProxy.readN)�__name__� __module__�__qualname__�__doc__r r r r r r r r r s r c @ s� e Z d Z d Z d d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d S)�CaseInsensitiveDicta� 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. Nc K s5 t � | _ | d k r! i } n | j | | � d S)N)�dict�_store�update)r �data�kwargsr r r r A s zCaseInsensitiveDict.__init__c C s | | f | j | j � <d S)N)r �lower)r �key�valuer r r �__setitem__G s zCaseInsensitiveDict.__setitem__c C s | j | j � d S)N� )r r )r r r r r �__getitem__L s zCaseInsensitiveDict.__getitem__c C s | j | j � =d S)N)r r )r r r r r �__delitem__O s zCaseInsensitiveDict.__delitem__c C s d d � | j j � D� S)Nc s s | ] \ } } | Vq d S)Nr )�.0�casedkey�mappedvaluer r r � <genexpr>S s z/CaseInsensitiveDict.__iter__.<locals>.<genexpr>)r �values)r r r r r R s zCaseInsensitiveDict.__iter__c C s t | j � S)N)r r )r r r r r U s zCaseInsensitiveDict.__len__c C s d d � | j j � D� S)z.Like iteritems(), but with all lowercase keys.c s s% | ] \ } } | | d f Vq d S)r# Nr )r&