AlkantarClanX12

Your IP : 18.217.224.165


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/pickle.cpython-37.pyc

B

� f���	@sdZddlmZddlmZddlmZmZmZddlm	Z	ddl
mZddlZddlm
Z
dd	lmZmZddlZddlZddlZddlZd
ddd
dddddg	ZeefZdZdddddddgZdZdZGdd
�d
e�ZGdd�de�ZGdd�de�Z Gdd �d e�Z!ydd!l"m#Z#Wne$k
�r2dZ#YnXd"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Z<d:Z=d;Z>d<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJdHZKdIZLdJZMdKZNdLZOdMZPdNZQdOZRdPZSdQZTdRZUdSZVdTZWdUZXdVZYdWZZdXZ[eKeUeVeWgZ\dYZ]dZZ^d[Z_d\Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgddZhe�idedf�ej�D��Gdgdh�dh�ZkGdidj�dj�Zldkdl�Zmdmdn�Zndodp�Zodqdr�ZpGdsdt�dt�ZqGdudv�dv�Zrd�dwdx�dydz�Zsd�dwdx�d{d|�Ztdwd}d~d�d�d��Zudwd}d~d�d�d��Zvy0dd�lwmZmZm Z mxZxmyZymzZzm{Z{m|Z|m}Z}Wn4e$k
�rbeqerZxZyeseteuevf\ZzZ{Z|Z}YnXd�d��Z~ed�k�rddl�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��r�e~�n>e�j��s�e����n,ddl�Z�x"e�j�D]Z�e|e��Z�e���e���q�WdS)�a�Create portable serialized representations of Python objects.

See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.

Classes:

    Pickler
    Unpickler

Functions:

    dump(object, file)
    dumps(object) -> 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)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loadsz4.0z1.0z1.1z1.2z1.3z2.0z3.0��c@seZdZdZdS)rz6A common base class for the other pickling exceptions.N)�__name__�
__module__�__qualname__�__doc__�rr�+/opt/alt/python37/lib64/python3.7/pickle.pyr@sc@seZdZdZdS)r
z]This exception is raised when an unpicklable object is passed to the
    dump() method.

    N)rrrrrrrrr
Dsc@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.

    N)rrrrrrrrrKsc@seZdZdd�ZdS)�_StopcCs
||_dS)N)�value)�selfrrrr�__init__Ysz_Stop.__init__N)rrrr rrrrrXsr)�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�
<listcomp>�srgc@sFeZdZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�Z	dd�Z
dS)�_FramerricCs||_d|_dS)N)�
file_write�
current_frame)rrirrrr �sz_Framer.__init__cCst��|_dS)N)�io�BytesIOrj)rrrr�
start_framing�sz_Framer.start_framingcCs*|jr&|j��dkr&|jdd�d|_dS)NrT)�force)rj�tell�commit_frame)rrrr�end_framing�sz_Framer.end_framingFcCsf|jrb|j}|��|jks|rb|��}|j}t|�|jkrP|ttdt|���||�t	�
�|_dS)Nz<Q)rjro�_FRAME_SIZE_TARGET�	getbufferri�len�_FRAME_SIZE_MIN�FRAMEr
rkrl)rrn�f�data�writerrrrp�sz_Framer.commit_framecCs |jr|j�|�S|�|�SdS)N)rjryri)rrxrrrry�sz
_Framer.writecCs,|j}|jr|jdd�||�||�dS)NT)rn)rirjrp)r�headerZpayloadryrrr�write_large_bytes�s
z_Framer.write_large_bytesN)F)rrrrurrr rmrqrpryr{rrrrrh�s
rhc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�	_UnframerNcCs||_||_d|_dS)N)�	file_read�
file_readlinerj)rr}r~Z	file_tellrrrr �sz_Unframer.__init__cCsT|jrF|j�|�}|s.|dkr.d|_|�|�St|�|krBtd��|S|�|�SdS)Nrz$pickle exhausted before end of frame)rj�readr}rtr)r�nrxrrrr�s
z_Unframer.readcCsF|jr:|j��}|s"d|_|��S|ddkr6td��|S|��SdS)N����
z$pickle exhausted before end of frame)rj�readliner~r)rrxrrrr�s
z_Unframer.readlinecCs2|jr|j��dkrtd��t�|�|��|_dS)N�z4beginning of a new frame before end of current frame)rjrrrkrlr})r�
frame_sizerrr�
load_framesz_Unframer.load_frame)N)rrrr rr�r�rrrrr|�s


