a �DOg���@sDddlmZddlmZddlmZmZmZddlmZddl m Z ddl Z ddl m Z ddl mZmZddlZddlZddlZddlZgd �Zzdd lmZe�d �d ZWney�d ZYn0eefZdZgd�ZdZdZ Gdd�de!�Z"Gdd�de"�Z#Gdd�de"�Z$Gdd�de!�Z%zddl&m'Z'Wne�yJdZ'Yn0dZ(dZ)dZ*dZ+dZ,d Z-d!Z.d"Z/d#Z0d$Z1d%Z2d&Z3d'Z4d(Z5d)Z6d*Z7d+Z8d,Z9d-Z:d.Z;d/Zd2Z?d3Z@d4ZAd5ZBd6ZCd7ZDd8ZEd9ZFd:ZGd;ZHdZKd?ZLd@ZMdAZNdBZOdCZPdDZQdEZRdFZSdGZTdHZUdIZVdJZWdKZXdLZYdMZZdNZ[dOZ\dPZ]dQZ^eNeXeYeZgZ_dRZ`dSZadTZbdUZcdVZddWZedXZfdYZgdZZhd[Zid\Zjd]Zkd^Zld_Zmd`Zne�odadb�ep�D��Gdcdd�dd�ZqGdedf�df�Zrdgdh�Zsdidj�Ztdkdl�Zudmdn�ZvGdodp�dp�ZwGdqdr�dr�Zxd�d dds�dtdu�Zyd�d dds�dvdw�Zzd dxdyddz�d{d|�Z{d dxdyddz�d}d~�Z|z0dd lm"Z"m#Z#m$Z$m}Z}m~Z~mZm�Z�m�Z�m�Z�Wn2e�y�ewexZ}Z~eyeze{e|f\ZZ�Z�Z�Yn0dd��Z�e�d�k�r@ddl�Z�e�j�d�d��Z�e�j�d�e���d��d�d�d��e�j�d�d�d�d�d��e�j�d�d�d�d��e����Z�e�j��re��n:e�j��se����n(ddl�Z�e�j�D]Z�e�e��Z�e���e���q&dS)��)� FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�islice)�partialN)�maxsize)�pack�unpack) � PickleError� PicklingError�UnpicklingError�Pickler� Unpickler�dump�dumps�load�loads)� PickleBufferrTF�4.0)z1.0z1.1z1.2z1.3z2.0z3.0rz5.0��c@s eZdZdS)r N��__name__� __module__� __qualname__�rr�/usr/lib64/python3.9/pickle.pyr Isr c@s eZdZdS)r Nrrrrrr Msr c@s eZdZdS)rNrrrrrrTs rc@seZdZdd�ZdS)�_StopcCs ||_dS�N)�value��selfr!rrr�__init__bsz_Stop.__init__N)rrrr$rrrrrasr)� PyStringMap�(�.�0�1�2�F�I�J�K�L�M�N�P�Q�R�S�T�U�V�X�a�b�c�d�}�e�g�h�i�j�l�]�o�p�q�r�s�t�)�u�GsI01 sI00 �������������������������B�C��������������������������cCsg|]}t�d|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr� ��rnc@sFeZdZdZdZdd�Zdd�Zdd�Zdd d �Zd d �Z dd�Z dS)�_FramerricCs||_d|_dSr )� file_write� current_frame)r#rqrrrr$�sz_Framer.__init__cCst��|_dSr )�io�BytesIOrr�r#rrr� start_framing�sz_Framer.start_framingcCs*|jr&|j��dkr&|jdd�d|_dS)NrT��force)rr�tell� commit_framerurrr� end_framing�s z_Framer.end_framingFcCsf|jrb|j}|��|jks|rb|��}|j}t|�|jkrP|ttdt|���||�t � �|_dS)N�z&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})�split�AttributeError�format�getattr)�obj�name�subpath�parentrrr� _getattributeBs� �� r�c Cs�t|dd�}|dur|Stj����D]V\}}|dks&|dks&|durHq&z t||�d|urf|WSWq&tyzYq&0q&dS)Nr�__main__� __mp_main__r)r��sys�modules�copy�itemsr�r�)r�r�� module_name�modulerrr� whichmoduleOs  �� r�cCsh|dkr dS|��d?d}|j|ddd�}|dkrd|dkrd|dd krd|d d @dkrd|dd�}|S) Nrro���littleT�� byteorder�signedr���������)� bit_length�to_bytes)rm�nbytes�resultrrr� encode_longbs r�cCstj|ddd�S)Nr�Tr�)�int� from_bytes)r�rrr� decode_long�sr�c@s�eZdZd;ddd�dd�Zdd�Zdd �Zd d �Zd d �Zdd�Zdd7d8�Z-d9d:�Z.e-e e/<e.e e<dS)?�_PicklerNT�� fix_imports�buffer_callbackcCs�|dur t}|dkrt}n"d|kr.tks= 5z"file must have a 'write' attributer�r�)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL� ValueError�_buffer_callbackr�� _file_writer�� TypeErrorrp�framerr��_write_large_bytes�memor��proto�bin�fastr�)r#�file�protocolr�r�rrrr$�s*#        z_Pickler.__init__cCs|j��dSr )r��clearrurrr� clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|�ttd|j��|jdkrP|j� �|� |�|�t �|j� �dS)Nr�z2Pickler.__init__() was not called by %s.__init__()��| |j u�r>td��|dd�}|| �||�| t�n||�||�| t�|du�r�t|�|jv�r�| t|�|jt|�d ��n |�|�|du�r�|�|�|du�r�|�|�|du�r@|du�r||�| t�n0||�||�||�| t�| t�| t�dS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callabler�r�� __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�)r�r�r �callabler�r�r�r�r�r�r�� NEWOBJ_EXrr �REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD�TUPLE2) r#�func�args�state� listitems� dictitems� state_setterr�r�r�� func_name�cls�kwargsrrrr�msz    ��    ��   "        z_Pickler.save_reducecCs|�t�dSr )r��NONEr�rrr� save_none�sz_Pickler.save_nonecCs4|jdkr|�|rtnt�n|�|r*tnt�dS)Nr�)r�r��NEWTRUE�NEWFALSE�TRUE�FALSEr�rrr� save_bool�s z_Pickler.save_boolcCs.|jr~|dkrN|dkr.|�ttd|��dS|dkrN|�ttd|��dSd|krbdkr~nn|�ttd|��dS|jd kr�t|�}t|�}|d kr�|�t td|�|�n|�t td|�|�dSd|kr�dk�rnn|�t t |�� d �d �n|�tt |�� d �d �dS)Nrr�r�����dr�r�)r�r��BINFLOATr �FLOATr�r�r�rrr� save_floatsz_Pickler.save_floatcCs�|jdkr@|s |jtd|d�n|jtjt|d�df|d�dSt|�}|dkrj|�tt d|�|�nf|dkr�|jdkr�|� t t d |�|�n<||j j kr�|� tt d |�|�n|�tt d |�|�|�|�dS) Nr�r�r��latin1r�r����rr|r�)r�r��bytes�codecsr�r�rr��SHORT_BINBYTESr r�� BINBYTES8r�r}�BINBYTESr��r#r�r�rrr� save_bytess  � z_Pickler.save_bytescCs�|jdkr:|s |jtd|d�n|jtt|�f|d�dSt|�}||jjkrf|�tt d|�|�n|� tt d|�|�dS)Nrrr6r|) r�r�� bytearrayr9rr�r}r�� BYTEARRAY8r r�r>rrr�save_bytearray)s  z_Pickler.save_bytearraycCs�|jdkrtd��|���~}|js*td��d}|jdurFt|�|��}|rp|jr`|�|���q�|� |���n|� t �|jr�|� t �Wd�n1s�0YdS)Nrz0PickleBuffer can only pickled with protocol >= 5zHPickleBuffer can not be pickled when pointing to a non-contiguous bufferT) r�r �raw� contiguousr��bool�readonlyr?�tobytesrBr�� NEXT_BUFFER�READONLY_BUFFER)r#r��m�in_bandrrr�save_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 |�d�d�|�|�dS)N�utf-8� surrogatepassr�rr�r8r|r��\z\u005c�z\u0000� z\u000a� z\u000d�z\u001a�raw-unicode-escaper�)r�r�rr�r��SHORT_BINUNICODEr r�� BINUNICODE8r�r}� BINUNICODE�replace�UNICODEr�r/rrr�save_strRs&       �z_Pickler.save_strcCs:|s(|jr|�t�n|�tt�dSt|�}|j}|j}|dkr�|jdkr�|D] }||�qRt |�|vr�|� |t |�d�}|�t ||�n|�t |�|� |�dS|j}|t�|D] }||�q�t |�|v�r$|� |t |�d�}|j�r |t|�n|t |d|�dS|t�|� |�dS)Nr�r�rr�)r�r�� EMPTY_TUPLE�MARK�TUPLErr�r�r�r�r�r�_tuplesize2coder��POP_MARK)r#r�r�r�r��elementr�r�rrr� save_tupleis:     z_Pickler.save_tuplecCs8|jr|�t�n|�tt�|�|�|�|�dSr )r�r�� EMPTY_LISTr\�LISTr�rr�rrr� save_list�s   z_Pickler.save_listi�cCs�|j}|j}|js0|D]}||�|t�qdSt|�}tt||j��}t|�}|dkr||t �|D] }||�qd|t �n|r�||d�|t�||jkr8dSq8dS�Nr�r) r�r�r��APPEND�iter�listr� _BATCHSIZErr\�APPENDS)r#r�r�r�rm�it�tmpr�rrrr�s(     z_Pickler._batch_appendscCs<|jr|�t�n|�tt�|�|�|�|���dSr )r�r�� EMPTY_DICTr\�DICTr�rr�r�rrr� save_dict�s   z_Pickler.save_dictc Cs�|j}|j}|js<|D] \}}||�||�|t�qdSt|�}tt||j��}t|�}|dkr�|t �|D]\}}||�||�qp|t �n(|r�|d\}}||�||�|t�||jkrDdSqDdSre) r�r�r��SETITEMrgrhrrirr\�SETITEMS) r#r�r�r��k�vrkrlr�rrrr�s0       z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|�|�t|�}tt ||j ��}t |�}|dkr�|t �|D] }||�qv|t �||j krJdSqJdS�Nrr6r)r�r�r�r��setrh� EMPTY_SETr�rgrrirr\�ADDITEMS)r#r�r�r�rk�batchr��itemrrr�save_set�s"    z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|D] }||�q�Z5e5ee6d<d?d@�Z7e7ee8d<dAdB�Z9e9ee:d<dCdD�Z;e;eed<dGdH�Z?e?ee@d<dIdJ�ZAeAeeBd<dKdL�ZCeCeeDd<dMdN�ZEeEeeFd<dOdP�ZGeGeeHd<dQdR�ZIeIeeJd<dSdT�ZKeKeeLd<dUdV�ZMeMeeNd<dWdX�ZOeOeePd<dYdZ�ZQeQeeRd<d[d\�ZSeSeeTd<d]d^�ZUeUeeVd<d_d`�ZWeWeeXd<dadb�ZYdcdd�ZZeZee[d<dedf�Z\e\ee]d<dgdh�Z^e^ee_d<didj�Z`e`eead<dkdl�Zbebeecd<dmdn�Zdedeeed<dodp�Zfefeegd<dqdr�Zheheeid<dsdt�Zjejeekd<dudv�Zldwdx�Zmdydz�Zneneeod<d{d|�Zpepeeqd<d}d~�Zrereesd<dd��Zteteeud<d�d��Zveveewd<d�d��Zxexeeyd<d�d��Zzezee{d<d�d��Z|e|ee}d<d�d��Z~e~eed<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<dS)�� _UnpicklerT�ASCII�strictN�r��encoding�errors�bufferscCsH|durt|�nd|_|j|_|j|_i|_||_||_d|_ ||_ dS�Nr) rg�_buffersr��_file_readliner�� _file_readr�r�r�r�r�)r#r�r�r�r�r�rrrr$rs'z_Unpickler.__init__c Cs�t|d�std|jjf��t|j|j�|_|jj|_|jj |_ |jj |_ g|_ g|_ |j j |_ d|_|j}|j}z&|d�}|s�t�||d|�qtWn*ty�}z|jWYd}~Sd}~00dS)Nr�z4Unpickler.__init__() was not called by %s.__init__()rr�)r�rr�rr�r�r�� _unframerr�r�r�� metastack�stack�appendr�r��EOFErrorrr!)r#r�r��key�stopinstrrrr�s* �    z_Unpickler.loadcCs |j}|j��|_|jj|_|Sr )r�r��popr��r#r�rrr�pop_mark�s  z_Unpickler.pop_markcCs td��dS)Nz%unsupported persistent id encountered)rrrrr�persistent_load�sz_Unpickler.persistent_loadcCs:|�d�d}d|kr"tks0ntd|��||_dS)Nr�rzunsupported pickle protocol: %d)r�r�r�r�)r#r�rrr� load_proto�s z_Unpickler.load_protorcCs8td|�d��\}|tjkr(td|��|j�|�dS)Nr|�zframe size > sys.maxsize: %d)r r�r�r r�r�r�r�rrrr��s  z_Unpickler.load_framecCsJz|��dd��d�}Wnty4td��Yn0|�|�|��dS)Nr�r�r)r��decode�UnicodeDecodeErrorrr�r�rrrr� load_persid�s � z_Unpickler.load_persidcCs|j��}|�|�|��dSr )r�r�r�r�rrrr�load_binpersid�s z_Unpickler.load_binpersidcCs|�d�dSr �r�rurrr� load_none�sz_Unpickler.load_nonecCs|�d�dS)NFr�rurrr� load_false�sz_Unpickler.load_falsecCs|�d�dS)NTr�rurrr� load_true�sz_Unpickler.load_truecCsL|��}|tdd�krd}n |tdd�kr4d}n t|d�}|�|�dS)Nr�FTr)r�r#r"r�r�)r#r��valrrr�load_int�s z_Unpickler.load_intcCs|�td|�d��d�dS)Nr'rr�r�r r�rurrr� load_binint�sz_Unpickler.load_binintcCs|�|�d�d�dSre)r�r�rurrr� load_binint1sz_Unpickler.load_binint1cCs|�td|�d��d�dS)Nr&r�rr�rurrr� load_binint2sz_Unpickler.load_binint2cCs@|��dd�}|r,|ddkr,|dd�}|�t|d��dS)Nr��Lr)r�r�r�)r#r�rrr� load_long s z_Unpickler.load_longcCs*|�d�d}|�|�}|�t|��dSre)r�r�r�r�rrr� load_long1s z_Unpickler.load_long1cCs>td|�d��\}|dkr"td��|�|�}|�t|��dS)Nr'rrz#LONG pickle has negative byte count)r r�rr�r�r�rrr� load_long4s  z_Unpickler.load_long4cCs|�t|��dd���dS�Nr�)r�r�r�rurrr� load_float!sz_Unpickler.load_floatcCs|�td|�d��d�dS)Nr2r�rr�rurrr� load_binfloat%sz_Unpickler.load_binfloatcCs"|jdkr|S|�|j|j�SdS)Nr9)r�r�r�r"rrr�_decode_string)s z_Unpickler._decode_stringcCsl|��dd�}t|�dkrF|d|dkrF|ddvrF|dd�}ntd��|�|�t�|�d��dS)Nr�r�rs"'r�z)the STRING opcode argument must be quoted)r�rrr�r�r:� escape_decoder�rrr� load_string2s (z_Unpickler.load_stringcCs@td|�d��\}|dkr"td��|�|�}|�|�|��dS)Nr'rrz(BINSTRING pickle has negative byte count)r r�rr�r��r#rr�rrr�load_binstring<s  z_Unpickler.load_binstringcCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nr�rz2BINBYTES exceeds system's maximum size of %d bytes�r r�r rr��r#rrrr� load_binbytesEs �z_Unpickler.load_binbytescCs |�t|��dd�d��dS)Nr�rT)r�r�r�rurrr� load_unicodeMsz_Unpickler.load_unicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nr�rz4BINUNICODE exceeds system's maximum size of %d bytesrMrN�r r�r rr�r�r�rrr�load_binunicodeQs �z_Unpickler.load_binunicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nr|r�z5BINUNICODE8 exceeds system's maximum size of %d bytesrMrNr�r�rrr�load_binunicode8Ys �z_Unpickler.load_binunicode8cCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nr|r�z3BINBYTES8 exceeds system's maximum size of %d bytesr�r�rrr�load_binbytes8as �z_Unpickler.load_binbytes8cCsFtd|�d��\}|tkr&tdt��t|�}|�|�|�|�dS)Nr|r�z4BYTEARRAY8 exceeds system's maximum size of %d bytes)r r�r rr@r�r�)r#r�brrr�load_bytearray8is� z_Unpickler.load_bytearray8cCsJ|jdurtd��zt|j�}Wnty:td��Yn0|�|�dS)NzLpickle stream refers to out-of-band data but no *buffers* argument was givenznot enough out-of-band buffers)r�r�next� StopIterationr�)r#r�rrr�load_next_bufferss  z_Unpickler.load_next_buffercCsJ|jd}t|��$}|js(|��|jd<Wd�n1s<0YdSr�)r�� memoryviewrF� toreadonly)r#r�rJrrr�load_readonly_buffer~s  z_Unpickler.load_readonly_buffercCs,|�d�d}|�|�}|�|�|��dSre)r�r�r�r�rrr�load_short_binstring�s z_Unpickler.load_short_binstringcCs"|�d�d}|�|�|��dSre)r�r�r�rrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|�d�d}|�t|�|�dd��dS)Nr�rrMrN)r�r�r�r�rrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|��}|�t|��dSr )r�r�r�r�rrr� load_tuple�sz_Unpickler.load_tuplecCs|�d�dS)Nrr�rurrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dSr��r�rurrr� load_tuple1�sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�r�rurrr� load_tuple2�sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)N�����r�r�r�rurrr� load_tuple3�sz_Unpickler.load_tuple3cCs|�g�dSr r�rurrr�load_empty_list�sz_Unpickler.load_empty_listcCs|�i�dSr r�rurrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|�t��dSr )r�rururrr�load_empty_set�sz_Unpickler.load_empty_setcCs|��}|�t|��dSr )r�r�r{r�rrr�load_frozenset�sz_Unpickler.load_frozensetcCs|��}|�|�dSr )r�r�r�rrr� load_list�sz_Unpickler.load_listcs4|����fdd�tdt��d�D�}|�|�dS)Ncsi|]}�|�|d�qS)r�r)rlr��r�rr� �s�z(_Unpickler.load_dict..rr�)r��rangerr�)r#�drr�r� load_dict�s  �z_Unpickler.load_dictc Cs�|st|t�rt|d�rlz ||�}Wqvtyh}z,td|jt|�ft��d��WYd}~qvd}~00n |�|�}|� |�dS)N�__getinitargs__zin constructor for %s: %sr�) r�r�r�r�rr�r��exc_infor r�)r#�klassrr!�errrrr� _instantiate�s�  � � z_Unpickler._instantiatecCsL|��dd��d�}|��dd��d�}|�||�}|�||���dS)Nr�r�)r�r�� find_classr�r��r#r�r�r�rrr� load_inst�s z_Unpickler.load_instcCs"|��}|�d�}|�||�dSr�)r�r�r�)r#rrrrr�load_obj�s z_Unpickler.load_objcCs4|j��}|j��}|j|g|�R�}|�|�dSr �r�r�r r�)r#rrr�rrr� load_newobj�s  z_Unpickler.load_newobjcCsD|j��}|j��}|j��}|j|g|�Ri|��}|�|�dSr r�)r#rrrr�rrr�load_newobj_ex�s    z_Unpickler.load_newobj_excCsF|��dd��d�}|��dd��d�}|�||�}|�|�dS)Nr�rM)r�r�r�r�r�rrr� load_global�s z_Unpickler.load_globalcCsJ|j��}|j��}t|�tus,t|�tur4td��|�|�||��dS)NzSTACK_GLOBAL requires str)r�r�r�r�rr�r�)r#r�r�rrr�load_stack_global�s   z_Unpickler.load_stack_globalcCs|�d�d}|�|�dSre)r�� get_extension�r#r�rrr� load_ext1sz_Unpickler.load_ext1cCs td|�d��\}|�|�dS)Nr&r��r r�r�r�rrr� load_ext2 sz_Unpickler.load_ext2cCs td|�d��\}|�|�dS)Nr'rr�r�rrr� load_ext4sz_Unpickler.load_ext4cCspg}t�||�}||ur&|�|�dSt�|�}|sP|dkrDtd��td|��|j|�}|t|<|�|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�r�rrr�r�)r#r��nilr�r�rrrr�s     z_Unpickler.get_extensioncCs�t�d||�|jdkrT|jrT||ftjvr@tj||f\}}n|tjvrTtj|}t|dd�|jdkr~ttj ||�dSt tj ||�SdS)Nzpickle.find_classr�rr~r) r��auditr�r�r�� NAME_MAPPING�IMPORT_MAPPINGr�r�r�r�)r#r�r�rrrr�#s    z_Unpickler.find_classcCs&|j}|��}|d}||�|d<dSr��r�r�)r#r�rrrrr� load_reduce1sz_Unpickler.load_reducecCs|jr|jd=n|��dSr�)r�r�rurrr�load_pop8s z_Unpickler.load_popcCs |��dSr )r�rurrr� load_pop_mark?sz_Unpickler.load_pop_markcCs|�|jd�dSr�)r�r�rurrr�load_dupCsz_Unpickler.load_dupcCsTt|��dd��}z|�|j|�Wn&tyNd|��}t|�d�Yn0dS)Nr��Memo value not found at index )r�r�r�r�r�r)r#r��msgrrr�load_getGs   z_Unpickler.load_getc Cs`|�d�d}z|�|j|�Wn8tyZ}z d|��}t|�d�WYd}~n d}~00dS)Nr�rr)r�r�r�r�r�r#r��excr rrr� load_bingetPs  z_Unpickler.load_bingetc Csdtd|�d��\}z|�|j|�Wn8ty^}z d|��}t|�d�WYd}~n d}~00dS)Nr�rr)r r�r�r�r�rr rrr�load_long_bingetYs  z_Unpickler.load_long_bingetcCs8t|��dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argument)r�r�r�r�r�r�rrr�load_putbsz_Unpickler.load_putcCs2|�d�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)r�r�r�r�r�rrr� load_binputisz_Unpickler.load_binputcCs6td|�d��\}|tkr"td��|jd|j|<dS)Nr�rznegative LONG_BINPUT argumentr�)r r�r r�r�r�r�rrr�load_long_binputpsz_Unpickler.load_long_binputcCs|j}|jd|t|�<dSr�)r�r�r)r#r�rrr� load_memoizewsz_Unpickler.load_memoizecCs$|j}|��}|d}|�|�dSr�)r�r�r�)r#r�r!rhrrr� load_append|sz_Unpickler.load_appendcCsX|��}|jd}z |j}Wnty.Yn0||�dS|j}|D] }||�qFdSr�)r�r��extendr�r�)r#r��list_objrr�ryrrr� load_appends�s   z_Unpickler.load_appendscCs*|j}|��}|��}|d}|||<dSr�r)r#r�r!r�r�rrr� load_setitem�s z_Unpickler.load_setitemcCs@|��}|jd}tdt|�d�D]}||d|||<q"dS)Nr�rr�r�)r�r�r�r)r#r�r�r�rrr� load_setitems�s z_Unpickler.load_setitemscCsD|��}|jd}t|t�r(|�|�n|j}|D] }||�q2dSr�)r�r�r�ru�update�add)r#r��set_objrryrrr� load_additems�s   z_Unpickler.load_additemsc Cs�|j}|��}|d}t|dd�}|dur6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}|� �D]*\}} t |�t ur�| |||�<qp| ||<qp|r�|� �D]\}} t ||| �q�dS)Nr�� __setstate__r�) r�r�r�r�r�r�__dict__r��internr�r�r��setattr) r#r�r�inst�setstate� slotstate� inst_dictrrrrsrrr� load_build�s(   z_Unpickler.load_buildcCs"|j�|j�g|_|jj|_dSr )r�r�r�rurrr� load_mark�sz_Unpickler.load_markcCs|j��}t|��dSr )r�r�rr"rrr� load_stop�s z_Unpickler.load_stop)�rrrr$rr�r�r�r�r�r�r�r�rr�rr�rr�r!r�r r�r-r�r*r�r(r�r)r�r.r�r+r�r,r�r4r�r3r�r��STRINGr�� BINSTRINGr�r=r�rYr�rWr�rVr�r<r�rAr�rHr�rIr��SHORT_BINSTRINGr�r;r�rUr�r]r�r[r��TUPLE1r�rr��TUPLE3r�rbr�rmr�rvr�r|r�rcr�rnr�r��INSTr��OBJr�rr�r r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr_r�DUPr r�r r�rr�rr�rr�rr�rr�rrfrrjrrprrqrrwr%rr&r\r'r�rrrrr�ps&� 0                                                                     r�r�cCst||||d��|�dS�Nr�)r�r)r�r�r�r�r�rrr�_dump�s ��r1cCs*t��}t||||d��|�|��}|Sr0)rsrtr�r�getvalue)r�r�r�r�r��resrrr�_dumps�s��r4r�r�r�cCst|||||d���S)N�r�r�r�r�)r�r)r�r�r�r�r�rrr�_load�s�r6cCs2t|t�rtd��t�|�}t|||||d���S)Nz%Can't load pickle from unicode stringr5)r�r�r�rsrtr�r)�sr�r�r�r�r�rrr�_loads�s   �r8cCsddl}|��Sr�)�doctest�testmod)r9rrr�_testsr;r�z$display contents of the pickle files)� description� pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test� store_truezrun self-test suite)�actionrAz-vz)run verbosely; only affects self-test run)N)N)��typesr�copyregrrrr� itertoolsr� functoolsrr�r �structr r rjrsr:r��__all__�_picklerr�r�r�r9r@� bytes_types�format_version�compatible_formatsr�r�� Exceptionr r rrZorg.python.corer%r\r�rr_r/r4r-r*r(r.r)rrrrr(r)r*rYrWrfrr�rnrmrjr�r�r-r�rcrbr.r�r�r�rpr]r[rqr3r"r#r�rr�r�r�r+rr,r r!r+r,r^r=r;rUrVr<rvrwr|r r�r�r�rArHrIr�dirrpr�r�r�r�r�r�r�r1r4r6r8rrrrrrr;r�argparse�ArgumentParser�parser� add_argument�FileType� parse_argsr�testr=� print_helpZpprintr�r�rrrr�s@             ?; ^i� � 0   � ���