v_c@s@dZddlmZddlZddlZejddkZer_eefZ dZ neZ e Z e ZdZ ejdd fkreZd Zn d Zeed r dd lmZyddlmZWn!ek rddlmZnXeZdefdYZneZddlmZdZddl m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'm(Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1d Z2dZ3e4e5dZ6dZ7dZ8ejdddfkrddZ9n ej:Z9defd YZ;d!efd"YZ<dS(#s.Fallback pure Python implementation of msgpacki(tdatetimeNiicCs |jS(N(t iteritems(td((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytdict_iteritems scCs |jS(N(titems(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRsiicCs?t|jdko>t|jdto>|jdjdS(Niis maximum recursion depth exceeded(tlentargst isinstancetstrt startswith(te((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt_is_recursionerrorscCstS(N(tTrue(R ((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR 'stpypy_version_info(t newlist_hint(t BytesBuilder(t StringBuildertStringIOcBs&eZddZdZdZRS(tcCs>|r.tt||_|jj|n t|_dS(N(RRtbuildertappend(tselfts((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt__init__7scCsPt|tr|j}nt|tr<t|}n|jj|dS(N(Rt memoryviewttobytest bytearraytbytesRR(RR((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytwrite>s cCs |jjS(N(Rtbuild(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytgetvalueEs(t__name__t __module__RRR(((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR6s  (tBytesIOcCsgS(N((tsize((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytMsi(t BufferFullt OutOfDatat ExtraDatat FormatErrort StackError(tExtTypet TimestampiicCs6|||kr"|||kS|||kSdS(N((tobjttttypettuple((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt_check_type_strictdscCs.t|}|jdkr*tdn|S(Nis$cannot unpack from multi-byte object(Rtitemsizet ValueError(R+tview((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt_get_data_from_bufferks cKstddt||}|j|y|j}WnGtk rWtdn+tk r}t|r{t nnX|j rt ||j n|S(sw Unpack an object from `packed`. Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``ValueError`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. Other exceptions can be raised during unpacking. See :class:`Unpacker` for options. tmax_buffer_sizesUnpack failed: incomplete inputN( tUnpackertNoneRtfeedt_unpackR%R1tRecursionErrorR R(t_got_extradataR&t_get_extradata(tpackedtkwargstunpackertretR ((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytunpackbrs      iicCstj|t||S(s0Explicit type cast for legacy struct.unpack_from(tstructt unpack_fromR(tftbto((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt _unpack_fromsR5cBseZdZddeededddddeddddddZdZdZ dZ d Z d Z d Z d Zed ZedZdZdZeZdZdZdZdZdZRS(s Streaming unpacker. Arguments: :param file_like: File-like object having `.read(n)` method. If specified, unpacker reads serialized data from it and :meth:`feed()` is not usable. :param int read_size: Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`) :param bool use_list: If true, unpack msgpack array to Python list. Otherwise, unpack to Python tuple. (default: True) :param bool raw: If true, unpack msgpack raw to Python bytes. Otherwise, unpack to Python str by decoding with UTF-8 encoding (default). :param int timestamp: Control how timestamp type is unpacked: 0 - Timestamp 1 - float (Seconds from the EPOCH) 2 - int (Nanoseconds from the EPOCH) 3 - datetime.datetime (UTC). Python 2 is not supported. :param bool strict_map_key: If true (default), only str or bytes are accepted for map (dict) keys. :param callable object_hook: When specified, it should be callable. Unpacker calls it with a dict argument after unpacking msgpack map. (See also simplejson) :param callable object_pairs_hook: When specified, it should be callable. Unpacker calls it with a list of key-value pairs after unpacking msgpack map. (See also simplejson) :param str unicode_errors: The error handler for decoding unicode. (default: 'strict') This option should be used only when you have msgpack data which contains invalid UTF-8 string. :param int max_buffer_size: Limits size of data waiting unpacked. 0 means 2**32-1. The default value is 100*1024*1024 (100MiB). Raises `BufferFull` exception when it is insufficient. You should set this parameter when unpacking data from untrusted source. :param int max_str_len: Deprecated, use *max_buffer_size* instead. Limits max length of str. (default: max_buffer_size) :param int max_bin_len: Deprecated, use *max_buffer_size* instead. Limits max length of bin. (default: max_buffer_size) :param int max_array_len: Limits max length of array. (default: max_buffer_size) :param int max_map_len: Limits max length of map. (default: max_buffer_size//2) :param int max_ext_len: Deprecated, use *max_buffer_size* instead. Limits max size of ext type. (default: max_buffer_size) Example of streaming deserialize from file-like object:: unpacker = Unpacker(file_like) for o in unpacker: process(o) Example of streaming deserialize from socket:: unpacker = Unpacker(max_buffer_size) while True: buf = sock.recv(1024**2) if not buf: break unpacker.feed(buf) for o in unpacker: process(o) Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``OutOfData`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. Other exceptions can be raised during unpacking. iidiicCs| dkrd} n|dkr-t|_n0t|jsKtdn||_t|_t|_ d|_ d|_ | sd} n| dkr| } n|dkr| }n|dkr| }n|dkr| d}n|dkr| }n| |_ ||j krt dn|p3t|j d|_t||_t||_| |_||_d|kod knst d n||_| |_||_||_| |_| |_||_||_||_||_d|_| dk rt|  rtd n|dk rGt| rGtdn|dk rot| rotdn|dk r|dk rtdnt| stdndS(Ntstricts!`file_like.read` must be callableiiiiis.read_size must be smaller than max_buffer_sizeiiistimestamp must be 0..3s`list_hook` is not callables`object_hook` is not callables#`object_pairs_hook` is not callables8object_pairs_hook and object_hook are mutually exclusives`ext_hook` is not callableIii@( R6R t_feedingtcallabletreadt TypeErrort file_liketFalseRt_buffert_buff_it_buf_checkpointt_max_buffer_sizeR1tmint _read_sizetboolt_rawt_strict_map_keyt_unicode_errorst _use_listt _timestampt _list_hookt _object_hookt_object_pairs_hookt _ext_hookt _max_str_lent _max_bin_lent_max_array_lent _max_map_lent _max_ext_lent_stream_offset(RRLt read_sizetuse_listtrawt timestamptstrict_map_keyt object_hooktobject_pairs_hookt list_hooktunicode_errorsR4text_hookt max_str_lent max_bin_lent max_array_lent max_map_lent max_ext_len((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRsn                                   cCst|}t|j|jt||jkr>tn|jdkrx|j|j4|j|j8_d|_n|jj|dS(Ni(R3RRNRORQR$RPtextend(Rt next_bytesR2((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR7Us )   cCs)|j|j|j7_|j|_dS(s+ Gets rid of the used parts of the buffer. N(RcRORP(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt_consumedscCs|jt|jkS(N(RORRN(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR:iscCs|j|jS(N(RNRO(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR;lscCs|j|}|j|S(N(t_readRu(RtnR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt read_bytesos cCs5|j||j}|||_|j|||!S(N(t_reserveRORN(RRwti((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRvts   cCst|j|j|}|dkr*dS|jrH|j|_tn|jdkr|j|j4|j|j8_d|_n| }x]|dkrt|j|}|jj |}|sPn|j|7_|t|8}qWt|j||jkrd|_tndS(Ni( RRNRORHRPR%tmaxRSRLRJ(RRwt remain_bytest to_read_bytest read_data((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRy{s*       cCsH t}d}d}|jd|j|j}|jd7_|d@dkrW|}n |d@dkrxd|dA}n |d@dkr|d@}t}||jkrtd ||jn|j|}nj |d @d kr|d @}t }||j kr; td ||j q; n |d @dkre|d @}t }||j kr; td||j q; n |dkrzd}n |dkrt }n |dkrt}n |dkrt}|jd|j|j}|jd7_||jkr td||jfn|j|}n |dkrt}|jdtd|j|jd}|jd7_||jkrtd||jfn|j|}n |dkr-t}|jdtd|j|jd}|jd7_||jkrtd||jfn|j|}n |dkrt}|jdtd|j|j\}}|jd7_||jkrtd||jfn|j|}n |dkr?t}|jdtd|j|j\}}|jd7_||jkr-td||jfn|j|}n|d krt}|jd!td"|j|j\}}|jd!7_||jkrtd||jfn|j|}ns|d#kr|jdtd$|j|jd}|jd7_n,|d%krV|jd&td'|j|jd}|jd&7_n|d(kr|jd|j|j}|jd7_n|d)kr|jdtd|j|jd}|jd7_nc|d*kr|jdtd|j|jd}|jd7_n|d+krf|jd&td,|j|jd}|jd&7_n|d-kr|jdtd.|j|jd}|jd7_n|d/kr|jdtd0|j|jd}|jd7_nG|d1kr;|jdtd2|j|jd}|jd7_n|d3kr|jd&td4|j|jd}|jd&7_n|d5krt}|jdkrtdd|jfn|jdtd6|j|j\}}|jd7_n?|d7krvt}|jdkr9tdd|jfn|jdtd8|j|j\}}|jd7_n|d9krt}|jdkrtdd|jfn|jd!td:|j|j\}}|jd!7_nK|d;krj t}|jd&kr- tdd&|jfn|jd<td=|j|j\}}|jd<7_n|d>kr t}|jd?kr tdd?|jfn|jd@tdA|j|j\}}|jd@7_nW|dBkr[ t}|jd|j|j}|jd7_||jkrI td ||jn|j|}n|dCkr t}|jdtd|j|j\}|jd7_||jkr td ||jn|j|}n^|dDkr_ t}|jdtd|j|j\}|jd7_||jkrM td ||jn|j|}n|dEkr t }|jdtd|j|j\}|jd7_||j kr; td ||j q; ni|dFkrE t }|jdtd|j|j\}|jd7_||j kr; td ||j q; n|dGkr |jdtd|j|j\}|jd7_||j kr td||j nt }n|dHkr+ |jdtd|j|j\}|jd7_||j kr" td||j nt }ntdI||||fS(JNiiiiiiiis%s exceeds max_str_len(%s)iiis%s exceeds max_array_len(%s)s%s exceeds max_map_len(%s)iiiis%s exceeds max_bin_len(%s)iis>Hiis>IitBbs%s exceeds max_ext_len(%s)iis>Hbiis>Ibis>fiis>diiiis>QiRDis>his>iis>qitb1sitb2sitb4sii tb8siiitb16siiiiiiisUnknown header: 0x%x(tTYPE_IMMEDIATER6RyRNROtTYPE_RAWR^R1Rvt TYPE_ARRAYR`tTYPE_MAPRaRMR tTYPE_BINR_RFtTYPE_EXTRbR'(RtexecutettypRwR+RDtL((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt _read_headers                                                                     c sqj|\}}}|tkrC|tkr?tdn|S|tkrn|tkrjtdn|S|tkr|tkrx!t|D]}jtqWdSt |}x*t|D]}|j jt qWj dk rj |}njr|St|S|tkrr|tkrlx.t|D] }jtjtqDWdSjdk rjfdt|D}ni}xt|D]}jt }jr t|ttfkr tdtt|nt r6t|tkr6tj|}njt ||ss%s is not allowed for map keytutf_8iiii('RtEX_READ_ARRAY_HEADERRR1tEX_READ_MAP_HEADERRtEX_SKIPtxrangeR8RRRRZR6RXR.R\RVR-tunicodeRRtPY2tsystinternR[RRUtdecodeRWRRR*t from_bytesRYtto_unixt to_unix_nanot to_datetimeR]( RRRRwR+RzR?Rtkeytts((RsM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR8os~           !          cCs|S(N((R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt__iter__scCs_y!|jt}|j|SWn7tk rD|jtntk rZtnXdS(N(R8RRuR%t StopIterationR9R((RR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt__next__s     cCs|jt|jdS(N(R8RRu(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytskips cCs;y|jt}Wntk r,tnX|j|S(N(R8RR9R(Ru(RR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytunpacks    cCs|jt}|j|S(N(R8RRu(RR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytread_array_headers cCs|jt}|j|S(N(R8RRu(RR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytread_map_headers cCs|jS(N(Rc(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyttellsNii@(RR t__doc__R6R RMR)RR7RuR:R;RxRvRyRRR8RRtnextRRRRR(((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR5sF^ K       M      tPackercBseZdZdeeeeeddZeee dZ dZ dZ dZ dZdZdZd Zed Zd Zd Zd ZdZdZRS(sg MessagePack Packer Usage: packer = Packer() astream.write(packer.pack(a)) astream.write(packer.pack(b)) Packer's constructor has some keyword arguments: :param callable default: Convert user type to builtin type that Packer supports. See also simplejson's document. :param bool use_single_float: Use single precision float type for float. (default: False) :param bool autoreset: Reset buffer after each pack and return its content as `bytes`. (default: True). If set this to false, use `bytes()` to get content and `.reset()` to clear buffer. :param bool use_bin_type: Use bin type introduced in msgpack spec 2.0 for bytes. It also enables str8 type for unicode. (default: True) :param bool strict_types: If set to true, types will be checked to be exact. Derived classes from serializable types will not be serialized and will be treated as unsupported type and forwarded to default. Additionally tuples will not be serialized as lists. This is useful when trying to implement accurate serialization for python types. :param bool datetime: If set to true, datetime with tzinfo is packed into Timestamp type. Note that the tzinfo is stripped in the timestamp. You can get UTC datetime with `timestamp=3` option of the Unpacker. (Python 2 is not supported). :param str unicode_errors: The error handler for encoding unicode. (default: 'strict') DO NOT USE THIS!! This option is kept for very specific usage. cCs||_||_||_||_t|_trK|rKtdnt||_ |pcd|_ |dk rt |st dqn||_dS(Ns%datetime is not supported in Python 2RGsdefault must be callable(t _strict_typest _use_floatt _autoresett _use_bin_typeRRNRR1RTt _datetimeRWR6RIRKt_default(Rtdefaulttuse_single_floatt autoresett use_bin_typet strict_typesRRl((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs        c Cs]t}|jr|}t}n ttf}x,trX|dkrNtdn|dkrj|jjdS||t r|r|jjdS|jjdS||t r6d|kodknr|jjt j d|Sd|kodknr|jjt j d |Sd|ko5d knrY|jjt j d d |Sd |kopdknr|jjt j dd|Sd |kodknr|jjt j dd|Sd|kod knr |jjt j dd|Sd|ko!dknrE|jjt j dd|Sd|ko\dknr|jjt j dd|Sd|kodknr|jjt j dd|Sd|kodknr|jjt j d d!|S| r'|j dk r'|j |}t}q-ntd"n||ttfrt|}|d<krtd%t|jn|j||jj|S||tr|jd&|j}t|}|d=krtd'n|j||jj|S||tr^t||j}|d>krAtd(n|j||jj|S||tr|jr|jjt j d)d*|S|jjt j d+d,|S||ttfrQ||trd-}|j} n|j }|j!} t| } | d.kr*|jjd/n| d#krI|jjd0n| d1krh|jjd2n| d3kr|jjd4n| d5kr|jjd6n{| d kr|jjt j d7d8| nM| dkr|jjt j dd9| n|jjt j dd:| |jjt j d ||jj| dS|||rt|}|j"|x,t#|D]} |j$|| |d.qWdS||t%r|j&t|t'||d.S|j(r||t)rtj*|}d.}q-n| rB|j dk rB|j |}d.}q-nt+d;|fq-WdS(?Nisrecursion limit exceededsssitBiRDitBBiis>Bbiis>BHiis>BhiIs>BIiis>Biils>BQiIs>BqisInteger value out of rangeii s%s is too largesutf-8sString is too largesMemoryview is too larges>Bfis>Bdiiissisisiss>BBiiisCannot serialize %rIII(,RMRtlistR.R R1R6RNRRTt int_typesRAtpackRt OverflowErrorRRRR-Rt_pack_bin_headerRtencodeRWt_pack_raw_headerRR0tfloatRR)R*tto_bytestcodetdatat_pack_array_headerRt_packtdictt_pack_map_pairsRRt _DateTimet from_datetimeRK( RR+t nest_limittchecktcheck_type_strictt default_usedt list_typesRwRRRRz((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR,s                        " "  cCsVy|j|Wnt|_nX|jrR|jj}t|_|SdS(N(RRRNRR(RR+R?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs   cCsB|jt|||jr>|jj}t|_|SdS(N(RRRRNRR(RtpairsR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytpack_map_pairss   cCsN|dkrtn|j||jrJ|jj}t|_|SdS(Nii I(R1RRRNRR(RRwR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytpack_array_headers     cCsN|dkrtn|j||jrJ|jj}t|_|SdS(Nii I(R1t_pack_map_headerRRNRR(RRwR?((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytpack_map_headers     cCst|tstdnd|ko5dknsItdnt|tsgtdnt|}|dkrtdn|dkr|jjd n|d kr|jjd n|d kr|jjd n|dkr |jjdn|dkr)|jjdn~|dkrX|jjdtj d|nO|dkr|jjdtj d|n |jjdtj d||jjtj d||jj|dS(Nstypecode must have int type.iistypecode should be 0-127sdata must have bytes typeIsToo large dataisisisisisisRiss>Hss>I( RtintRKR1RRRNRRAR(RttypecodeRR((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyt pack_ext_types4        # # cCs|dkr,|jjtjdd|S|dkrW|jjtjdd|S|dkr|jjtjdd |Std dS( NiRiis>BHiIs>BIisArray is too large(RNRRARR1(RRw((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs    cCs|dkr,|jjtjdd|S|dkrW|jjtjdd|S|dkr|jjtjdd |Std dS( NiRiis>BHiIs>BIisDict is too large(RNRRARR1(RRw((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs    cCsP|j|x<|D]4\}}|j||d|j||dqWdS(Ni(RR(RRwRRtktv((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs cCs|dkr/|jjtjdd|n|jrf|dkrf|jjtjdd|nh|dkr|jjtjdd |n:|d kr|jjtjd d |n td dS(NiRiis>BBiis>BHiIs>BIisRaw is too large(RNRRARRR1(RRw((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs #" " "cCs|js|j|S|dkrA|jjtjdd|S|dkrl|jjtjdd|S|dkr|jjtjdd |Std dS( Nis>BBiis>BHiIs>BIisBin is too large(RRRNRRARR1(RRw((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR s     cCs |jjS(s/Return internal buffer contents as bytes object(RNR(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRscCst|_dS(sYReset internal buffer. This method is useful only when autoreset=False. N(RRN(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytresetscCs-ts trt|jS|jjSdS(sReturn view of internal buffer.N(tUSING_STRINGBUILDERRRRRNt getbuffer(R((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyR"s N(RR RR6RMR RtDEFAULT_RECURSE_LIMITRR/RRRRRRRRRRRRRR(((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pyRs0,  u     (=RRRRRAt version_infoRRtlongRRRRtrangeRt RuntimeErrorR9R thasattrt__pypy__Rt__pypy__.buildersRRt ImportErrorR RtobjectRRMtioR!t exceptionsR$R%R&R'R(textR)R*RRRRRRRRRRRR-R.R/R3R@RFRBR5R(((sM/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.pytsb        (   P