Your IP : 3.147.78.249


Current Path : /lib/python2.7/site-packages/pip/_vendor/urllib3/
Upload File :
Current File : //lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyo

�
��abc@@s�ddlmZddlmZmZyddlmZWn$ek
r`ddd��YZnXyddlmZWn!ek
r�ddl	mZnXddl
mZmZm
Z
d	d
gZe�Zd	efd��YZd
efd��YZd
S(i(tabsolute_import(tMappingtMutableMapping(tRLockRcB@seZd�Zd�ZRS(cC@sdS(N((tself((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt	__enter__scC@sdS(N((Rtexc_typet	exc_valuet	traceback((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__exit__
s(t__name__t
__module__RR	(((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyRs	(tOrderedDicti(titerkeyst
itervaluestPY3tRecentlyUsedContainertHTTPHeaderDictcB@sbeZdZeZdd
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
cC@s1||_||_|j�|_t�|_dS(N(t_maxsizetdispose_functContainerClst
_containerRtlock(RtmaxsizeR((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__init__+s		cC@s7|j�(|jj|�}||j|<|SWdQXdS(N(RRtpop(Rtkeytitem((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__getitem__2s

cC@s�t}|j�]|jj|t�}||j|<t|j�|jkrh|jjdt�\}}nWdQX|jr�|tk	r�|j|�ndS(Ntlast(	t_NullRRtgettlenRtpopitemtFalseR(RRtvaluet
evicted_valuet_key((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__setitem__9s

$cC@s?|j�|jj|�}WdQX|jr;|j|�ndS(N(RRRR(RRR#((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__delitem__Hs
	cC@s!|j�t|j�SWdQXdS(N(RR R(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__len__Os
cC@std��dS(Ns7Iteration over this class is unlikely to be threadsafe.(tNotImplementedError(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__iter__SscC@s`|j�'tt|j��}|jj�WdQX|jr\x|D]}|j|�qBWndS(N(RtlistRRtclearR(RtvaluesR#((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR,Vs
	
cC@s'|j�tt|j��SWdQXdS(N(RR+R
R(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pytkeys`s
N(R
Rt__doc__RRtNoneRRR&R'R(R*R,R.(((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyRs						
cB@seZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
esiej
Z
ejZne�Zd�Zd	�Zed
�Zd�Zd�Zd
�Zed�ZeZeZeZeZd�Zd�Zd�Zd�Zd�Z d�Z!e"d��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'
    cK@sttt|�j�t�|_|dk	rZt|t�rJ|j|�qZ|j|�n|rp|j|�ndS(N(	tsuperRRRRR0t
isinstancet
_copy_fromtextend(Rtheaderstkwargs((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR�scC@s*||g|j|j�<|j|j�S(N(Rtlower(RRtval((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR&�scC@s$|j|j�}dj|d�S(Ns, i(RR7tjoin(RRR8((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR�scC@s|j|j�=dS(N(RR7(RR((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR'�scC@s|j�|jkS(N(R7R(RR((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__contains__�scC@s�t|t�r$t|d�r$tSt|t|��sNt|�|�}ntd�|j�D��td�|j�D��kS(NR.cs@s'|]\}}|j�|fVqdS(N(R7(t.0tktv((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pys	<genexpr>�scs@s'|]\}}|j�|fVqdS(N(R7(R;R<R=((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pys	<genexpr>�s(R2RthasattrR"ttypetdictt
itermerged(Rtother((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__eq__�s cC@s|j|�S(N(RC(RRB((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__ne__�scC@s
t|j�S(N(R R(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR(�scc@s'x |jj�D]}|dVqWdS(Ni(RR-(Rtvals((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR*�scC@sGy||}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#((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR�s
cC@s#y||=Wntk
rnXdS(N(RF(RR((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pytdiscard�s
cC@sM|j�}||g}|jj||�}||k	rI|j|�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'
        N(R7Rt
setdefaulttappend(RRR8t	key_lowertnew_valsRE((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pytadd�s
	cO@s]t|�dkr0tdjt|����nt|�dkrL|dnd}t|t�r�x�|j�D]\}}|j||�qnWn�t|t�r�x�|D]}|j|||�q�Wndt|d�rxR|j	�D]}|j|||�q�Wn'x$|D]\}}|j||�qWx*|j
�D]\}}|j||�q9WdS(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__
        is9extend() takes at most 1 positional arguments ({0} given)iR.N((R t	TypeErrortformatR2Rt	iteritemsRNRR>R.titems(RtargsR6RBRR8R#((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR4�s"	"
cC@sKy|j|j�}Wn%tk
r>||jkr:gS|SX|dSdS(smReturns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist.iN(RR7RFRG(RRRHRE((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pytgetlist�s
cC@s#dt|�jt|j��fS(Ns%s(%s)(R?R
R@RA(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt__repr__scC@s\xU|D]M}|j|�}t|t�r:t|�}n|g||j|j�<qWdS(N(RTR2R+RR7(RRBRR8((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyR3s

cC@s t|��}|j|�|S(N(R?R3(Rtclone((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pytcopys
cc@sLxE|D]=}|j|j�}x!|dD]}|d|fVq+WqWdS(s8Iterate over all header lines, including duplicate ones.iiN(RR7(RRRER8((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyRQs
cc@sDx=|D]5}|j|j�}|ddj|d�fVqWdS(s:Iterate over all headers, merging duplicate ones together.is, iN(RR7R9(RRR8((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyRA%s
cC@st|j��S(N(R+RQ(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyRR+scC@s�g}x�|jD]z}|jd�rY|d\}}||d|j�f|d<qn|jdd�\}}|j||j�f�qW||�S(s4Read headers from a Python 2 httplib message object.t s	i����s
t:i(RXs	(R5t
startswithtrstriptsplitRKtstrip(tclstmessageR5tlineRR#((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pytfrom_httplib.sN($R
RR/R0RR&RR'R:RCRDRRR
RtobjectRGR(R*RRIRNR4RTt
getheaderstgetallmatchingheaderstigettget_allRUR3RWRQRARRtclassmethodRa(((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyRes< 													
						N((t
__future__RtcollectionsRRt	threadingRtImportErrorRtpackages.ordered_dicttpackages.sixR
RRt__all__RbRRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.pyt<module>s

	J

?>