3

V'íc½ã@sDdZddlmZddlmZmZGdd„deƒZGdd„deƒZd	S)
zO
requests.structures
~~~~~~~~~~~~~~~~~~~

Data structures that power Requests.
é)ÚOrderedDicté)ÚMappingÚMutableMappingc@sbeZdZdZddd„Zdd„Zdd„Zd	d
„Zdd„Zd
d„Z	dd„Z
dd„Zdd„Zdd„Z
dS)ÚCaseInsensitiveDictaÖ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.
    NcKs&tƒ|_|dkri}|j|f|ŽdS)N)rÚ_storeÚupdate)ÚselfÚdataÚkwargs©rú7/tmp/pip-build-gk9425m9/requests/requests/structures.pyÚ__init__*szCaseInsensitiveDict.__init__cCs||f|j|jƒ<dS)N)rÚlower)r	ÚkeyÚvaluerrr
Ú__setitem__0szCaseInsensitiveDict.__setitem__cCs|j|jƒdS)Nr)rr)r	rrrr
Ú__getitem__5szCaseInsensitiveDict.__getitem__cCs|j|jƒ=dS)N)rr)r	rrrr
Ú__delitem__8szCaseInsensitiveDict.__delitem__cCsdd„|jjƒDƒS)Ncss|]\}}|VqdS)Nr)Ú.0ÚcasedkeyÚmappedvaluerrr
ú	<genexpr><sz/CaseInsensitiveDict.__iter__.<locals>.<genexpr>)rÚvalues)r	rrr
Ú__iter__;szCaseInsensitiveDict.__iter__cCs
t|jƒS)N)Úlenr)r	rrr
Ú__len__>szCaseInsensitiveDict.__len__cCsdd„|jjƒDƒS)z.Like iteritems(), but with all lowercase keys.css|]\}}||dfVqdS)rNr)rÚlowerkeyÚkeyvalrrr
rDsz2CaseInsensitiveDict.lower_items.<locals>.<genexpr>)rÚitems)r	rrr
Úlower_itemsAszCaseInsensitiveDict.lower_itemscCs0t|tƒrt|ƒ}ntSt|jƒƒt|jƒƒkS)N)Ú
isinstancerrÚNotImplementedÚdictr )r	Úotherrrr
Ú__eq__Is

zCaseInsensitiveDict.__eq__cCst|jjƒƒS)N)rrr)r	rrr
ÚcopyRszCaseInsensitiveDict.copycCstt|jƒƒƒS)N)Ústrr#r)r	rrr
Ú__repr__UszCaseInsensitiveDict.__repr__)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rrrrrrr r%r&r(rrrr
rs
	rcs<eZdZdZd‡fdd„	Zdd„Zdd„Zdd	d
„Z‡ZS)
Ú
LookupDictzDictionary lookup object.Ncs||_tt|ƒjƒdS)N)ÚnameÚsuperr-r)r	r.)Ú	__class__rr
r\szLookupDict.__init__cCs
d|jS)Nz
<lookup '%s'>)r.)r	rrr
r(`szLookupDict.__repr__cCs|jj|dƒS)N)Ú__dict__Úget)r	rrrr
rcszLookupDict.__getitem__cCs|jj||ƒS)N)r1r2)r	rÚdefaultrrr
r2hszLookupDict.get)N)N)	r)r*r+r,rr(rr2Ú
__classcell__rr)r0r
r-Ys
r-N)	r,ÚcollectionsrÚcompatrrrr#r-rrrr
Ú<module>sJ