HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib/python2.7/site-packages/requests_toolbelt/_compat.pyc
ó
Óµ Yc@sxdZddlmZmZddlZddlZy4ddlmZddlmZddlm	Z	WnAe
k
r«ddlmZddlmZddlm	Z	nXy$ddlm
Z
ddlmZWnUe
k
r'y$ddlm
Z
ddlmZWq(e
k
r#dZ
dZq(XnXejd	kr@dZn8ydd
lmZWn!e
k
rwdd
lmZnXejdkrdZn8yddlmZWn!e
k
rÇddlmZnXejdkZerddlZddlmZmZn,ddlZddl mZddl!mZy
e"Z"Wne#k
rWe$e%fZ"nXdefd„ƒYZ&dZ'dS( sþPrivate module full of compatibility hacks.

Primarily this is for downstream redistributions of requests that unvendor
urllib3 without providing a shim.

.. warning::

    This module is private. If you use it, and something breaks, you were
    warned
iÿÿÿÿ(tMappingtMutableMappingN(tfields(tfilepost(tpoolmanager(tHTTPConnection(t
connectioni(ttimeouti(t	appengineii(t	urlencodeturljoin(R	(R
tHTTPHeaderDictcBs
eZdZdd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
esiej
Z
ejZneƒZd„Zd	„Zed
„Zd„Zd„Zd
„Zd„ZeZeZeZd„Zd„Zd„Zd„Zd„Zd„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'
    cKsqtt|ƒjƒi|_|dk	rWt|tƒrG|j|ƒqW|j|ƒn|rm|j|ƒndS(N(tsuperRt__init__t
_containertNonet
isinstancet
_copy_fromtextend(tselftheaderstkwargs((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyR
gs	cCs*||f|j|jƒ<|j|jƒS(N(Rtlower(Rtkeytval((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__setitem__rscCs$|j|jƒ}dj|dƒS(Ns, i(RRtjoin(RRR((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__getitem__vscCs|j|jƒ=dS(N(RR(RR((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__delitem__zscCs|jƒ|jkS(N(RR(RR((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__contains__}scCs„t|tƒr$t|dƒr$tSt|t|ƒƒsNt|ƒ|ƒ}ntd„|jƒDƒƒtd„|jƒDƒƒkS(Ntkeyscss'|]\}}|jƒ|fVqdS(N(R(t.0tktv((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pys	<genexpr>…scss'|]\}}|jƒ|fVqdS(N(R(RR R!((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pys	<genexpr>†s(RRthasattrtFalsettypetdictt
itermerged(Rtother((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__eq__€s cCs|j|ƒS(N(R((RR'((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__ne__ˆscCs
t|jƒS(N(tlenR(R((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__len__‘sccs'x |jjƒD]}|dVqWdS(Ni(Rtvalues(Rtvals((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__iter__”scCsGy||}Wn'tk
r7||jkr3‚n|SX||=|SdS(s¢D.pop(k[,d]) -> v, remove specified key and return its value.

        If key is not found, d is returned if given, otherwise KeyError is
        raised.
        N(tKeyErrort_HTTPHeaderDict__marker(RRtdefaulttvalue((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pytpop™s

cCs#y||=Wntk
rnXdS(N(R/(RR((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pytdiscard­s
cCs}|jƒ}||f}|jj||ƒ}||k	ryt|tƒrX|j|ƒqy|d|d|g|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'
        iiN(RRt
setdefaultRtlisttappend(RRRt	key_lowertnew_valsR-((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pytadd³s	cOs]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__
        is8extend() takes at most 1 positional arguments ({} given)iRN((R*t	TypeErrortformatRRt	iteritemsR:RR"Rtitems(RtargsRR'RRR2((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyRÊs"	"
cCsRy|j|jƒ}Wntk
r+gSXt|tƒrF|dgS|dSdS(smReturns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist.iN(RRR/Rttuple(RRR-((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pytgetlistäs
cCs#dt|ƒjt|jƒƒfS(Ns%s(%s)(R$t__name__R%R&(R((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt__repr__öscCs\xU|D]M}|j|ƒ}t|tƒr:t|ƒ}n|g||j|jƒ<qWdS(N(RARR6RR(RR'RR((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyRùs

cCs t|ƒƒ}|j|ƒ|S(N(R$R(Rtclone((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pytcopys
ccsLxE|D]=}|j|jƒ}x!|dD]}|d|fVq+WqWdS(s8Iterate over all header lines, including duplicate ones.iiN(RR(RRR-R((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyR=s
ccsDx=|D]5}|j|jƒ}|ddj|dƒfVqWdS(s:Iterate over all headers, merging duplicate ones together.is, iN(RRR(RRR((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyR&
s
cCst|jƒƒS(N(R6R=(R((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyR>scCs˜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(RFs	(Rt
startswithtrstriptsplitR7tstrip(tclstmessageRtlineRR2((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pytfrom_httplibsN(#RBt
__module__t__doc__RR
RRRRR(R)tPY3Rtiterkeyst
itervaluestobjectR0R+R.R3R4R:RRAt
getheaderstgetallmatchingheaderstigetRCRRER=R&R>tclassmethodRO(((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyREs: 																				t
basestringRRRRRtqueueR	t
gaecontribR
(ii(s
basestrings
connectionsfieldssfilepostspoolmanagerstimeoutRsqueues	urlencodes
gaecontribsurljoin((RQtcollectionsRRtsystrequeststrequests.packages.urllib3RRRtImportErrorturllib3t$requests.packages.urllib3.connectionRRturllib3.connectionRt	__build__Rtrequests.packages.urllib3.utilturllib3.utilR\t!requests.packages.urllib3.contribRturllib3.contribtversion_infoRRR[turllib.parseR	R
tQueueturllibturlparseRZt	NameErrortstrtbytesRt__all__(((s=/usr/lib/python2.7/site-packages/requests_toolbelt/_compat.pyt<module>
sp


	
	


æ