Your IP : 18.118.151.112


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/pickle.cpython-35.opt-2.pyc



���]p��@s�ddlmZddlmZddlmZmZmZddlmZddl	Z	ddl	m
Z
ddlmZm
Z
ddlZddlZddlZddlZdd	d
ddd
dddg	ZeefZdZdddddddgZdZdZGdd�de�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de�Zyddlm Z Wne!k
r�dZ YnXd Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXeHeReSeTgZYdWZZdXZ[dYZ\dZZ]d[Z^d\Z_d]Z`d^Zad_Zbd`ZcdaZddbZeejfdcdd�eg�D��Gdedf�df�ZhGdgdh�dh�Zididj�Zjdkdl�Zkdmdn�Zldodp�ZmGdqdr�dr�ZnGdsdt�dt�Zoddudvdwdx�Zpddudvdydz�Zqdudvd{d|d}d~dd��Zrdudvd{d|d}d~d�d��ZsyDdd�ltmZmZmZmuZumvZvmwZwmxZxmyZymzZzWnBe!k
r�eneof\ZuZvepeqeresf\ZwZxZyZzYnXd�d��Z{e|d�kr�ddl}Z}e}j~d�d��Zej�d�d�e}j�d��d�d�d�d��ej�d�d�d�d�d�d��ej�d�d�d�d�d��ej��Z�e�j�rme{�nPe�j�r�ej��n9ddl�Z�x*e�j�D]Z�eye��Z�e�j�e��q�WdS)��)�FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�isliceN)�maxsize)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loadsz4.0z1.0z1.1z1.2z1.3z2.0z3.0��c@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�+/opt/alt/python35/lib64/python3.5/pickle.pyr?sc@seZdZdS)rN)rrrrrrrrCsc@seZdZdS)r
N)rrrrrrrr
Js	c@seZdZdd�ZdS)�_StopcCs
||_dS)N)�value)�selfrrrr�__init__Xsz_Stop.__init__N)rrrrrrrrrWsr)�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
s�s�s�s�s�s�s�s�s�s�s�s��B�Cs�s�s�s�s�s�s�s�s�s�cCs(g|]}tjd|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr�
<listcomp>�s	rOc@sUeZdZdZdd�Zdd�Zdd�Zd	d
d�Zdd
�ZdS)�_Framer�@icCs||_d|_dS)N)�
file_write�
current_frame)rrRrrrr�s	z_Framer.__init__cCstj�|_dS)N)�io�BytesIOrS)rrrr�
start_framing�sz_Framer.start_framingcCs;|jr7|jj�dkr7|jdd�d|_dS)Nr�forceT)rS�tell�commit_frame)rrrr�end_framing�sz_Framer.end_framingFcCs�|jr�|j}|j�|jks-|r�|j��C}t|�}|j}|t�|td|��||�WdQRX|jd�|j	�dS)Nz<Qr)
rSrX�_FRAME_SIZE_TARGET�	getbuffer�lenrR�FRAMEr	�seek�truncate)rrW�f�data�n�writerrrrY�s			

z_Framer.commit_framecCs*|jr|jj|�S|j|�SdS)N)rSrdrR)rrbrrrrd�s	z
_Framer.writeNi)	rrrr[rrVrZrYrdrrrrrP�s
rPc@sCeZdZddd�Zdd�Zdd�Zdd	�ZdS)
�	_UnframerNcCs||_||_d|_dS)N)�	file_read�
file_readlinerS)rrfrg�	file_tellrrrr�s		z_Unframer.__init__cCsw|jrf|jj|�}|rD|dkrDd|_|j|�St|�|krbtd��|S|j|�SdS)Nrz$pickle exhausted before end of frame)rS�readrfr]r
)rrcrbrrrri�s		
	z_Unframer.readcCs_|jrQ|jj�}|s1d|_|j�S|ddkrMtd��|S|j�SdS)N�s
rz$pickle exhausted before end of frame����
)rS�readlinergr
)rrbrrrrm�s		
	z_Unframer.readlinecCsI|jr*|jj�dkr*td��tj|j|��|_dS)N�z4beginning of a new frame before end of current frame)rSrir
rTrUrf)r�
frame_sizerrr�
load_frame�s	z_Unframer.load_frame)rrrrrirmrprrrrre�s