r|c	Csnxd|�d�D]V}|dkr(td�||���y|}t||�}Wqtk
r`td�||��d�YqXqW||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�nameZsubpath�parentrrr�
_getattribute!s
r�c	Cszt|dd�}|dk	r|Sx\ttj���D]J\}}|dks(|dkrBq(yt||�d|krZ|SWq(tk
rpYq(Xq(WdS)z$Find the module an object belong to.rN�__main__r)r��list�sys�modules�itemsr�r�)r�r��module_name�modulerrr�whichmodule.s
r�cCsh|dkrdS|��d?d}|j|ddd�}|dkrd|dkrd|dd	krd|d
d@dkrd|dd�}|S)
a�Encode 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'
    >>>
    rr�r��littleT)�	byteorder�signedr������N)�
bit_length�to_bytes)rf�nbytes�resultrrr�encode_long?sr�cCstj|ddd�S)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
    r�T)r�r�)�int�
from_bytes)rxrrr�decode_long]sr�c@sheZdZd7dd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zd8dd�Z	dd�Z
dd�Zd9dd�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	�re e
e"<d-d.�Z#d/d0�Z$e$e
e%<d1d2�Z&e&e
e'<d:d3d4�Z(d5d6�Z)e(e
e*<e)e
e<dS);�_PicklerNT)�fix_importscCs�|dkrt}|dkrt}n"d|kr.tks<ntdt��y|j|_Wntk
rdtd��YnXt|j�|_|jj|_|jj	|_
i|_t|�|_
|dk|_d|_|o�|dk|_dS)a�This takes a binary file for writing a pickle data stream.

        The optional *protocol* argument tells the pickler to use the
        given protocol; supported protocols are 0, 1, 2, 3 and 4.  The
        default protocol is 3; a backward-incompatible protocol designed
        for Python 3.

        Specifying a negative protocol version selects the highest
        protocol version supported.  The higher the protocol used, the
        more recent the version of Python needed to read the pickle
        produced.

        The *file* argument must have a write() method that accepts a
        single bytes argument. It can thus be a file object opened for
        binary writing, an io.BytesIO instance, or any other custom
        object that meets this interface.

        If *fix_imports* is True and *protocol* is less than 3, pickle
        will try to map the new Python 3 names to the old module names
        used in Python 2, so that the pickle data stream is readable
        with Python 2.
        Nrzpickle protocol must be <= %dz"file must have a 'write' attributer�r)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueErrorry�_file_writer��	TypeErrorrh�framerr{�_write_large_bytes�memor��proto�bin�fastr�)r�file�protocolr�rrrr vs$



z_Pickler.__init__cCs|j��dS)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)r��clear)rrrr�
clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|�ttd|j��|jdkrP|j�	�|�
|�|�t�|j��dS)z7Write a pickled representation of obj to the open file.r�z2Pickler.__init__() was not called by %s.__init__()�z<BrN)
�hasattrr
�	__class__rr�ry�PROTOr
r�rm�save�STOPrq)rr�rrrr�s





z
_Pickler.dumpcCsL|jr
dSt|�|jkst�t|j�}|�|�|��||f|jt|�<dS)zStore an object in the memo.N)r��idr��AssertionErrorrtry�put)rr��idxrrr�memoize�s
z_Pickler.memoizecCsT|jdkrtS|jr:|dkr*ttd|�Sttd|�Sntt|��d�dSdS)Nr�z<Bz<I�ascii�
)	r��MEMOIZEr��BINPUTr
�LONG_BINPUT�PUT�repr�encode)rr�rrrr��s
z_Pickler.putcCs@|jr*|dkrttd|�Sttd|�Stt|��d�dS)Nr�z<Bz<Ir�r�)r��BINGETr
�LONG_BINGET�GETr�r�)r�irrr�get�s
z_Pickler.getcCs�|j��|�|�}|dk	r.|r.|�|�dS|j�t|��}|dk	r^|�|�|d��dSt|�}|j	�|�}|dk	r�|||�dSt
|dt��|�}|dk	r�||�}n�yt|t�}	Wnt
k
r�d}	YnX|	r�|�|�dSt
|dd�}|dk	�r||j�}n0t
|dd�}|dk	�r&|�}ntd|j|f��t|t��rT|�||�dSt|t��sltd|��t|�}
d|
k�r�d	k�s�ntd
|��|j|d|i�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 elementsr�)r�rp�
persistent_id�	save_persr�r�r�ry�type�dispatchr�r�
issubclassr��save_globalr�r
r�
isinstance�str�tuplert�save_reduce)rr��save_persistent_id�pidrf�trw�reduce�rvZissc�lrrrr��sT








z
_Pickler.savecCsdS)Nr)rr�rrrr�'sz_Pickler.persistent_idcCsb|jr |j|dd�|�t�n>y |�tt|��d�d�Wntk
r\td��YnXdS)NF)r�r�r�z2persistent IDs in protocol 0 must be ASCII strings)	r�r�ry�	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr
)rr�rrrr�+s z_Pickler.save_perscCst|t�std��t|�s"td��|j}|j}t|dd�}	|jdkr�|	dkr�|\}
}}t|
d�sntd�	|	���|dk	r�|
|j
k	r�td	�	|	���|jd
kr�||
�||�||�|t�n,t|
j
|
f|�|�}||�|d�|t�n�|jdk�r^|	dk�r^|d
}
t|
d��std��|dk	�r8|
|j
k	�r8td��|dd�}||
�||�|t�n||�||�|t�|dk	�r�t|�|jk�r�|t|�|jt|�d
��n
|�|�|dk	�r�|�|�|dk	�r�|�|�|dk	�r�||�|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�ryr�r�r�r�r��	NEWOBJ_EXrr��REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD)r�func�args�stateZ	listitemsZ	dictitemsr�r�ryZ	func_name�cls�kwargsrrrr�7sd







"





z_Pickler.save_reducecCs|�t�dS)N)ry�NONE)rr�rrr�	save_none�sz_Pickler.save_nonecCs4|jdkr|�|rtnt�n|�|r*tnt�dS)Nr�)r�ry�NEWTRUE�NEWFALSE�TRUE�FALSE)rr�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|�tt|��
d�d�n|�tt|��
d�d
�dS)Nrr�z<Bi��z<Hi�i���z<ir�r�r�r�sL
)r�ry�BININT1r
�BININT2�BININTr�r�rt�LONG1�LONG4�INTr�r��LONG)rr��encodedr�rrr�	save_long�s*
z_Pickler.save_longcCs<|jr|�ttd|��n|�tt|��d�d�dS)Nz>dr�r�)r�ry�BINFLOATr
�FLOATr�r�)rr�rrr�
save_float�sz_Pickler.save_floatcCs�|jdkr@|s |jtd|d�n|jtjt|d�df|d�dSt|�}|dkrj|�tt	d|�|�nf|dkr�|jdkr�|�
tt	d	|�|�n<||jj
kr�|�
tt	d
|�|�n|�tt	d
|�|�|�|�dS)Nrr)r��latin1r�z<Bl��rz<Qz<I)r�r��bytes�codecsr�r�rtry�SHORT_BINBYTESr
r��	BINBYTES8r�rr�BINBYTESr�)rr�r�rrr�
save_bytes�s
z_Pickler.save_bytescCs|jr�|�dd�}t|�}|dkrF|jdkrF|�ttd|�|�nf|dkrp|jdkrp|�ttd|�|�n<||j	j
kr�|�ttd|�|�n|�ttd|�|�nT|�d	d
�}|�dd�}|�d
d�}|�dd�}|�dd�}|�t
|�d�d�|�|�dS)Nzutf-8�
surrogatepassr�rz<Bl��z<Qz<I�\z\u005c�z\u0000�
z\u000a�
z\u000d�z\u001azraw-unicode-escaper�)r�r�rtr�ry�SHORT_BINUNICODEr
r��BINUNICODE8r�rr�
BINUNICODE�replace�UNICODEr�)rr�rr�rrr�save_str�s$z_Pickler.save_strcCsB|s(|jr|�t�n|�tt�dSt|�}|j}|j}|dkr�|jdkr�x|D]}||�qTWt	|�|kr�|�
|t	|�d�}|�t||�n|�t|�|�
|�dS|j}|t�x|D]}||�q�Wt	|�|k�r,|�
|t	|�d�}|j�r|t|�n|t|d|�dS|t�|�
|�dS)Nrr�rr�)r�ry�EMPTY_TUPLE�MARK�TUPLErtr�r�r�r�r�r��_tuplesize2coder��POP_MARK)rr�r�r�r�Zelementr�ryrrr�
save_tuple�s:


z_Pickler.save_tuplecCs8|jr|�t�n|�tt�|�|�|�|�dS)N)r�ry�
EMPTY_LISTr�LISTr�r�)rr�rrr�	save_list,s

z_Pickler.save_listi�cCs�|j}|j}|js4x|D]}||�|t�qWdSt|�}xrtt||j��}t|�}|dkr�|t	�x|D]}||�qlW|t
�n|r�||d�|t�||jkr>dSq>WdS)Nr�r)r�ryr��APPEND�iterr�r�
_BATCHSIZErtr�APPENDS)rr�r�ryrf�it�tmpr�rrrr�9s*



z_Pickler._batch_appendscCs<|jr|�t�n|�tt�|�|�|�|���dS)N)r�ry�
EMPTY_DICTr�DICTr�r�r�)rr�rrr�	save_dictTs

z_Pickler.save_dictc	Cs�|j}|j}|js@x(|D] \}}||�||�|t�qWdSt|�}x�tt||j��}t|�}|dkr�|t	�x |D]\}}||�||�qxW|t
�n(|r�|d\}}||�||�|t�||jkrJdSqJWdS)Nr�r)r�ryr��SETITEMr(r�rr)rtr�SETITEMS)	rr�r�ry�k�vr+r,r�rrrr�as2

z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|�|�t|�}xXtt	||j
��}t|�}|dkr�|t�x|D]}||�qzW|t
�||j
krLdSqLWdS)Nr)r�r)r�ryr�r��setr��	EMPTY_SETr�r(rr)rtr�ADDITEMS)rr�r�ryr+Zbatchr��itemrrr�save_set�s$



z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�x|D]}||�q>Wt|�|jkr�|t	|�
|jt|�d��dS|t�|�|�dS)Nr)r�r)
r�ryr�r��	frozensetr�rr�r�r"r��	FROZENSETr�)rr�r�ryr7rrr�save_frozenset�s

 z_Pickler.save_frozensetc

Csd|j}|j}|dkr t|dd�}|dkr.|j}t||�}y(t|dd�tj|}t||�\}}Wn.t	t
tfk
r�td|||f�d�YnX||k	r�td|||f��|j
dk�r&t�||f�}	|	�r&|	dks�t�|	dkr�|ttd|	��n0|	d	k�r|ttd
|	��n|ttd|	��dS|�d�d}
||k�rB|
}|j
d
k�rl|�|�|�|�|t�n�||k	�r�|�t||
f�n�|j
dk�r�|tt|d�dt|d�d�n�|j�rtj}tj}||f|k�r�|||f\}}n||k�r||}y(|tt|d�dt|d�d�Wn,tk
�rTtd|||j
f�d�YnX|� |�dS)Nrr)�levelz(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<ir�rrzutf-8r�r�z?can't pickle global identifier '%s.%s' using pickle protocol %i)!ryr�r�rr��
__import__r�r�r��ImportError�KeyErrorr�r
r�rr�r��EXT1r
�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALrr��_compat_pickleZREVERSE_NAME_MAPPINGZREVERSE_IMPORT_MAPPINGr�r�)
rr�r�ryr�r�r�Zobj2r��codeZlastnameZr_name_mappingZr_import_mappingrrrr��sp







$
&z_Pickler.save_globalcCs`|td�kr|jtd|d�S|tt�kr:|jttf|d�S|td�krV|jtd|d�S|�|�S)N)N)r�.).)r�r��NotImplementedr�)rr�rrr�	save_type�sz_Pickler.save_type)N)T)NNNN)N)+rrrr r�rr�r�r�r�r�r�r�r�r�r�r��boolrr�r
�floatrrrr�r#r�r&r�r)r�r/�dictr!r�r8r4r;r9r�rIrrrrrr�tsV*
	
