ó b@RTc@sÞddlmZmZyddlmZWn$ek rPdd d„ƒYZnXyddlmZWn!ek rˆddlmZnXddlm Z dd gZ e ƒZ defd „ƒYZ d efd „ƒYZd S(iÿÿÿÿ(tMappingtMutableMapping(tRLockRcBseZd„Zd„ZRS(cCsdS(N((tself((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyt __enter__scCsdS(N((Rtexc_typet exc_valuet traceback((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyt__exit__ s(t__name__t __module__RR(((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyRs (t OrderedDicti(t itervaluestRecentlyUsedContainertHTTPHeaderDictcBsbeZdZeZdd d„Zd„Zd„Zd„Z d„Z d„Z d„Z d „Z RS( s‘ Provides a thread-safe dict-like container which maintains up to ``maxsize`` keys while throwing away the least-recently-used keys beyond ``maxsize``. :param maxsize: Maximum number of recent elements to retain. :param dispose_func: Every time an item is evicted from the container, ``dispose_func(value)`` is called. Callback which will get called i cCs1||_||_|jƒ|_tƒ|_dS(N(t_maxsizet dispose_funct ContainerClst _containerRtlock(RtmaxsizeR((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyt__init__*s  cCs7|j(|jj|ƒ}||j|<|SWdQXdS(N(RRtpop(Rtkeytitem((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyt __getitem__1s  cCs—t}|j]|jj|tƒ}||j|>> headers = HTTPHeaderDict() >>> headers.add('Set-Cookie', 'foo=bar') >>> headers.add('set-cookie', 'baz=quxx') >>> headers['content-length'] = '7' >>> headers['SET-cookie'] 'foo=bar, baz=quxx' >>> headers['Content-Length'] '7' If you want to access the raw headers with their original casing for debugging purposes you can access the private ``._data`` attribute which is a normal python ``dict`` that maps the case-insensitive key to a list of tuples stored as (case-sensitive-original-name, value). Using the structure from above as our example: >>> headers._data {'set-cookie': [('Set-Cookie', 'foo=bar'), ('set-cookie', 'baz=quxx')], 'content-length': [('content-length', '7')]} cKs2i|_|dkri}n|j||dS(N(t_dataR-tupdate(Rtheaderstkwargs((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyR‘s   cCs,|jj|jƒgƒj||fƒdS(sâAdds a (name, value) pair, doesn't overwrite the value if it already exists. >>> headers = HTTPHeaderDict(foo='bar') >>> headers.add('Foo', 'baz') >>> headers['foo'] 'bar, baz' N(R.t setdefaulttlowertappend(RRR ((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pytadd—s cCs!||kr||jdƒSgS(smReturns a list of all the values for the named field. Returns an empty list if the key doesn't exist.s, (tsplit(RR((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pytgetlist¢scCsOtƒ}x?|jD]4}x+|j|D]\}}|j||ƒq'WqW|S(N(RR.R5(RthRtrawkeyR ((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pytcopy§s  cs[tˆtƒstStˆƒ‰t‡fd†ˆjDƒƒt‡fd†ˆjDƒƒkS(Nc3s|]}|ˆ|fVqdS(N((t.0tk1(R(sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pys ²sc3s|]}|ˆ|fVqdS(N((R;tk2(tother(sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pys ³s(t isinstanceRRRtdictR.(RR>((R>RsS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyt__eq__®s  cCs*|j|jƒ}djd„|DƒƒS(Ns, css|]}|dVqdS(iN((R;R ((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pys ·s(R.R3tjoin(RRR)((sS/opt/freeware/lib/python2.7/site-packages/requests/packages/urllib3/_collections.pyRµscCs ||fg|j|jƒs    K