recCs�x�|jd�D]p}|dkr:tdj||���y|}t||�}Wqtk
rtdj||���YqXqW||fS)N�.z<locals>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�
_getattributes	
	rzcCs�t|dd�}|dk	r"|Sxtttjj��D]]\}}|dks8|dkr_q8y!t||�d|kr|SWq8tk
r�Yq8Xq8WdS)Nr�__main__r)ru�list�sys�modules�itemsrzrs)rvrw�module_name�modulerrr�whichmodules"
	r�cCs�|dkrdS|j�d?d}|j|dddd�}|dkr�|dkr�|dd	kr�|d
d@dkr�|dd�}|S)Nrrnrrj�	byteorder�little�signedT���rk���rk)�
bit_length�to_bytes)rN�nbytes�resultrrr�encode_long#s$r�cCstj|dddd�S)Nr�r�r�T)�int�
from_bytes)rbrrr�decode_longAsr�c@seZdZddddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zddd�Z	dd�Z
dd�Zdddddd�ZiZ
dd�Zee
ed�<dd�Zee
e<dd�Zee
e<dd�Zee
e<d d!�Zee
e<d"d#�Zee
e<d$d%�Zee
e<d&d'�Zee
e<d(Zd)d*�Zd+d,�Z e e
e!<e"dk	r�e e
e"<d-d.�Z#d/d0�Z$e$e
e%<d1d2�Z&e&e
e'<dd3d4�Z(d5d6�Z)e(e
e*<e)e
e<dS)7�_PicklerN�fix_importsTcCs�|dkrt}|dkr't}n,d|ko>tknsStdt��y|j|_Wntk
r�td��YnXt|j�|_|jj|_i|_	t
|�|_|dk|_d|_
|o�|dk|_dS)Nrzpickle protocol must be <= %dz"file must have a 'write' attributerjr)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueErrorrd�_file_writers�	TypeErrorrP�framer�memor��proto�bin�fastr�)r�file�protocolr�rrrrZs"	
		z_Pickler.__init__cCs|jj�dS)N)r��clear)rrrr�
clear_memo�sz_Pickler.clear_memocCs�t|d�s(td|jjf��|jdkrT|jttd|j��|jdkrp|jj	�|j
|�|jt�|jj�dS)Nr�z2Pickler.__init__() was not called by %s.__init__()r�z<Br)
�hasattrr�	__class__rr�rd�PROTOr	r�rV�save�STOPrZ)rrvrrrr�s


z
_Pickler.dumpcCsO|jr
dSt|j�}|j|j|��||f|jt|�<dS)N)r�r]r�rd�put�id)rrv�idxrrr�memoize�s
	z_Pickler.memoizecCsl|jdkrtS|jrM|dkr9ttd|�Sttd|�Sntt|�jd�dSdS)Nr�z<Bz<I�asciis
)	r��MEMOIZEr��BINPUTr	�LONG_BINPUT�PUT�repr�encode)rr�rrrr��s	z_Pickler.putcCsR|jr7|dkr&ttd|�Sttd|�Stt|�jd�dS)Nr�z<Bz<Ir�s
)r��BINGETr	�LONG_BINGET�GETr�r�)r�irrr�get�s
	z_Pickler.getcCs;|jj�|j|�}|dk	r?|r?|j|�dS|jjt|��}|dk	r�|j|j|d��dSt|�}|j	j|�}|dk	r�|||�dSt
|dt�j|�}|dk	r�||�}n�yt|t�}	Wnt
k
rd}	YnX|	r7|j|�dSt
|dd�}|dk	rg||j�}nCt
|dd�}|dk	r�|�}ntd|j|f��t|t�r�|j||�dSt|t�s�td|��t|�}
d|
kod	kns$td
|��|j|d|�dS)NrrF�
__reduce_ex__�
__reduce__zCan't pickle %r object: %rz%s must return string or tupler��z3Tuple returned by %s must have two to five elementsrv)r�rY�
persistent_id�	save_persr�r�r�rd�type�dispatchrur�
issubclassr��save_globalr�rr�
isinstance�str�tupler]�save_reduce)rrv�save_persistent_id�pidrN�tra�reduce�rv�issc�lrrrr��sT





