Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyc

ó
“tÆ_c@@sddlmZyddlmZmZWn'ek
rSddlmZmZnXyddlmZWn$ek
rŽddd„ƒYZnXddlm	Z	ddl
mZdd	lm
Z
mZmZd
dgZeƒZd
efd„ƒYZdefd
„ƒYZdS(i(tabsolute_import(tMappingtMutableMapping(tRLockRcB@seZd„Zd„ZRS(cC@sdS(N((tself((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt	__enter__scC@sdS(N((Rtexc_typet	exc_valuet	traceback((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__exit__s(t__name__t
__module__RR	(((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyRs	(tOrderedDicti(t
InvalidHeader(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((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__init__.s		cC@s7|j(|jj|ƒ}||j|<|SWdQXdS(N(RRtpop(Rtkeytitem((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__getitem__5s

cC@s—t}|j]|jj|tƒ}||j|<t|jƒ|jkrh|jjdtƒ\}}nWdQX|jr“|tk	r“|j|ƒndS(Ntlast(	t_NullRRtgettlenRtpopitemtFalseR(RRtvaluet
evicted_valuet_key((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__setitem__<s

$cC@s?|j|jj|ƒ}WdQX|jr;|j|ƒndS(N(RRRR(RRR$((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__delitem__Ks
	cC@s!|jt|jƒSWdQXdS(N(RR!R(R((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__len__Rs
cC@stdƒ‚dS(Ns7Iteration over this class is unlikely to be threadsafe.(tNotImplementedError(R((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__iter__VscC@s`|j'tt|jƒƒ}|jjƒWdQX|jr\x|D]}|j|ƒqBWndS(N(RtlistRRtclearR(RtvaluesR$((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR-[s
	
cC@s'|jtt|jƒƒSWdQXdS(N(RR,RR(R((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pytkeyses
N(R
Rt__doc__RRtNoneRRR'R(R)R+R-R/(((sQ/opt/alt/python35/lib/python3.5/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RR1t
isinstancet
_copy_fromtextend(Rtheaderstkwargs((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyRŒscC@s*||g|j|jƒ<|j|jƒS(N(Rtlower(RRtval((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR'—scC@s$|j|jƒ}dj|dƒS(Ns, i(RR8tjoin(RRR9((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR›scC@s|j|jƒ=dS(N(RR8(RR((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR(ŸscC@s|jƒ|jkS(N(R8R(RR((sQ/opt/alt/python35/lib/python3.5/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(R8(t.0tktv((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pys	<genexpr>ªscs@s'|]\}}|jƒ|fVqdS(N(R8(R<R=R>((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pys	<genexpr>«s(R3RthasattrR#ttypetdictt
itermerged(Rtother((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__eq__¥s cC@s|j|ƒS(N(RD(RRC((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__ne__®scC@s
t|jƒS(N(R!R(R((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR)·scc@s'x |jjƒD]}|dVqWdS(Ni(RR.(Rtvals((sQ/opt/alt/python35/lib/python3.5/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$((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR¿s
cC@s#y||=Wntk
rnXdS(N(RG(RR((sQ/opt/alt/python35/lib/python3.5/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(R8Rt
setdefaulttappend(RRR9t	key_lowertnew_valsRF((sQ/opt/alt/python35/lib/python3.5/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	TypeErrortformatR3Rt	iteritemsRORR?R/titems(RtargsR7RCRR9R$((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR5æ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(RR8RGRH(RRRIRF((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pytgetlists
cC@s#dt|ƒjt|jƒƒfS(Ns%s(%s)(R@R
RARB(R((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt__repr__scC@s\xU|D]M}|j|ƒ}t|tƒr:t|ƒ}n|g||j|jƒ<qWdS(N(RUR3R,RR8(RRCRR9((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyR4s

cC@s t|ƒƒ}|j|ƒ|S(N(R@R4(Rtclone((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pytcopy!s
cc@sLxE|D]=}|j|jƒ}x!|dD]}|d|fVq+WqWdS(s8Iterate over all header lines, including duplicate ones.iiN(RR8(RRRFR9((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyRR&s
cc@sDx=|D]5}|j|jƒ}|ddj|dƒfVqWdS(s:Iterate over all headers, merging duplicate ones together.is, iN(RR8R:(RRR9((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyRB-s
cC@st|jƒƒS(N(R,RR(R((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyRS3scC@s·d}g}xž|jD]“}|j|ƒrx|sDtd|ƒ‚qx|d\}}||d|jƒf|d<qn|jddƒ\}}|j||jƒfƒqW||ƒS(s4Read headers from a Python 2 httplib message object.t s	s/Header continuation with no previous header: %siÿÿÿÿt:i(RYs	(R6t
startswithR
tstriptsplitRL(tclstmessagetobs_fold_continued_leadersR6tlineRR$((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pytfrom_httplib6sN($R
RR0R1RR'RR(R;RDRERRRRtobjectRHR)R+RRJROR5RUt
getheaderstgetallmatchingheaderstigettget_allRVR4RXRRRBRStclassmethodRb(((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyRjs< 														
						N((t
__future__Rtcollections.abcRRtImportErrortcollectionst	threadingRRt
exceptionsR
tpackages.sixRRRt__all__RcRRR(((sQ/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/_collections.pyt<module>s

	L
Back to Directory File Manager