B
c1		

B	r�c@sneZdZdddd�dd�Zdd�Zd	d
�Zdd�ZiZd
d�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�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<d.d/�Z(d0d1�Z)e)ee*d<d2d3�Z+e+ee,d<d4d5�Z-e-ee.d<d6d7�Z/e/ee0d<d8d9�Z1e1ee2d<d:d;�Z3e3ee4d<d<d=�Z5e5ee6d<d>d?�Z7e7ee8d<d@dA�Z9e9ee:d<dBdC�Z;e;ee<d<dDdE�Z=e=ee>d<dFdG�Z?e?ee@d<dHdI�ZAeAeeBd<dJdK�ZCeCeeDd<dLdM�ZEeEeeFd<dNdO�ZGeGeeHd<dPdQ�ZIeIeeJd<dRdS�ZKeKeeLd<dTdU�ZMeMeeNd<dVdW�ZOeOeePd<dXdY�ZQeQeeRd<dZd[�ZSd\d]�ZTeTeeUd<d^d_�ZVeVeeWd<d`da�ZXeXeeYd<dbdc�ZZeZee[d<ddde�Z\e\ee]d<dfdg�Z^e^ee_d<dhdi�Z`e`eead<djdk�Zbebeecd<dldm�Zdedeeed<dndo�Zfdpdq�Zgdrds�Zheheeid<dtdu�Zjejeekd<dvdw�Zleleemd<dxdy�Zneneeod<dzd{�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)��
_UnpicklerT�ASCII�strict)r��encoding�errorscCs2|j|_|j|_i|_||_||_d|_||_dS)a�This 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.

        Optional keyword 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.
        rN)	r��_file_readliner�
_file_readr�rPrQr�r�)rr�r�rPrQrrrr sz_Unpickler.__init__c
Cs�t|d�std|jjf��t|j|j�|_|jj|_|jj	|_	g|_
g|_|jj|_d|_
|j}|j}y8x2|d�}|s|t�t|t�s�t�||d|�qlWWn$tk
r�}z|jSd}~XYnXdS)z�Read a pickled object representation from the open file.

        Return the reconstituted object hierarchy specified in the file.
        rSz4Unpickler.__init__() was not called by %s.__init__()rr�N)r�rr�rr|rSrR�	_unframerrr��	metastack�stack�appendr�r��EOFErrorr��bytes_typesr�rr)rrr��keyZstopinstrrrr's*



z_Unpickler.loadcCs |j}|j��|_|jj|_|S)N)rVrU�poprW)rr�rrr�pop_markEs
z_Unpickler.pop_markcCstd��dS)Nz%unsupported persistent id encountered)r)rr�rrr�persistent_loadKsz_Unpickler.persistent_loadcCs:|�d�d}d|kr"tks0ntd|��||_dS)Nr�rzunsupported pickle protocol: %d)rr�r�r�)rr�rrr�
load_protoPsz_Unpickler.load_protorcCs8td|�d��\}|tjkr(td|��|j�|�dS)Nz<Q�zframe size > sys.maxsize: %d)rrr�r	r�rTr�)rr�rrrr�Ws
z_Unpickler.load_framecCsLy|��dd��d�}Wntk
r6td��YnX|�|�|��dS)Nr�r�z2persistent IDs in protocol 0 must be ASCII strings)r��decode�UnicodeDecodeErrorrrWr])rr�rrr�load_persid^sz_Unpickler.load_persidcCs|j��}|�|�|��dS)N)rVr[rWr])rr�rrr�load_binpersidgs
z_Unpickler.load_binpersidcCs|�d�dS)N)rW)rrrr�	load_nonelsz_Unpickler.load_nonecCs|�d�dS)NF)rW)rrrr�
load_falsepsz_Unpickler.load_falsecCs|�d�dS)NT)rW)rrrr�	load_truetsz_Unpickler.load_truecCsL|��}|tdd�krd}n |tdd�kr4d}n
t|d�}|�|�dS)Nr�FTr)r�r�r�r�rW)rrx�valrrr�load_intxs
z_Unpickler.load_intcCs|�td|�d��d�dS)Nz<irr)rWrr)rrrr�load_binint�sz_Unpickler.load_binintcCs|�|�d�d�dS)Nr�r)rWr)rrrr�load_binint1�sz_Unpickler.load_binint1cCs|�td|�d��d�dS)Nz<Hr�r)rWrr)rrrr�load_binint2�sz_Unpickler.load_binint2cCs@|��dd�}|r,|ddkr,|dd�}|�t|d��dS)Nr��Lr)r�rWr�)rrgrrr�	load_long�sz_Unpickler.load_longcCs*|�d�d}|�|�}|�t|��dS)Nr�r)rrWr�)rr�rxrrr�
load_long1�s
z_Unpickler.load_long1cCs>td|�d��\}|dkr"td��|�|�}|�t|��dS)Nz<irrz#LONG pickle has negative byte count)rrrrWr�)rr�rxrrr�
load_long4�s

z_Unpickler.load_long4cCs|�t|��dd���dS)Nr�)rWrKr�)rrrr�
load_float�sz_Unpickler.load_floatcCs|�td|�d��d�dS)Nz>dr_r)rWrr)rrrr�
load_binfloat�sz_Unpickler.load_binfloatcCs"|jdkr|S|�|j|j�SdS)Nr)rPr`rQ)rrrrr�_decode_string�s
z_Unpickler._decode_stringcCsl|��dd�}t|�dkrF|d|dkrF|ddkrF|dd�}ntd��|�|�t�|�d��dS)Nr�r�rs"'r�z)the STRING opcode argument must be quoted)r�rtrrWrrr
�
escape_decode)rrxrrr�load_string�s
(z_Unpickler.load_stringcCs@td|�d��\}|dkr"td��|�|�}|�|�|��dS)Nz<irrz(BINSTRING pickle has negative byte count)rrrrWrr)rrtrxrrr�load_binstring�s