z
_Pickler.savecCsdS)Nr)rrvrrrr�
sz_Pickler.persistent_idcCsy|jr,|j|dd�|jt�nIy(|jtt|�jd�d�Wntk
rttd��YnXdS)Nr�Fr�s
z2persistent IDs in protocol 0 must be ASCII strings)	r�r�rd�	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr)rr�rrrr�s	(
z_Pickler.save_perscCset|t�std��t|�s3td��|j}|j}t|dd�}	|jdkr|	dkr|\}
}}t|
d�s�tdj	|	���|dk	r�|
|j
k	r�td	j	|	���||
�||�||�|t�n�|jd
kr�|	dkr�|d}
t|
d�s@td
��|dk	rg|
|j
k	rgtd��|dd�}||
�||�|t�n||�||�|t
�|dk	rt|�|jkr|t|j|jt|�d��n
|j|�|dk	r(|j|�|dk	rA|j|�|dk	ra||�|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 classr��
__newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classrj)r�r�r�callabler�rdrur�r�rtr��	NEWOBJ_EX�NEWOBJ�REDUCEr�r��POPr�r��_batch_appends�_batch_setitems�BUILD)r�func�args�state�	listitems�	dictitemsrvr�rd�	func_name�cls�kwargsrrrr�sZ				




		





+



z_Pickler.save_reducecCs|jt�dS)N)rd�NONE)rrvrrr�	save_nonezsz_Pickler.save_nonecCsH|jdkr+|j|r!tnt�n|j|r=tnt�dS)Nr�)r�rd�NEWTRUE�NEWFALSE�TRUE�FALSE)rrvrrr�	save_bool~sz_Pickler.save_boolcCsA|jr�|dkri|dkr?|jttd|��dS|dkri|jttd|��dSd
|ko�dknr�|jttd|��dS|jd	krt|�}t|�}|d
kr�|jt	td|�|�n|jt
td|�|�dS|jtt|�j
d�d�dS)Nrr�z<Bi��z<Hli���z<ir�r�r�sL
i�)r�rd�BININT1r	�BININT2�BININTr�r�r]�LONG1�LONG4�LONGr�r�)rrv�encodedrcrrr�	save_long�s&	!z_Pickler.save_longcCsN|jr&|jttd|��n$|jtt|�jd�d�dS)Nz>dr�s
)r�rd�BINFLOATr	�FLOATr�r�)rrvrrr�
save_float�s	z_Pickler.save_floatcCs�|jdkrZ|s.|jtfd|�n(|jtjt|d�dfd|�dSt|�}|dkr�|jtt	d|�|�nZ|dkr�|jdkr�|jt
t	d|�|�n|jtt	d	|�|�|j|�dS)
Nrrv�latin1r�z<Bl��rz<Qz<I)
r�r��bytes�codecsr�r�r]rd�SHORT_BINBYTESr	�	BINBYTES8�BINBYTESr�)rrvrcrrr�
save_bytes�s!!z_Pickler.save_bytescCs|jr�|jdd�}t|�}|dkrc|jdkrc|jttd|�|�q|dkr�|jdkr�|jttd|�|�q|jttd|�|�nB|j	d	d
�}|j	dd�}|jt
|jd
�d�|j|�dS)Nzutf-8�
surrogatepassr�rz<Bl��z<Qz<I�\z\u005c�
z\u000azraw-unicode-escapes
)r�r�r]r�rd�SHORT_BINUNICODEr	�BINUNICODE8�
BINUNICODE�replace�UNICODEr�)rrvr�rcrrr�save_str�s	!!!z_Pickler.save_strcCs�|s4|jr|jt�n|jtt�dSt|�}|j}|j}|dkr�|jdkr�x|D]}||�qtWt	|�|kr�|j
|t	|�d�}|jt||�n|jt|�|j
|�dS|j}|t�x|D]}||�qWt	|�|kr�|j
|t	|�d�}|jrh|t|�n|t|d|�dS|t�|j
|�dS)Nrr�rrj)r�rd�EMPTY_TUPLE�MARK�TUPLEr]r�r�r�r�r�r��_tuplesize2coder��POP_MARK)rrvrcr�r��elementr�rdrrr�
save_tuple�s:			

	

	
z_Pickler.save_tuplecCsH|jr|jt�n|jtt�|j|�|j|�dS)N)r�rd�
EMPTY_LISTr�LISTr�r�)rrvrrr�	save_list�s
	
