U .e*@spddlZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddZ dd Z Gd d d eZdS) N)msgpack)CaseInsensitiveDict) HTTPResponsepickle text_typecCst|dS)Nascii)base64Z b64decodeencode)br F/usr/lib/python3.8/site-packages/pip/_vendor/cachecontrol/serialize.py_b64_decode_bytes srcCst|dS)Nutf8)rdecode)sr r r _b64_decode_strsrc@sNeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ dS) SerializerNc Cst|j}|dkr*|jdd}t||_d|tdd|jD|j|j t |j |j |j di}i|d<d|kr|dd}|D]:}t |}|j|d}|dk rt |}||d|<qd d tj|d d gS) NF)decode_contentresponsecss"|]\}}t|t|fVqdSN)r.0kvr r r 2sz#Serializer.dumps..)bodyheadersstatusversionreasonstrictrvary,,scc=4T)Z use_bin_type)rrreadioBytesIOZ_fpdictitemsrrrr r!rsplitstripgetjoinrdumps) selfrequestrrZresponse_headersdataZvaried_headersheaderZ header_valuer r r r.s4   zSerializer.dumpscCs|sdSz|dd\}}Wntk r4d}YnX|dddkrR||}d}|dddd}zt|d |||WStk rYdSXdS) Nr$rscc=0scc==rz _loads_v{})r* ValueErrorrgetattrformatAttributeError)r/r0r1Zverr r r loadsJs zSerializer.loadscCsd|dikrdS|diD] \}}|j|d|kr$dSq$|dd}t|ddd}|dd d kr|d||dd<zt|}Wn$tk rt|d }YnXt f|d d |dS)z`Verify our vary headers match and construct a real urllib3 HTTPResponse object. *r"Nrrr)r1ztransfer-encodingZchunkedrF)rZpreload_content) r,r)rpoprr&r' TypeErrorr r)r/r0cachedr2valueZbody_rawrrr r r prepare_responsehs  zSerializer.prepare_responsecCsdSrr r/r0r1r r r _loads_v0szSerializer._loads_v0cCs2zt|}Wntk r$YdSX|||Sr)rr:r6rAr/r0r1r?r r r _loads_v1s zSerializer._loads_v1c Csztt|d}Wnttjfk r6YdSXt|dd|dd<tdd|dd D|dd<t |dd|dd<tdd|d  D|d <| ||S) Nrrrcss"|]\}}t|t|fVqdSrrrr r r rsz'Serializer._loads_v2..rr css.|]&\}}t||dk r t|n|fVqdSrrFrr r r rsr") jsonr:zlib decompressrr6errorrr(r)rrArDr r r _loads_v2s zSerializer._loads_v2cCsdSrr rBr r r _loads_v3szSerializer._loads_v3cCs6ztj|dd}Wntk r(YdSX|||S)Nzutf-8)encoding)rr:r6rArDr r r _loads_v4s zSerializer._loads_v4)N) __name__ __module__ __qualname__r.r:rArCrErKrLrNr r r r rs 4$r)r r&rGrHZ pip._vendorrZpip._vendor.requests.structuresrcompatrrrrrobjectrr r r r s