관리-도구
편집 파일: pickle.cpython-37.pyc
B � f�� � @ s d Z ddlmZ ddlmZ ddlmZmZmZ ddlm Z ddl mZ ddlZddlm Z dd lmZmZ ddlZddlZddlZddlZd ddd dddddg ZeefZdZdddddddgZdZdZG dd � d e�ZG dd� de�ZG dd� de�Z G dd � d e�Z!ydd!l"m#Z# W n e$k �r2 dZ#Y nX d"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 �� G dgdh� dh�ZkG didj� dj�Zldkdl� Zmdmdn� Zndodp� Zodqdr� ZpG dsdt� dt�ZqG dudv� 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} W n4 e$k �rb eqer ZxZyeseteuevf\ZzZ{Z|Z}Y nX d�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�W dS )�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 @ s e Zd ZdZdS )r z6A common base class for the other pickling exceptions.N)�__name__� __module__�__qualname__�__doc__� r r �+/opt/alt/python37/lib64/python3.7/pickle.pyr @ s c @ s e Zd ZdZdS )r z]This exception is raised when an unpicklable object is passed to the dump() method. N)r r r r r r r r r D s c @ s e Zd ZdZdS )r a This 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)r r r r r r r r r K s c @ s e Zd Zdd� ZdS )�_Stopc C s || _ d S )N)�value)�selfr r r r �__init__Y s z_Stop.__init__N)r r r r r r r r r X s 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� Gs I01 s I00 � �� �� �� �� �� �� �� �� �� �� �� �� B� C� �� �� �� �� �� �� �� �� �� �c C s g | ]}t �d |�r|�qS )z[A-Z][A-Z0-9_]+$)�re�match)�.0�xr r r � <listcomp>� s rg c @ sF e Zd ZdZdZdd� Zdd� Zdd� Zdd d�Zdd � Z dd� Z dS )�_Framerr i c C s || _ d | _d S )N)� file_write� current_frame)r ri r r r r � s z_Framer.__init__c C s t �� | _d S )N)�io�BytesIOrj )r r r r � start_framing� s z_Framer.start_framingc C s* | j r&| j �� dkr&| jdd� d | _ d S )Nr T)�force)rj �tell�commit_frame)r r r r �end_framing� s z_Framer.end_framingFc C sf | j rb| j }|�� | jks|rb|�� }| j}t|�| jkrP|ttdt|�� � ||� t � � | _ d S )Nz<Q)rj ro �_FRAME_SIZE_TARGET� getbufferri �len�_FRAME_SIZE_MIN�FRAMEr rk rl )r rn �f�data�writer r r rp � s z_Framer.commit_framec C s | j r| j �|�S | �|�S d S )N)rj ry ri )r rx r r r ry � s z _Framer.writec C s, | j }| jr| jdd� ||� ||� d S )NT)rn )ri rj rp )r �headerZpayloadry r r r �write_large_bytes� s z_Framer.write_large_bytesN)F)r r r ru rr r rm rq rp ry r{ r r r r rh � s rh c @ s. e Zd Zd dd�Zdd� Zdd� Zdd � ZdS )� _UnframerNc C s || _ || _d | _d S )N)� file_read� file_readlinerj )r r} r~ Z file_tellr r r r � s z_Unframer.__init__c C sT | j rF| j �|�}|s.|dkr.d | _ | �|�S t|�|k rBtd��|S | �|�S d S )Nr z$pickle exhausted before end of frame)rj �readr} rt r )r �nrx r r r r � s z_Unframer.readc C sF | j r:| j �� }|s"d | _ | �� S |d dkr6td��|S | �� S d S )N���� z$pickle exhausted before end of frame)rj �readliner~ r )r rx r r r r� s z_Unframer.readlinec C s2 | j r| j �� dkrtd��t�| �|��| _ d S )N� z4beginning of a new frame before end of current frame)rj r r rk rl r} )r � frame_sizer r r � load_frame s z_Unframer.load_frame)N)r r r r r r� r� r r r r r| � s r| c C sn xd|� d�D ]V}|dkr(td�|| ���y| }t| |�} W q tk r` td�|| ��d �Y qX qW | |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�parentr r r � _getattribute! s r� c C sz t | dd�}|dk r|S x\ttj�� �D ]J\}}|dks(|dkrBq(yt||�d | krZ|S W q( tk rp Y q(X q(W dS )z$Find the module an object belong to.r N�__main__r )r� �list�sys�modules�itemsr� r� )r� r� �module_name�moduler r r �whichmodule. s r� c C sh | dkrdS | � � d? d }| j|ddd�}| dk rd|dkrd|d d krd|d d@ dkrd|dd� }|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' >>> r r� r � �littleT)� byteorder�signedr� � ���� N)� bit_length�to_bytes)rf �nbytes�resultr r r �encode_long? s r� c C s t j| 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)rx r r r �decode_long] s r� c @ sh e Zd Zd7dd�dd�Zdd� Zdd � Zd d� Zdd � Zdd� Zd8dd�Z dd� Z dd� Zd9dd�Zi Z dd� Zee ed�<