z_Pickler.save_listi�cCs�|j}|j}|jsDx"|D]}||�|t�q"WdSt|�}x�tt||j��}t|�}|dkr�|t	�x|D]}||�q�W|t
�n|r�||d�|t�||jkrSdSqSWdS)Nrjr)r�rdr��APPEND�iterr|r�
_BATCHSIZEr]r�APPENDS)rrr�rdrN�it�tmprcrrrr�s*			





z_Pickler._batch_appendscCsN|jr|jt�n|jtt�|j|�|j|j��dS)N)r�rd�
EMPTY_DICTr�DICTr�r�r)rrvrrr�	save_dict's
	
z_Pickler.save_dictc	Cs$|j}|j}|jsTx2|D]*\}}||�||�|t�q"WdSt|�}x�tt||j��}t|�}|dkr�|t	�x(|D] \}}||�||�q�W|t
�n4|r	|d\}}||�||�|t�||jkrcdSqcWdS)Nrjr)r�rdr��SETITEMrr|rrr]r�SETITEMS)	rrr�rd�k�vrrrcrrrr�4s2			







z_Pickler._batch_setitemscCs�|j}|j}|jdkrD|jtt|�fd|�dS|t�|j|�t|�}xvtt	||j
��}t|�}|dkr�|t�x|D]}||�q�W|t
�||j
krjdSqjWdS)Nrrvr)r�rdr�r��setr|�	EMPTY_SETr�rrrr]r�ADDITEMS)rrvr�rdr�batchrc�itemrrr�save_setSs$		




z_Pickler.save_setcCs�|j}|j}|jdkrD|jtt|�fd|�dS|t�x|D]}||�qUWt|�|jkr�|t	|j
|jt|�d��dS|t�|j|�dS)Nrrvr)
r�rdr�r��	frozensetr|rr�r�r	r��	FROZENSETr�)rrvr�rdr rrr�save_frozensetks		

(
z_Pickler.save_frozensetc
Cs|j}|j}|dkr0t|dd�}|dkrE|j}t||�}y6t|dd�tj|}t||�\}}Wn4t	t
tfk
r�td|||f��Yn&X||k	r�td|||f��|j
dkrwtj||f�}	|	rw|	dkr6|ttd|	��n=|	d	kr\|ttd
|	��n|ttd|	��dS|jd�d}
||kr�|
}|j
d
kr�|j|�|j|�|t�n ||k	r�|jt||
f�n�|j
dkr5|tt|d�dt|d�d�n�|jr�tj}tj}||f|kr{|||f\}}n||kr�||}y0|tt|d�dt|d�d�Wn.tk
r�td|||j
f��YnX|j|�dS)Nr�levelrz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%sr�r�z<Bi��z<Hz<irqrrzutf-8s
r�z?can't pickle global identifier '%s.%s' using pickle protocol %i) rdr�rurr��
__import__r}r~rz�ImportError�KeyErrorrsrr�rr��EXT1r	�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALr�r��_compat_pickle�REVERSE_NAME_MAPPING�REVERSE_IMPORT_MAPPINGr�r�)
rrvrwrdr�r�r��obj2ry�code�lastname�r_name_mapping�r_import_mappingrrrr��sn			



,			
-
z_Pickler.save_globalcCs�|td�kr(|jtdd|�S|tt�krS|jttfd|�S|td�kr{|jtdd|�S|j|�S)Nrv.)N).)r�r��NotImplementedr�)rrvrrr�	save_type�sz_Pickler.save_type)+rrrrr�rr�r�r�r�r�r�r�r�r�r�r��boolr�r�r��floatr�r�rr�rr�rr|rr�r�dictrr�r!rr$r"r�r8rrrrrr�XsV)
	B]




1
	
	