z_Unpickler.load_binstringcCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nz<Irz2BINBYTES exceeds system's maximum size of %d bytes)rrr	rrW)rrtrrr�
load_binbytes�s
z_Unpickler.load_binbytescCs |�t|��dd�d��dS)Nr�zraw-unicode-escape)rWr�r�)rrrr�load_unicode�sz_Unpickler.load_unicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nz<Irz4BINUNICODE exceeds system's maximum size of %d byteszutf-8r)rrr	rrWr�)rrtrrr�load_binunicode�s
z_Unpickler.load_binunicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nz<Qr_z5BINUNICODE8 exceeds system's maximum size of %d byteszutf-8r)rrr	rrWr�)rrtrrr�load_binunicode8�s
z_Unpickler.load_binunicode8cCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nz<Qr_z3BINBYTES8 exceeds system's maximum size of %d bytes)rrr	rrW)rrtrrr�load_binbytes8�s
z_Unpickler.load_binbytes8cCs,|�d�d}|�|�}|�|�|��dS)Nr�r)rrWrr)rrtrxrrr�load_short_binstring�s
z_Unpickler.load_short_binstringcCs"|�d�d}|�|�|��dS)Nr�r)rrW)rrtrrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|�d�d}|�t|�|�dd��dS)Nr�rzutf-8r)rrWr�)rrtrrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|��}|�t|��dS)N)r\rWr�)rr�rrr�
load_tuple�sz_Unpickler.load_tuplecCs|�d�dS)Nr)rW)rrrr�load_empty_tuplesz_Unpickler.load_empty_tuplecCs|jdf|jd<dS)Nr�)rV)rrrr�load_tuple1sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�)rV)rrrr�load_tuple2
sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)N���r�r�)rV)rrrr�load_tuple3sz_Unpickler.load_tuple3cCs|�g�dS)N)rW)rrrr�load_empty_listsz_Unpickler.load_empty_listcCs|�i�dS)N)rW)rrrr�load_empty_dictionarysz _Unpickler.load_empty_dictionarycCs|�t��dS)N)rWr4)rrrr�load_empty_setsz_Unpickler.load_empty_setcCs|��}|�t|��dS)N)r\rWr9)rr�rrr�load_frozensetsz_Unpickler.load_frozensetcCs|��}|�|�dS)N)r\rW)rr�rrr�	load_list#sz_Unpickler.load_listcs4|����fdd�tdt��d�D�}|�|�dS)Ncsi|]}�|d�|�qS)r�r)rer�)r�rr�
<dictcomp>*sz(_Unpickler.load_dict.<locals>.<dictcomp>rr�)r\�rangertrW)r�dr)r�r�	load_dict(s
z_Unpickler.load_dictc
Cs�|st|t�rt|d�rjy||�}Wqttk
rf}z$td|jt|�ft��d��Wdd}~XYqtXn
|�|�}|�	|�dS)NZ__getinitargs__zin constructor for %s: %sr�)
r�r�r�r�rr�r��exc_infor�rW)r�klassr�r�errrrr�_instantiate4s
0
z_Unpickler._instantiatecCsL|��dd��d�}|��dd��d�}|�||�}|�||���dS)Nr�r�)r�r`�
find_classr�r\)rr�r�r�rrr�	load_inst@sz_Unpickler.load_instcCs"|��}|�d�}|�||�dS)Nr)r\r[r�)rr�r�rrr�load_objGs
z_Unpickler.load_objcCs2|j��}|j��}|j|f|��}|�|�dS)N)rVr[r�rW)rr�r�r�rrr�load_newobjNs

z_Unpickler.load_newobjcCs>|j��}|j��}|j��}|j|f|�|�}|�|�dS)N)rVr[r�rW)rr�r�r�r�rrr�load_newobj_exUs



z_Unpickler.load_newobj_excCsF|��dd��d�}|��dd��d�}|�||�}|�|�dS)Nr�zutf-8)r�r`r�rW)rr�r�r�rrr�load_global]sz_Unpickler.load_globalcCsJ|j��}|j��}t|�tk	s,t|�tk	r4td��|�|�||��dS)NzSTACK_GLOBAL requires str)rVr[r�r�rrWr�)rr�r�rrr�load_stack_globalds


