U e5d @shdZddlmZddlmZddlmZmZmZddlm Z ddl m Z ddl Z ddl m Z dd lmZmZddlZddlZddlZddlZd d d d dddddg ZzddlmZeddZWnek rdZYnXeefZdZddddddddgZdZ d Z!Gd!d d e"Z#Gd"d d e#Z$Gd#d d e#Z%Gd$d%d%e"Z&zdd&l'm(Z(Wnek rldZ(YnXd'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Zd=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_eOeYeZe[gZ`d^Zad_Zbd`ZcdaZddbZedcZfddZgdeZhdfZidgZjdhZkdiZldjZmdkZndlZoepdmdneqDGdodpdpZrGdqdrdrZsdsdtZtdudvZudwdxZvdydzZwGd{d|d|ZxGd}d~d~ZyddddddZzddddddZ{dddddddZ|dddddddZ}z0ddlm#Z#m$Z$m%Z%m~Z~mZmZmZmZmZWn4ek rexeyZ~Zeze{e|e}f\ZZZZYnXddZedkrdddlZejddZejdeddddejdddddejddddeZejr*en:ejs string load(file) -> object loads(string) -> object Misc variables: __version__ format_version compatible_formats ) FunctionType)dispatch_table)_extension_registry_inverted_registry_extension_cache)islice)partialN)maxsize)packunpack PickleError PicklingErrorUnpicklingErrorPickler Unpicklerdumpdumpsloadloads) PickleBufferrTFz4.0z1.0z1.1z1.2z1.3z2.0z3.0z5.0c@seZdZdZdS)r z6A common base class for the other pickling exceptions.N__name__ __module__ __qualname____doc__rr/usr/lib64/python3.8/pickle.pyr Isc@seZdZdZdS)r z]This exception is raised when an unpicklable object is passed to the dump() method. Nrrrrrr Msc@seZdZdZdS)raThis exception is raised when there is a problem unpickling an object, such as a security violation. Note that other exceptions may also be raised during unpickling, including (but not necessarily limited to) AttributeError, EOFError, ImportError, and IndexError. NrrrrrrTsc@seZdZddZdS)_StopcCs ||_dSN)valueselfr!rrr__init__bsz_Stop.__init__N)rrrr$rrrrrasr) PyStringMap(.012FIJKLMNPQRSTUVXabcd}eghijl]opqrst)uGsI01 sI00 BCcCsg|]}td|r|qS)z[A-Z][A-Z0-9_]+$)rematch).0xrrr s rnc@sFeZdZdZdZddZddZddZdd d Zd d Z ddZ dS)_FramerricCs||_d|_dSr ) file_write current_frame)r#rprrrr$sz_Framer.__init__cCst|_dSr )ioBytesIOrqr#rrr start_framingsz_Framer.start_framingcCs*|jr&|jdkr&|jddd|_dS)NrTforce)rqtell commit_framertrrr end_framings z_Framer.end_framingFcCsf|jrb|j}||jks|rb|}|j}t||jkrP|ttdt|||t |_dS)Nz&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})splitAttributeErrorformatgetattr)objnameZsubpathparentrrr _getattributeBs" rc Cst|dd}|dk r|StjD]X\}}|dks&|dks&|dkrHq&z t||d|krf|WSWq&tk r|Yq&Xq&dS)z$Find the module an object belong to.rN__main__Z __mp_main__r)rsysmodulescopyitemsrr)rr module_namemodulerrr whichmoduleOs  rcCsh|dkr dS|d?d}|j|ddd}|dkrd|dkrd|dd krd|d d @dkrd|d d}|S) aEncode a long to a two's complement little-endian binary string. Note that 0 is a special case, returning an empty string, to save a byte in the LONG1 pickling context. >>> encode_long(0) b'' >>> encode_long(255) b'\xff\x00' >>> encode_long(32767) b'\xff\x7f' >>> encode_long(-256) b'\x00\xff' >>> encode_long(-32768) b'\x00\x80' >>> encode_long(-128) b'\x80' >>> encode_long(127) b'\x7f' >>> rrlittleT byteorderZsignedrN) bit_lengthto_bytes)rmnbytesresultrrr encode_longbs rcCstj|dddS)a\Decode a long from a two's complement little-endian binary string. >>> decode_long(b'') 0 >>> decode_long(b"\xff\x00") 255 >>> decode_long(b"\xff\x7f") 32767 >>> decode_long(b"\x00\xff") -256 >>> decode_long(b"\x00\x80") -32768 >>> decode_long(b"\x80") -128 >>> decode_long(b"\x7f") 127 rTr)int from_bytes)rrrr decode_longsrc@seZdZd;dddddZddZdd Zd d Zd d ZddZdd7d8Z-d9d:Z.e-e e/<e.e e<dS)?_PicklerNT fix_importsbuffer_callbackcCs|dkr t}|dkrt}n"d|kr.tks= 5z"file must have a 'write' attributerr)DEFAULT_PROTOCOLHIGHEST_PROTOCOL ValueError_buffer_callbackr _file_writer TypeErrorroframerr_write_large_bytesmemorprotobinfastr)r#fileprotocolrrrrrr$s*#       z_Pickler.__init__cCs|jdS)aClears the pickler's "memo". The memo is the data structure that remembers which objects the pickler has already seen, so that shared or recursive objects are pickled by reference and not by value. This method is useful when re-using picklers. N)rclearrtrrr clear_memosz_Pickler.clear_memocCsrt|dstd|jjf|jdkr<|ttd|j|jdkrP|j | ||t |j dS)z7Write a pickled representation of obj to the open file.rz2Pickler.__init__() was not called by %s.__init__()z |tt|ddWntk r\tdYnXdS)NF)rrr2persistent IDs in protocol 0 must be ASCII strings) rrr BINPERSIDPERSIDrrUnicodeEncodeErrorr r#rrrrras  z_Pickler.save_persc Cs>t|tstdt|s"td|j}|j} t|dd} |jdkr| dkr|\} }} t| dsntd | |dk r| |j k rtd | |jd kr|| |||| | t n,t | j | f|| }|||d | tn|jdkr^| d kr^|d } t| dstd|dk r8| |j k r8td|dd}|| ||| tn||||| t|dk rt||jkr| t||jt|d n |||dk r|||dk r|||dk r:|dkr ||| tn0||||||| t| t| tdS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callablerr __newobj_ex____new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classrr __newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr)rrr callablerrrrrrr NEWOBJ_EXrrREDUCENEWOBJrrPOPrr_batch_appends_batch_setitemsBUILDTUPLE2) r#funcargsstateZ listitemsZ dictitemsZ state_setterrrrZ func_nameclskwargsrrrrmsz           "        z_Pickler.save_reducecCs|tdSr )rNONErrrr save_nonesz_Pickler.save_nonecCs4|jdkr||rtntn||r*tntdS)Nr)rrNEWTRUENEWFALSETRUEFALSErrrr save_bools z_Pickler.save_boolcCs.|jr~|dkrN|dkr.|ttd|dS|dkrN|ttd|dSd|krbdkr~nn|ttd|dS|jd krt|}t|}|d kr|t td||n|t td||dSd|krdkrnn|t t | d d n|tt | d d dS)Nrrrdrr)rrBINFLOATr FLOATrrrrrr save_floatsz_Pickler.save_floatcCs|jdkr@|s |jtd|dn|jtjt|ddf|ddSt|}|dkrj|tt d||nf|dkr|jdkr| t t d ||n<||j j kr| tt d ||n|tt d ||||dS) Nrrrlatin1rrrr{r)rrbytescodecsrrr~rSHORT_BINBYTESr r BINBYTES8rr|BINBYTESrr#rrrrr save_bytess"   z_Pickler.save_bytescCs|jdkr:|s |jtd|dn|jtt|f|ddSt|}||jjkrf|tt d||n| tt d||dS)Nrrr*r{) rr bytearrayr-r~rr|r BYTEARRAY8r rr2rrrsave_bytearray)s  z_Pickler.save_bytearrayc Cs|jdkrtd|t}|js*tdd}|jdk rFt||}|rp|jr`||q| |n| t |jr| t W5QRXdS)Nrz0PickleBuffer can only pickled with protocol >= 5zHPickleBuffer can not be pickled when pointing to a non-contiguous bufferT) rr raw contiguousrboolreadonlyr3tobytesr6r NEXT_BUFFERREADONLY_BUFFER)r#rmZin_bandrrrsave_picklebuffer8s    z_Pickler.save_picklebuffercCs|jr|dd}t|}|dkrF|jdkrF|ttd||nf|dkrp|jdkrp|ttd||n<||j j kr|t td||n|t td||nT| d d }| d d }| d d}| dd}| dd}|t |dd||dS)Nutf-8 surrogatepassrrrr,r{r\z\u005cz\u0000 z\u000a z\u000dz\u001araw-unicode-escaper)rrr~rrSHORT_BINUNICODEr r BINUNICODE8rr| BINUNICODEreplaceUNICODErr$rrrsave_strRs&       z_Pickler.save_strcCs:|s(|jr|tn|ttdSt|}|j}|j}|dkr|jdkr|D] }||qRt ||kr| |t |d}|t ||n|t || |dS|j}|t|D] }||qt ||kr$| |t |d}|jr |t|n|t |d|dS|t| |dS)Nrrrr)rr EMPTY_TUPLEMARKTUPLEr~rrrrrr _tuplesize2coderPOP_MARK)r#rrrrZelementrrrrr save_tupleis:     z_Pickler.save_tuplecCs8|jr|tn|tt||||dSr )rr EMPTY_LISTrOLISTrr rrrr save_lists   z_Pickler.save_listicCs|j}|j}|js0|D]}|||tqdSt|}tt||j}t|}|dkr||t |D] }||qd|t n|r||d|t||jkr8dSq8dSNrr) rrrAPPENDiterlistr _BATCHSIZEr~rOAPPENDS)r#rrrrmittmprrrrr s(     z_Pickler._batch_appendscCs<|jr|tn|tt||||dSr )rr EMPTY_DICTrODICTrr rrrrr save_dicts   z_Pickler.save_dictc Cs|j}|j}|js<|D] \}}|||||tqdSt|}tt||j}t|}|dkr|t |D]\}}||||qp|t n(|r|d\}}|||||t||jkrDdSqDdSrW) rrrSETITEMrYrZrr[r~rOSETITEMS) r#rrrkvr]r^rrrrr s0       z_Pickler._batch_setitemscCs|j}|j}|jdkr0|jtt|f|ddS|t||t|}tt ||j }t |}|dkr|t |D] }||qv|t ||j krJdSqJdSNrr*r)rrrrsetrZ EMPTY_SETrrYrr[r~rOADDITEMS)r#rrrr]Zbatchritemrrrsave_sets"    z_Pickler.save_setcCs|j}|j}|jdkr0|jtt|f|ddS|t|D] }||qZ5e5ee6d<d?d@Z7e7ee8d<dAdBZ9e9ee:d<dCdDZ;e;eed<dGdHZ?e?ee@d<dIdJZAeAeeBd<dKdLZCeCeeDd<dMdNZEeEeeFd<dOdPZGeGeeHd<dQdRZIeIeeJd<dSdTZKeKeeLd<dUdVZMeMeeNd<dWdXZOeOeePd<dYdZZQeQeeRd<d[d\ZSeSeeTd<d]d^ZUeUeeVd<d_d`ZWeWeeXd<dadbZYdcddZZeZee[d<dedfZ\e\ee]d<dgdhZ^e^ee_d<didjZ`e`eead<dkdlZbebeecd<dmdnZdedeeed<dodpZfefeegd<dqdrZheheeid<dsdtZjejeekd<dudvZldwdxZmdydzZneneeod<d{d|Zpepeeqd<d}d~Zrereesd<ddZteteeud<ddZveveewd<ddZxexeeyd<ddZzezee{d<ddZ|e|ee}d<ddZ~e~eed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<dS) _UnpicklerTASCIIstrictNrencodingerrorsbufferscCsH|dk rt|nd|_|j|_|j|_i|_||_||_d|_ ||_ dS)aThis takes a binary file for reading a pickle data stream. The protocol version of the pickle is detected automatically, so no proto argument is needed. The argument *file* must have two methods, a read() method that takes an integer argument, and a readline() method that requires no arguments. Both methods should return bytes. Thus *file* can be a binary file object opened for reading, an io.BytesIO object, or any other custom object that meets this interface. The file-like object must have two methods, a read() method that takes an integer argument, and a readline() method that requires no arguments. Both methods should return bytes. Thus file-like object can be a binary file object opened for reading, a BytesIO object, or any other custom object that meets this interface. If *buffers* is not None, it should be an iterable of buffer-enabled objects that is consumed each time the pickle stream references an out-of-band buffer view. Such buffers have been given in order to the *buffer_callback* of a Pickler object. If *buffers* is None (the default), then the buffers are taken from the pickle stream, assuming they are serialized there. It is an error for *buffers* to be None if the pickle stream was produced with a non-None *buffer_callback*. Other optional arguments are *fix_imports*, *encoding* and *errors*, which are used to control compatibility support for pickle stream generated by Python 2. If *fix_imports* is True, pickle will try to map the old Python 2 names to the new names used in Python 3. The *encoding* and *errors* tell pickle how to decode 8-bit string instances pickled by Python 2; these default to 'ASCII' and 'strict', respectively. *encoding* can be 'bytes' to read theses 8-bit string instances as bytes objects. Nr) rY_buffersr_file_readliner _file_readrrrrr)r#rrrrrrrrr$rs'z_Unpickler.__init__c Cst|dstd|jjft|j|j|_|jj|_|jj |_ |jj |_ g|_ g|_ |j j |_ d|_|j}|j}z&|d}|st||d|qtWn,tk r}z|jWYSd}~XYnXdS)zRead a pickled object representation from the open file. Return the reconstituted object hierarchy specified in the file. rz4Unpickler.__init__() was not called by %s.__init__()rrN)rrrrrrr _unframerrrr metastackstackappendrrEOFErrorrr!)r#rrkeyZstopinstrrrrs*     z_Unpickler.loadcCs |j}|j|_|jj|_|Sr )rrpoprr#rrrrpop_marks  z_Unpickler.pop_markcCs tddS)Nz%unsupported persistent id encountered)rrrrrpersistent_loadsz_Unpickler.persistent_loadcCs:|dd}d|kr"tks0ntd|||_dS)Nrrzunsupported pickle protocol: %d)rrrr)r#rrrr load_protos z_Unpickler.load_protorcCs8td|d\}|tjkr(td||j|dS)Nr{zframe size > sys.maxsize: %d)r rrr rrrrrrrrs  z_Unpickler.load_framecCsLz|ddd}Wntk r6tdYnX|||dS)Nrrr)rdecodeUnicodeDecodeErrorrrrrrrr load_persids z_Unpickler.load_persidcCs|j}|||dSr )rrrrrrrrload_binpersids z_Unpickler.load_binpersidcCs|ddSr rrtrrr load_nonesz_Unpickler.load_nonecCs|ddS)NFrrtrrr load_falsesz_Unpickler.load_falsecCs|ddS)NTrrtrrr load_truesz_Unpickler.load_truecCsL|}|tddkrd}n |tddkr4d}n t|d}||dS)NrFTr)rrrrr)r#rvalrrrload_ints z_Unpickler.load_intcCs|td|dddS)Nrrrrr rrtrrr load_binintsz_Unpickler.load_binintcCs||dddSrW)rrrtrrr load_binint1sz_Unpickler.load_binint1cCs|td|dddS)Nrrrrrtrrr load_binint2sz_Unpickler.load_binint2cCs@|dd}|r,|ddkr,|dd}|t|ddS)NrLr)rrr)r#rrrr load_long s z_Unpickler.load_longcCs*|dd}||}|t|dSrW)rrrrrrr load_long1s z_Unpickler.load_long1cCs>td|d\}|dkr"td||}|t|dS)Nrrrz#LONG pickle has negative byte count)r rrrrrrrr load_long4s  z_Unpickler.load_long4cCs|t|dddSNr)rr}rrtrrr load_float!sz_Unpickler.load_floatcCs|td|dddS)Nr&rrrrtrrr load_binfloat%sz_Unpickler.load_binfloatcCs"|jdkr|S||j|jSdS)Nr-)rrrr"rrr_decode_string)s z_Unpickler._decode_stringcCsl|dd}t|dkrF|d|dkrF|ddkrF|dd}ntd||t|ddS)Nrrrs"'rz)the STRING opcode argument must be quoted)rr~rrrr. escape_decoderrrr load_string2s (z_Unpickler.load_stringcCs@td|d\}|dkr"td||}|||dS)Nrrrz(BINSTRING pickle has negative byte count)r rrrrr#r~rrrrload_binstring<s  z_Unpickler.load_binstringcCs:td|d\}|tkr&tdt|||dS)Nrrz2BINBYTES exceeds system's maximum size of %d bytesr rr rrr#r~rrr load_binbytesEs z_Unpickler.load_binbytescCs |t|ddddS)NrrG)rrrrtrrr load_unicodeMsz_Unpickler.load_unicodecCsBtd|d\}|tkr&tdt|t||dddS)Nrrz4BINUNICODE exceeds system's maximum size of %d bytesr@rAr rr rrrrrrrload_binunicodeQs z_Unpickler.load_binunicodecCsBtd|d\}|tkr&tdt|t||dddS)Nr{rz5BINUNICODE8 exceeds system's maximum size of %d bytesr@rArrrrrload_binunicode8Ys z_Unpickler.load_binunicode8cCs:td|d\}|tkr&tdt|||dS)Nr{rz3BINBYTES8 exceeds system's maximum size of %d bytesrrrrrload_binbytes8as z_Unpickler.load_binbytes8cCsFtd|d\}|tkr&tdtt|}||||dS)Nr{rz4BYTEARRAY8 exceeds system's maximum size of %d bytes)r rr rr4rr)r#r~brrrload_bytearray8is z_Unpickler.load_bytearray8cCsL|jdkrtdzt|j}Wntk r<tdYnX||dS)NzLpickle stream refers to out-of-band data but no *buffers* argument was givenznot enough out-of-band buffers)rrnext StopIterationr)r#rrrrload_next_bufferss z_Unpickler.load_next_bufferc Cs6|jd}t|}|js(||jd<W5QRXdSr)r memoryviewr: toreadonly)r#rr>rrrload_readonly_buffer~s  z_Unpickler.load_readonly_buffercCs,|dd}||}|||dSrW)rrrrrrrload_short_binstrings z_Unpickler.load_short_binstringcCs"|dd}|||dSrW)rrrrrrload_short_binbytessz_Unpickler.load_short_binbytescCs*|dd}|t||dddS)Nrrr@rA)rrrrrrrload_short_binunicodesz _Unpickler.load_short_binunicodecCs|}|t|dSr )rrrrrrr load_tuplesz_Unpickler.load_tuplecCs|ddS)Nrrrtrrrload_empty_tuplesz_Unpickler.load_empty_tuplecCs|jdf|jd<dSrrrtrrr load_tuple1sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd<dS)Nrrrrtrrr load_tuple2sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd<dS)Nrrrrtrrr load_tuple3sz_Unpickler.load_tuple3cCs|gdSr rrtrrrload_empty_listsz_Unpickler.load_empty_listcCs|idSr rrtrrrload_empty_dictionarysz _Unpickler.load_empty_dictionarycCs|tdSr )rrgrtrrrload_empty_setsz_Unpickler.load_empty_setcCs|}|t|dSr )rrrlrrrrload_frozensetsz_Unpickler.load_frozensetcCs|}||dSr )rrrrrr load_listsz_Unpickler.load_listcs4|fddtdtdD}||dS)Ncsi|]}||dqS)rr)rlrrrr sz(_Unpickler.load_dict..rr)rranger~r)r#drrr load_dicts  z_Unpickler.load_dictc Cs|st|trt|drjz ||}Wqttk rf}z$td|jt|ftdW5d}~XYqtXn ||}| |dS)NZ__getinitargs__zin constructor for %s: %sr) rrrrrrrexc_inforr)r#klassrr!errrrr _instantiates    z_Unpickler._instantiatecCsL|ddd}|ddd}|||}|||dS)Nrr)rr find_classrrr#rrrrrr load_insts z_Unpickler.load_instcCs"|}|d}|||dSNr)rrr)r#rrrrrload_objs z_Unpickler.load_objcCs2|j}|j}|j|f|}||dSr rrrr)r#rrrrrr load_newobjs  z_Unpickler.load_newobjcCs>|j}|j}|j}|j|f||}||dSr r)r#rrrrrrrload_newobj_exs    z_Unpickler.load_newobj_excCsF|ddd}|ddd}|||}||dS)Nrr@)rrrrrrrr load_globals z_Unpickler.load_globalcCsJ|j}|j}t|tk s,t|tk r4td||||dS)NzSTACK_GLOBAL requires str)rrrrrrr)r#rrrrrload_stack_globals   z_Unpickler.load_stack_globalcCs|dd}||dSrW)r get_extensionr#r{rrr load_ext1sz_Unpickler.load_ext1cCs td|d\}||dS)Nrrr rrrrrr load_ext2 sz_Unpickler.load_ext2cCs td|d\}||dS)Nrrrrrrr load_ext4sz_Unpickler.load_ext4cCspg}t||}||k r&||dSt|}|sP|dkrDtdtd||j|}|t|<||dS)NrzEXT specifies code <= 0zunregistered extension code %d)rrrrrrr)r#r{Znilrrrrrrs     z_Unpickler.get_extensioncCstd|||jdkrT|jrT||ftjkr@tj||f\}}n|tjkrTtj|}t|dd|jdkr~ttj ||dSt tj ||SdS)Nzpickle.find_classrrror) rauditrrrzZ NAME_MAPPINGZIMPORT_MAPPINGrqrrr)r#rrrrrr#s    z_Unpickler.find_classcCs&|j}|}|d}|||d<dSrrr)r#rrrrrr load_reduce1sz_Unpickler.load_reducecCs|jr|jd=n|dSr)rrrtrrrload_pop8s z_Unpickler.load_popcCs |dSr )rrtrrr load_pop_mark?sz_Unpickler.load_pop_markcCs||jddSr)rrrtrrrload_dupCsz_Unpickler.load_dupcCs(t|dd}||j|dSr)rrrrrrrrload_getGsz_Unpickler.load_getcCs"|dd}||j|dSrW)rrrrrrr load_bingetLsz_Unpickler.load_bingetcCs&td|d\}||j|dS)Nrr)r rrrrrrrload_long_bingetQsz_Unpickler.load_long_bingetcCs8t|dd}|dkr$td|jd|j|<dS)Nrrznegative PUT argument)rrrrrrrrrload_putVsz_Unpickler.load_putcCs2|dd}|dkrtd|jd|j|<dS)Nrrznegative BINPUT argumentr)rrrrrrrr load_binput]sz_Unpickler.load_binputcCs6td|d\}|tkr"td|jd|j|<dS)Nrrznegative LONG_BINPUT argumentr)r rr rrrrrrrload_long_binputdsz_Unpickler.load_long_binputcCs|j}|jd|t|<dSr)rrr~)r#rrrr load_memoizeksz_Unpickler.load_memoizecCs$|j}|}|d}||dSr)rrr)r#rr!rZrrr load_appendpsz_Unpickler.load_appendcCsZ|}|jd}z |j}Wntk r0YnX||dS|j}|D] }||qHdSr)rrextendrr)r#rZlist_objrrrjrrr load_appendsws  z_Unpickler.load_appendscCs*|j}|}|}|d}|||<dSrr)r#rr!rrrrr load_setitems z_Unpickler.load_setitemcCs@|}|jd}tdt|dD]}||d|||<q"dS)Nrrrr)rrrr~)r#rrrrrr load_setitemss z_Unpickler.load_setitemscCsD|}|jd}t|tr(||n|j}|D] }||q2dSr)rrrrgupdateadd)r#rZset_objrrjrrr load_additemss   z_Unpickler.load_additemsc Cs|j}|}|d}t|dd}|dk r6||dSd}t|trXt|dkrX|\}}|r|j}tj}| D]*\}} t |t kr| |||<qp| ||<qp|r| D]\}} t ||| qdS)Nr __setstate__r) rrrrrr~__dict__rinternrrrsetattr) r#rrinstsetstateZ slotstateZ inst_dictrrdrerrr load_builds(   z_Unpickler.load_buildcCs"|j|jg|_|jj|_dSr )rrrrtrrr load_marksz_Unpickler.load_markcCs|j}t|dSr )rrrr"rrr load_stops z_Unpickler.load_stop)rrrr$rrrrrrrrrrrrrrrrrrrr"rrrrrrrr#rr rr!rr(rr'rrSTRINGr BINSTRINGrr1rrLrrJrrIrr0rr5rr<rr=rSHORT_BINSTRINGrr/rrHrrPrrNrTUPLE1rr rTUPLE3rrTrr_rrhrrmrrUrr`rrINSTrOBJrrrrrryrrxrrtrrurrvrrrrrr rrRrDUPrrrrrrrrrrrrrrrrXrr\rrbrrcrrirr rrOrrrrrrrps* 0                                                                     rrcCst||||d|dSNr)rr)rrrrrrrr_dumps rcCs*t}t||||d||}|Sr)rrrsrrgetvalue)rrrrrresrrr_dumpssrrrrcCst|||||dS)Nrrrr)rr)rrrrrrrr_loadsrcCs2t|trtdt|}t|||||dS)Nz%Can't load pickle from unicode stringr)rrrrrrsrr)srrrrrrrr_loadss  r) r r rrrrrrrcCsddl}|Sr)doctestZtestmod)rrrr_testsrrz$display contents of the pickle files)Z description pickle_filebr*zthe pickle file)rnargshelpz-tz--test store_truezrun self-test suite)actionrz-vz)run verbosely; only affects self-test run)N)N)rtypesrcopyregrrrr itertoolsr functoolsrrr Zstructr r rjrrr.rz__all___picklerrr~rrr-r4Z bytes_typesZformat_versionZcompatible_formatsrr Exceptionr r rrZorg.python.corer%rOrr rRr r(r"rrr#rrrrrrrrrLrJrXr ryr`r_r\rrr rrUrTr rrrrbrPrNrcr'rrrrrtrurvr r r rrr r!rQr1r/rHrIr0rhrirmrrxrrr5r<r=rdirrorrrrrrrrrrrrrrrrrrrargparseArgumentParserparser add_argumentZFileType parse_argsrZtestrZ print_helpZpprintrrrrrrsh            ?; ^]  0