B	
r�c@s"eZdZdddddddd�Zd	d
�Zdd�Zd
d�ZiZdd�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<d d!�Zeeed<d"d#�Zeeed<d$d%�Zeeed<d&d'�Zeeed<d(d)�Z e ee!d<d*d+�Z"e"ee#d<d,d-�Z$e$ee%d<d.d/�Z&e&ee'd<d0d1�Z(d2d3�Z)e)ee*d<d4d5�Z+e+ee,d<d6d7�Z-e-ee.d<d8d9�Z/e/ee0d<d:d;�Z1e1ee2d<d<d=�Z3e3ee4d<d>d?�Z5e5ee6d<d@dA�Z7e7ee8d<dBdC�Z9e9ee:d<dDdE�Z;e;ee<d<dFdG�Z=e=ee>d<dHdI�Z?e?ee@d<dJdK�ZAeAeeBd<dLdM�ZCeCeeDd<dNdO�ZEeEeeFd<dPdQ�ZGeGeeHd<dRdS�ZIeIeeJd<dTdU�ZKeKeeLd<dVdW�ZMeMeeNd<dXdY�ZOeOeePd<dZd[�ZQeQeeRd<d\d]�ZSd^d_�ZTeTeeUd<d`da�ZVeVeeWd<dbdc�ZXeXeeYd<ddde�ZZeZee[d<dfdg�Z\e\ee]d<dhdi�Z^e^ee_d<djdk�Z`e`eead<dldm�Zbebeecd<dndo�Zdedeeed<dpdq�Zfdrds�Zgdtdu�Zheheeid<dvdw�Zjejeekd<dxdy�Zleleemd<dzd{�Zneneeod<d|d}�Zpepeeqd<d~d�Zrereesd<d�d��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�S)��
_Unpicklerr�T�encoding�ASCII�errors�strictcCsI|j|_|j|_i|_||_||_d|_||_dS)Nr)	rm�_file_readlineri�
_file_readr�r=r?r�r�)rr�r�r=r?rrrr�s				z_Unpickler.__init__cCst|d�s(td|jjf��t|j|j�|_|jj|_|jj	|_	t
�|_g|_|jj
|_
d|_|j}|j}y5x.|d�}|s�t�||d|�q�WWn,tk
r}z|jSWYdd}~XnXdS)NrBz4Unpickler.__init__() was not called by %s.__init__()rrj)r�r
r�rrerBrA�	_unframerrirm�object�mark�stack�appendr�r��EOFErrorrr)rrir��key�stopinstrrrr�s(				z_Unpickler.loadcCsG|j}|j}t|�d}x|||k	rB|d}q%W|S)Nrj)rFrEr])rrFrErrrr�markers		z_Unpickler.markercCstd��dS)Nz%unsupported persistent id encountered)r
)rr�rrr�persistent_load&sz_Unpickler.persistent_loadcCsL|jd�d}d|ko*tkns?td|��||_dS)Nrjrzunsupported pickle protocol: %d)rir�r�r�)rr�rrr�
load_proto+sz_Unpickler.load_protorcCsNtd|jd��\}|tjkr:td|��|jj|�dS)Nz<Q�zframe size > sys.maxsize: %d)r
rir}rr�rCrp)rrorrrrp2sz_Unpickler.load_framecCs^y#|j�dd�jd�}Wntk
rCtd��YnX|j|j|��dS)Nrjr�z2persistent IDs in protocol 0 must be ASCII stringsrk)rm�decode�UnicodeDecodeErrorr
rGrL)rr�rrr�load_persid9s#
z_Unpickler.load_persidcCs)|jj�}|j|j|��dS)N)rF�poprGrL)rr�rrr�load_binpersidBsz_Unpickler.load_binpersidcCs|jd�dS)N)rG)rrrr�	load_noneGsz_Unpickler.load_nonecCs|jd�dS)NF)rG)rrrr�
load_falseKsz_Unpickler.load_falsecCs|jd�dS)NT)rG)rrrr�	load_trueOsz_Unpickler.load_truecCsj|j�}|tdd�kr+d}n.|tdd�krJd}nt|d�}|j|�dS)NrjFTr)rmr�r�r�rG)rrb�valrrr�load_intSs		z_Unpickler.load_intcCs'|jtd|jd��d�dS)Nz<irr)rGr
ri)rrrr�load_binint^sz_Unpickler.load_binintcCs|j|jd�d�dS)Nrjr)rGri)rrrr�load_binint1bsz_Unpickler.load_binint1cCs'|jtd|jd��d�dS)Nz<Hr�r)rGr
ri)rrrr�load_binint2fsz_Unpickler.load_binint2cCsV|j�dd�}|r<|ddkr<|dd�}|jt|d��dS)Nrjr)rrkrk�Lrk)rmrGr�)rrWrrr�	load_longjsz_Unpickler.load_longcCs9|jd�d}|j|�}|jt|��dS)Nrjr)rirGr�)rrcrbrrr�
load_long1qsz_Unpickler.load_long1cCsYtd|jd��\}|dkr3td��|j|�}|jt|��dS)Nz<irrz#LONG pickle has negative byte count)r
rir
rGr�)rrcrbrrr�
load_long4ws
z_Unpickler.load_long4cCs'|jt|j�dd���dS)Nrjrk)rGr:rm)rrrr�
load_float�sz_Unpickler.load_floatcCs'|jtd|jd��d�dS)Nz>drNr)rGr
ri)rrrr�
load_binfloat�sz_Unpickler.load_binfloatcCs-|jdkr|S|j|j|j�SdS)Nr�)r=rOr?)rrrrr�_decode_string�sz_Unpickler._decode_stringcCs�|j�dd�}t|�dkr_|d|dkr_|ddkr_|dd�}ntd��|j|jtj|�d��dS)	Nrjr�rs"'z)the STRING opcode argument must be quotedrkrkrk)rmr]r
rGrbr��
escape_decode)rrbrrr�load_string�s
6z_Unpickler.load_stringcCs\td|jd��\}|dkr3td��|j|�}|j|j|��dS)Nz<irrz(BINSTRING pickle has negative byte count)r
rir
rGrb)rr]rbrrr�load_binstring�s
z_Unpickler.load_binstringcCsQtd|jd��\}|tkr7tdt��|j|j|��dS)Nz<Irz2BINBYTES exceeds system's maximum size of %d bytes)r
rirr
rG)rr]rrr�
load_binbytes�s