z_Unpickler.load_stack_globalcCs|�d�d}|�|�dS)Nr�r)r�
get_extension)rrGrrr�	load_ext1lsz_Unpickler.load_ext1cCs td|�d��\}|�|�dS)Nz<Hr�)rrr�)rrGrrr�	load_ext2qsz_Unpickler.load_ext2cCs td|�d��\}|�|�dS)Nz<ir)rrr�)rrGrrr�	load_ext4vsz_Unpickler.load_ext4cCspg}t�||�}||k	r&|�|�dSt�|�}|sP|dkrDtd��td|��|j|�}|t|<|�|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�rWrrr�r�)rrGZnilr�rZrrrr�{s


z_Unpickler.get_extensioncCs�|jdkrF|jrF||ftjkr2tj||f\}}n|tjkrFtj|}t|dd�|jdkrpttj||�dSt	tj||�SdS)Nrr)r<r)
r�r�rFZNAME_MAPPINGZIMPORT_MAPPINGr=r�r�r�r�)rr�r�rrrr��s


z_Unpickler.find_classcCs&|j}|��}|d}||�|d<dS)Nr�)rVr[)rrVr�r�rrr�load_reduce�sz_Unpickler.load_reducecCs|jr|jd=n|��dS)Nr�)rVr\)rrrr�load_pop�s
z_Unpickler.load_popcCs|��dS)N)r\)rrrr�
load_pop_mark�sz_Unpickler.load_pop_markcCs|�|jd�dS)Nr�)rWrV)rrrr�load_dup�sz_Unpickler.load_dupcCs(t|��dd��}|�|j|�dS)Nr�)r�r�rWr�)rr�rrr�load_get�sz_Unpickler.load_getcCs"|�d�d}|�|j|�dS)Nr�r)rrWr�)rr�rrr�load_binget�sz_Unpickler.load_bingetcCs&td|�d��\}|�|j|�dS)Nz<Ir)rrrWr�)rr�rrr�load_long_binget�sz_Unpickler.load_long_bingetcCs8t|��dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argument)r�r�r�rVr�)rr�rrr�load_put�sz_Unpickler.load_putcCs2|�d�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)rr�rVr�)rr�rrr�load_binput�sz_Unpickler.load_binputcCs6td|�d��\}|tkr"td��|jd|j|<dS)Nz<Irznegative LONG_BINPUT argumentr�)rrr	r�rVr�)rr�rrr�load_long_binput�sz_Unpickler.load_long_binputcCs|j}|jd|t|�<dS)Nr�)r�rVrt)rr�rrr�load_memoize�sz_Unpickler.load_memoizecCs$|j}|��}|d}|�|�dS)Nr�)rVr[rW)rrVrr�rrr�load_append�sz_Unpickler.load_appendcCs^|��}|jd}y
|j}Wntk
r0YnX||�dS|j}x|D]}||�qJWdS)Nr�)r\rV�extendr�rW)rr�Zlist_objr�rWr7rrr�load_appends�s


