Current File : //usr/lib/python2.7/site-packages/urllib3/_collections.pyc
�
_X�Tc@s,ddlmZmZyddlmZWn$ek
rPddd��YZnXyddlmZWn!ek
r�ddlmZnXddlm	Z	m
Z
mZdd	gZe
d
ddg�Ze�Zdefd
��YZejZejZejZejZejZd	efd��YZdS(i����(tMappingtMutableMapping(tRLockRcBseZd�Zd�ZRS(cCsdS(N((tself((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt	__enter__scCsdS(N((Rtexc_typet	exc_valuet	traceback((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__exit__	s(t__name__t
__module__RR(((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyRs	(tOrderedDicti(titerkeyst
itervaluestPY3tRecentlyUsedContainertHTTPHeaderDicttcookies
set-cookiesset-cookie2cBsbeZdZeZdd
d�Zd�Zd�Zd�Z	d�Z
d�Zd�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((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__init__,s		cCs7|j�(|jj|�}||j|<|SWdQXdS(N(RRtpop(Rtkeytitem((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__getitem__3s

cCs�t}|j�]|jj|t�}||j|<t|j�|jkrh|jjdt�\}}nWdQX|jr�|tk	r�|j|�ndS(Ntlast(	t_NullRRtgettlenRtpopitemtFalseR(RRtvaluet
evicted_valuet_key((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__setitem__:s

$cCs?|j�|jj|�}WdQX|jr;|j|�ndS(N(RRRR(RRR#((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__delitem__Is
	cCs!|j�t|j�SWdQXdS(N(RR R(R((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__len__Ps
cCstd��dS(Ns7Iteration over this class is unlikely to be threadsafe.(tNotImplementedError(R((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__iter__TscCs`|j�'tt|j��}|jj�WdQX|jr\x|D]}|j|�qBWndS(N(RtlistR
RtclearR(RtvaluesR#((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR,Ws
	
cCs'|j�tt|j��SWdQXdS(N(RR+RR(R((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pytkeysas
N(R	R
t__doc__RRtNoneRRR&R'R(R*R,R.(((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyRs						
cBseZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ejZej
Z
ejZes�ejZejZne�Zed�Zd	�Zd
�Zd�Zd�ZeZeZeZd
�Zd�Zd�Zd�Zd�Z e!dd��Z"RS(sp
    :param headers:
        An iterable of field-value pairs. Must not contain multiple field names
        when compared case-insensitively.

    :param kwargs:
        Additional field-value pairs to pass in to ``dict.update``.

    A ``dict`` like container for storing HTTP Headers.

    Field names are stored and compared case-insensitively in compliance with
    RFC 7230. Iteration provides the first case-sensitive key seen for each
    case-insensitive pair.

    Using ``__setitem__`` syntax overwrites fields that compare equal
    case-insensitively in order to maintain ``dict``'s api. For fields that
    compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add``
    in a loop.

    If multiple fields that are equal case-insensitively are passed to the
    constructor or ``.update``, the behavior is undefined and some will be
    lost.

    >>> 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'
    cKsCtj|�|dk	r)|j|�n|r?|j|�ndS(N(tdictRR0textend(Rtheaderstkwargs((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR�s

cCst||j�||f�S(N(t
_dict_setitemtlower(RRtval((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR&�scCs&t||j��}dj|d�S(Ns, i(t
_dict_getitemR6tjoin(RRR7((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR�scCst||j��S(N(t
_dict_delitemR6(RR((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR'�scCst||j��S(N(t_dict_containsR6(RR((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__contains__�scs�t�t�r$t�d�r$tSt�t���sNt�����nt�fd��D��t�fd��D��kS(NR.c3s|]}|�|fVqdS(N((t.0tk1(R(s8/usr/lib/python2.7/site-packages/urllib3/_collections.pys	<genexpr>�sc3s|]}|�|fVqdS(N((R=tk2(tother(s8/usr/lib/python2.7/site-packages/urllib3/_collections.pys	<genexpr>�s(t
isinstanceRthasattrR"ttypeR1(RR@((R@Rs8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__eq__�s
 cCs|j|�S(N(RD(RR@((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__ne__�scCsGy||}Wn'tk
r7||jkr3�n|SX||=|SdS(s�D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
          If key is not found, d is returned if given, otherwise KeyError is raised.
        N(tKeyErrort_HTTPHeaderDict__marker(RRtdefaultR#((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR�s
cCs#y||=Wntk
rnXdS(N(RF(RR((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pytdiscard�s
cCs�|j�}||f}t|||�}||k	r�t|t�rU|j|�q�|tkr�t|||d|d|g�q�t|||�ndS(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'
        iiN(R6t_dict_setdefaultRAR+tappendtMULTIPLE_HEADERS_ALLOWEDR5(RRR7t	key_lowertnew_valstvals((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pytadd�s	$cOs=t|�dkr0tdjt|����n|sEtd��n|d}t|�dkrk|dnd}t|t�r�x�|D]}|j|||�q�Wndt|d�r�xR|j�D]}|j|||�q�Wn'x$|D]\}}|j||�q�Wx*|j�D]\}}|j||�qWdS(	s�Generic import function for any type of header-like object.
        Adapted version of MutableMapping.update in order to insert items
        with self.add instead of self.__setitem__
        is8update() takes at most 2 positional arguments ({} given)s,update() takes at least 1 argument (0 given)iiR.N((	R t	TypeErrortformatRARRPRBR.titems(targsR4RR@RR#((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyR2�s"	
"
cCsTyt||j��}Wntk
r-gSXt|t�rH|dgS|dSdS(smReturns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist.iN(R8R6RFRAttuple(RRRO((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pytgetlists
cCs#dt|�jt|j��fS(Ns%s(%s)(RCR	R1t
itermerged(R((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt__repr__scCsat|��}xK|D]C}t||�}t|t�rIt|�}nt|||�qW|S(N(RCR8RAR+R5(RtcloneRR7((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pytcopys
ccsHxA|D]9}t||�}x!|dD]}|d|fVq'WqWdS(s8Iterate over all header lines, including duplicate ones.iiN(R8(RRROR7((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt	iteritems!s
ccs@x9|D]1}t||�}|ddj|d�fVqWdS(s:Iterate over all headers, merging duplicate ones together.is, iN(R8R9(RRR7((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyRW(s
cCst|j��S(N(R+R[(R((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyRS.ss
set-cookiecCs_||j��}xF|D]>}|j|�x'|j|�D]}|j||�q<W|SWdS(s4Read headers from a Python 2 httplib message object.N(RSRIt
getheadersRP(tclstmessaget
duplicatestretRR7((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pytfrom_httplib1s

N(s
set-cookie(#R	R
R/R0RR&RR'R<RDRERR-RtupdateRRR
tobjectRGRRIRPR2RVR\tgetallmatchingheaderstigetRXRZR[RWRStclassmethodRa(((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyRms< 																	
			N((tcollectionsRRt	threadingRtImportErrorRtpackages.ordered_dicttpackages.sixRR
Rt__all__t	frozensetRLRcRRR1R&R5RR8R'R:R<R;t
setdefaultRJR(((s8/usr/lib/python2.7/site-packages/urllib3/_collections.pyt<module>s&

	J