z_Unpickler.load_binbytescCs*|jt|j�dd�d��dS)Nrjzraw-unicode-escaperk)rGr�rm)rrrr�load_unicode�sz_Unpickler.load_unicodecCs]td|jd��\}|tkr7tdt��|jt|j|�dd��dS)Nz<Irz4BINUNICODE exceeds system's maximum size of %d byteszutf-8r�)r
rirr
rGr�)rr]rrr�load_binunicode�s

z_Unpickler.load_binunicodecCs]td|jd��\}|tkr7tdt��|jt|j|�dd��dS)Nz<QrNz5BINUNICODE8 exceeds system's maximum size of %d byteszutf-8r�)r
rirr
rGr�)rr]rrr�load_binunicode8�s

z_Unpickler.load_binunicode8cCsQtd|jd��\}|tkr7tdt��|j|j|��dS)Nz<QrNz3BINBYTES8 exceeds system's maximum size of %d bytes)r
rirr
rG)rr]rrr�load_binbytes8�s

z_Unpickler.load_binbytes8cCs<|jd�d}|j|�}|j|j|��dS)Nrjr)rirGrb)rr]rbrrr�load_short_binstring�sz_Unpickler.load_short_binstringcCs-|jd�d}|j|j|��dS)Nrjr)rirG)rr]rrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs9|jd�d}|jt|j|�dd��dS)Nrjrzutf-8r�)rirGr�)rr]rrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs=|j�}t|j|dd��g|j|d�<dS)Nrj)rKr�rF)rrrrr�
load_tuple�sz_Unpickler.load_tuplecCs|jf�dS)N)rG)rrrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dS)Nrjrkrk)rF)rrrr�load_tuple1�sz_Unpickler.load_tuple1cCs.|jd|jdfg|jdd�<dS)Nr�rjr�rkr�)rF)rrrr�load_tuple2�sz_Unpickler.load_tuple2cCs8|jd|jd|jdfg|jdd�<dS)Nrr�rj���r�rkrr)rF)rrrr�load_tuple3�sz_Unpickler.load_tuple3cCs|jg�dS)N)rG)rrrr�load_empty_list�sz_Unpickler.load_empty_listcCs|ji�dS)N)rG)rrrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|jt��dS)N)rGr)rrrr�load_empty_set�sz_Unpickler.load_empty_setcCs=|j�}t|j|dd��g|j|d�<dS)Nrj)rKr"rF)rrrrr�load_frozenset�sz_Unpickler.load_frozensetcCs7|j�}|j|dd�g|j|d�<dS)Nrj)rKrF)rrrrr�	load_list�sz_Unpickler.load_listcsh|j�}|j|dd���fdd�tdt��d�D�}|g|j|d�<dS)Nrjcs%i|]}�|d�|�qS)rjr)rMr�)rrr�
<dictcomp>s	z(_Unpickler.load_dict.<locals>.<dictcomp>rr�)rKrF�ranger])rr�dr)rr�	load_dicts
z_Unpickler.load_dictcCs�t|j|dd��}|j|d�=|sRt|t�sRt|d�r�y||�}Wq�tk
r�}z1td|jt|�ftj	�d��WYdd}~Xq�Xn|j
|�}|j|�dS)Nrj�__getinitargs__zin constructor for %s: %sr�)r�rFr�r�r�r�rr�r}�exc_infor�rG)r�klassrr�r�errrrr�_instantiates<z_Unpickler._instantiatecCsj|j�dd�jd�}|j�dd�jd�}|j||�}|j||j��dS)Nrjr�rkrk)rmrO�
find_classr�rK)rr�rwrrrr�	load_instsz_Unpickler.load_instcCs6|j�}|jj|d�}|j||�dS)Nrj)rKrFrRr�)rrrrrr�load_obj%sz_Unpickler.load_objcCsA|jj�}|jj�}|j||�}|j|�dS)N)rFrRr�rG)rr�r�rvrrr�load_newobj,sz_Unpickler.load_newobjcCsS|jj�}|jj�}|jj�}|j|||�}|j|�dS)N)rFrRr�rG)rr�r�r�rvrrr�load_newobj_ex3s
z_Unpickler.load_newobj_excCsa|j�dd�jd�}|j�dd�jd�}|j||�}|j|�dS)Nrjzutf-8rkrk)rmrOr�rG)rr�rwrrrr�load_global;sz_Unpickler.load_globalcCsk|jj�}|jj�}t|�tk	sBt|�tk	rNtd��|j|j||��dS)NzSTACK_GLOBAL requires str)rFrRr�r�r
rGr�)rrwr�rrr�load_stack_globalBs
$z_Unpickler.load_stack_globalcCs$|jd�d}|j|�dS)Nrjr)ri�
get_extension)rr3rrr�	load_ext1Jsz_Unpickler.load_ext1cCs,td|jd��\}|j|�dS)Nz<Hr�)r
rir�)rr3rrr�	load_ext2Osz_Unpickler.load_ext2cCs,td|jd��\}|j|�dS)Nz<ir)r
rir�)rr3rrr�	load_ext4Tsz_Unpickler.load_ext4cCs�g}tj||�}||k	r5|j|�dStj|�}|sr|dkrbtd��td|��|j|�}|t|<|j|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�rGrr
r�r�)rr3�nilrvrIrrrr�Ys