z_Unpickler.load_appendscCs*|j}|��}|��}|d}|||<dS)Nr�)rVr[)rrVrrZrLrrr�load_setitem�s
z_Unpickler.load_setitemcCsD|��}|jd}x,tdt|�d�D]}||d|||<q$WdS)Nr�rr�r�)r\rVr�rt)rr�rLr�rrr�
load_setitems�s
z_Unpickler.load_setitemscCsH|��}|jd}t|t�r(|�|�n|j}x|D]}||�q4WdS)Nr�)r\rVr�r4�update�add)rr�Zset_objr�r7rrr�
load_additems�s


z_Unpickler.load_additemsc
Cs�|j}|��}|d}t|dd�}|dk	r6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}x6|�	�D]*\}}	t
|�tkr�|	|||�<qr|	||<qrW|r�x |�	�D]\}}	t|||	�q�WdS)Nr��__setstate__r�)
rVr[r�r�r�rt�__dict__r��internr�r�r��setattr)
rrVr��inst�setstateZ	slotstateZ	inst_dictr�r2r3rrr�
load_build
s(z_Unpickler.load_buildcCs"|j�|j�g|_|jj|_dS)N)rUrWrV)rrrr�	load_mark"sz_Unpickler.load_markcCs|j��}t|��dS)N)rVr[r)rrrrr�	load_stop(s
z_Unpickler.load_stopN)�rrrr rr\r]r�r^r�r�rvrbr�rcr�rdr�rer�rfr�rhrrirrjr�rkrrmrrnrrorrpr	rqrrrrt�STRINGru�	BINSTRINGrvrrwrrxrryrrzrr{�SHORT_BINSTRINGr|rr}rr~r rrr��TUPLE1r��TUPLE2r��TUPLE3r�r$r�r-r�r5r�r:r�r%r�r.r�r��INSTr��OBJr�r�r�r�r�rEr�rDr�r@r�rAr�rBr�r�r�r�r�r�r�r"r��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r'r�r*r�r0r�r1r�r6r�r�r�rr�r�rrrrrMs$		
	rMT)r�cCst|||d��|�dS)N)r�)r�r)r�r�r�r�rrr�_dump0sr�cCs6t��}t|||d��|�|��}t|t�s2t�|S)N)r�)rkrlr�r�getvaluer�rYr�)r�r�r�rwZresrrr�_dumps3s