z_Unpickler.get_extensioncCs�|jdkre|jre||ftjkrItj||f\}}n|tjkretj|}t|dd�|jdkr�ttj||�dSt	tj||�SdS)Nrr%rr)
r�r�r/�NAME_MAPPING�IMPORT_MAPPINGr&rzr}r~ru)rr�rwrrrr�is
z_Unpickler.find_classcCs3|j}|j�}|d}||�|d<dS)Nrjrkrk)rFrR)rrFr�r�rrr�load_reducevs	
z_Unpickler.load_reducecCs|jd=dS)Nrjrk)rF)rrrr�load_pop}sz_Unpickler.load_popcCs |j�}|j|d�=dS)N)rKrF)rrrrr�
load_pop_mark�sz_Unpickler.load_pop_markcCs|j|jd�dS)Nrjrk)rGrF)rrrr�load_dup�sz_Unpickler.load_dupcCs4t|j�dd��}|j|j|�dS)Nrjrk)r�rmrGr�)rr�rrr�load_get�sz_Unpickler.load_getcCs+|jd�d}|j|j|�dS)Nrjr)rirGr�)rr�rrr�load_binget�sz_Unpickler.load_bingetcCs3td|jd��\}|j|j|�dS)Nz<Ir)r
rirGr�)rr�rrr�load_long_binget�sz_Unpickler.load_long_bingetcCsLt|j�dd��}|dkr4td��|jd|j|<dS)Nrjrznegative PUT argumentrkrk)r�rmr�rFr�)rr�rrr�load_put�sz_Unpickler.load_putcCsC|jd�d}|dkr+td��|jd|j|<dS)Nrjrznegative BINPUT argumentrk)rir�rFr�)rr�rrr�load_binput�sz_Unpickler.load_binputcCsKtd|jd��\}|tkr3td��|jd|j|<dS)Nz<Irznegative LONG_BINPUT argumentrjrk)r
rirr�rFr�)rr�rrr�load_long_binput�sz_Unpickler.load_long_binputcCs$|j}|jd|t|�<dS)Nrjrk)r�rFr])rr�rrr�load_memoize�s	z_Unpickler.load_memoizecCs0|j}|j�}|d}|j|�dS)Nrjrk)rFrRrG)rrFrr|rrr�load_append�s	
z_Unpickler.load_appendcCs�|j}|j�}||d}||dd�}t|t�rV|j|�n$|j}x|D]}||�qfW||d�=dS)Nrj)rFrKr�r|�extendrG)rrFrE�list_objrrGr rrr�load_appends�s		
z_Unpickler.load_appendscCs9|j}|j�}|j�}|d}|||<dS)Nrjrk)rFrR)rrFrrIr;rrr�load_setitem�s
	
z_Unpickler.load_setitemcCsq|j}|j�}||d}x:t|dt|�d�D]}||d|||<q@W||d�=dS)Nrjr�)rFrKrzr])rrFrEr;r�rrr�
load_setitems�s	#z_Unpickler.load_setitemscCs�|j}|j�}||d}||dd�}t|t�rV|j|�n$|j}x|D]}||�qfW||d�=dS)Nrj)rFrKr�r�update�add)rrFrE�set_objrr�r rrr�
load_additems�s		
z_Unpickler.load_additemsc
Cs|j}|j�}|d}t|dd�}|dk	rK||�dSd}t|t�r~t|�dkr~|\}}|r�|j}tj}xI|j	�D];\}}	t
|�tkr�|	|||�<q�|	||<q�W|rx*|j	�D]\}}	t|||	�q�WdS)Nrj�__setstate__r�rk)
rFrRrur�r�r]�__dict__r}�internrr�r��setattr)
rrFr��inst�setstate�	slotstate�	inst_dictr�rrrrr�
load_build�s(	

!		z_Unpickler.load_buildcCs|j|j�dS)N)rGrE)rrrr�	load_marksz_Unpickler.load_markcCs|jj�}t|��dS)N)rFrRr)rrrrr�	load_stopsz_Unpickler.load_stopN)�rrrrrrKrLr�rMr�rpr^rQr�rSr�rTr�rUr�rVr�rX�INTrYr�rZr�r[r�r]r�r^r�r_r�r`r�rar�rbrd�STRINGre�	BINSTRINGrfr�rgrrhrrirrjr�rk�SHORT_BINSTRINGrlr�rmr�rnrrorrp�TUPLE1rq�TUPLE2rs�TUPLE3rtrrurrvrrwr#rxr
r|rr�r��INSTr��OBJr�r�r�r�r�r.r�r-r�r)r�r*r�r+r�r�r�r�r�r�r�r	r��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rr�rr�rr�rr�r�r�rr�r�rrrrr<�s	$%		
r<r�TcCs t||d|�j|�dS)Nr�)r�r)rvr�r�r�rrr�_dumpsr�cCs8tj�}t||d|�j|�|j�}|S)Nr�)rTrUr�r�getvalue)rvr�r�ra�resrrr�_dumpssr�r=r>r?r@cCs"t|d|d|d|�j�S)Nr�r=r?)r<r)r�r�r=r?rrr�_loadsr�cCsLt|t�rtd��tj|�}t|d|d|d|�j�S)Nz%Can't load pickle from unicode stringr�r=r?)r�r�r�rTrUr<r)�sr�r=r?r�rrr�_loadss
r�)	rrr
rrrrrrcCsddl}|j�S)Nr)�doctest�testmod)r�rrr�_test3sr�r{�descriptionz$display contents of the pickle files�pickle_filer��br�nargs�*�helpzthe pickle filez-tz--test�action�
store_truezrun self-test suitez-vz)run verbosely; only affects self-test run)��typesr�copyregrrrr�	itertoolsrr}r�structr	r
rKrTr�r/�__all__r��	bytearray�bytes_types�format_version�compatible_formatsr�r��	Exceptionrrr
rZorg.python.corerr'rr�r�r	r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r.rrrr�r�r�r�r
rr�r�r�r�rrrrr�r�r�r�r�r)r*r+r�r�r�r�r�r�r�rr�r�r�rr�rrr#r�r-r�r^r��dirrPrerzr�r�r�r�r<r�r�r�r��_picklerrrrrrr�r�argparse�ArgumentParser�parser�add_argument�FileType�
parse_argsr�Ztestr��
print_help�pprintrarvrrrr�<module>s 	

$*
��}��;D
#		
	




?>