r�rNrO)r�rPrQcCst||||d���S)N)r�rPrQ)rMr)r�r�rPrQrrr�_load:sr�cCs0t|t�rtd��t�|�}t||||d���S)Nz%Can't load pickle from unicode string)r�rPrQ)r�r�r�rkrlrMr)�sr�rPrQr�rrr�_loads>s


r�)	rr
rrrrrrrcCsddl}|��S)Nr)�doctestZtestmod)r�rrr�_testWsr�r�z$display contents of the pickle files)Zdescription�pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test�
store_truezrun self-test suite)�actionr�z-vz)run verbosely; only affects self-test run)N)N)�r�typesr�copyregrrrr�	itertoolsr�	functoolsrr�r	Zstructr
rrcrkr
rF�__all__r�	bytearrayrYZformat_versionZcompatible_formatsr�r��	Exceptionrr
rrZorg.python.corer!r>rr�r�r"r�r	rrr�rrr�r�r�r�r�r�r�rrr'r�rEr.r-r*r�r�r�r�r%r$r�r�r�r�r0r rr1rr�r�r�r�r@rArBr�r�r�r�r�rrr!rrrrrr5r6r:r�rDr�rvr��dirrhr|r�r�r�r�r�rMr�r�r�r��_picklerrrrrrr�r�argparse�ArgumentParser�parser�add_argumentZFileType�
parse_argsr�Ztestr�Z
print_helpZpprintrwr�rrrr�<module>s.

?*
40