AlkantarClanX12

Your IP : 3.141.42.41


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/binhex.cpython-38.opt-2.pyc

U

i�f�6�@s�ddlZddlZddlZddlZdddgZGdd�de�ZdZdZdZ	dZ
d	ZGd
d�d�Zdd
�Z
Gdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�+/opt/alt/python38/lib64/python3.8/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags��selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
c	Cstt�}t�|d��2}|�d�}d|kr,d|_|�dd�|��}W5QRXtj�	|�\}}|�
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r'c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS�Nr�r�argsrrr	rCszopenrsrc.__init__cGsdS�N�rr*rrr	rFsz
openrsrc.readcGsdSr)rr*rrr	�writeIszopenrsrc.writecCsdSr)rrrrr	�closeLszopenrsrc.closeN)rrrrrr.r/rrrr	r(Bsr(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_HqxcoderenginecCs ||_d|_d|_td|_dS)Nr-r
)�ofpr$�hqxdata�LINELEN�linelen�rr1rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jt�|�|_|�d�dS)N�r)r$�lenr2�binascii�b2a_hqx�_flush)rr$ZdatalenZtodorrr	r.Xs
z_Hqxcoderengine.writecCsrd}|t|j�|jkrH||j}|j�|j||�d�t|_|}q|j|d�|_|rn|j�|jd�dS)Nr�
s:
)r7r2r4r1r.r3)rZforce�firstZlastrrr	r:cs
z_Hqxcoderengine._flushcCs6|jr|jt�|j�|_|�d�|j��|`dS)Nr
)r$r2r8r9r:r1r/rrrr	r/ns


z_Hqxcoderengine.closeN)rrrrr.r:r/rrrr	r0Osr0c@s$eZdZdd�Zdd�Zdd�ZdS)�_RlecoderenginecCs||_d|_dSr,)r1r$r5rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdSt�|j�}|j�|�d|_dSr,)r$r7�REASONABLY_LARGEr8�rlecode_hqxr1r.)rr$�rledatarrr	r.|sz_Rlecoderengine.writecCs0|jrt�|j�}|j�|�|j��|`dSr))r$r8r?r1r.r/)rr@rrr	r/�s

z_Rlecoderengine.closeN)rrrrr.r/rrrr	r=usr=c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r.|}t�|d�}d}zR|�d�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|�||�t
|_Wn|r�|���YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr.r0r=r1�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater/)
rZname_finfo_dlen_rlenr1r!r"rFrGZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|�d�d}|j|j}}t|t�rR|�d�}t|t�rf|�d�}||}t�	d|j
�}t�	d|j|j�}	||||	}
|�
|
�|��dS)N�?zFilename too longzlatin-1��>hz>ii)r7r�bytes�encoderrrCrD�struct�packrrFrG�_write�	_writecrc)rr!r"�nl�d�tpZcrZd2Zd3Zd4�inforrr	rH�s




zBinHex._writeinfocCs t�||j�|_|j�|�dSr))r8�crc_hqxrEr1r.�rr$rrr	rR�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)NrrMz>H)rEr1r.rPrQ)rZfmtrrr	rS�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|�|�dS)NzWriting data at the wrong time)rJrIrrFr7rRrYrrr	r.�s
zBinHex.writecCs,|jdkrtd|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rFrrGrS�	_DID_DATArJrrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|��|jtkr$td��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rJrZr[rrGr7rRrYrrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|��|jtkr4td��|jdkrNtd|jf��|��W5d|_|j}|`|��XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rJr1r/rZr[rrGrSr5rrr	r/�s



zBinHex.closeN)rrrrrHrRrSr.r[r\r/rrrr	rA�s
rAc	Cs�t|�}t||�}t�|d��*}|�d�}|s0q<|�|�q |��W5QRXt|d�}|�d�}|shqt|�|�qX|�	�|�	�dS)Nr��)
r'rArrrr.r[r(r\r/)�inp�outr"r1�ifprUrrr	r�s



c@s$eZdZdd�Zdd�Zdd�ZdS)�_HqxdecoderenginecCs||_d|_dS)Nr)r`�eof�rr`rrr	rsz_Hqxdecoderengine.__init__cCs�d}|}|dkr�|jr|S|ddd}|j�|�}zt�|�\}|_Wq�Wntjk
rdYnX|j�d�}|s~td��||}q6||}|t|�}|s|jstd��q|S)Nr-rrr6�r
zPremature EOF on binhex file)rbr`rr8Za2b_hqxZ
Incompleterr7)rZtotalwtdZdecdata�wtdr$Z
decdatacur�newdatarrr	rs*


z_Hqxdecoderengine.readcCs|j��dSr)�r`r/rrrr	r/%sz_Hqxdecoderengine.closeN)rrrrrr/rrrr	ra�s rac@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_RledecoderenginecCs||_d|_d|_d|_dS)Nr-r)r`�
pre_buffer�post_bufferrbrcrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|�|t|j��|jd|�}|j|d�|_|Sr))r7rj�_fill)rre�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|j�|d�|_|jjr>|jt�|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jdd�tdkr�|d}n|jdd�tkr�n|d	}|jt�|jd|��|_|j|d�|_dS)
Nrdr-���rLr6���r���r
)	rir`rrbrjr8Z
rledecode_hqxr7�RUNCHAR)rreZmarkrrr	rk8s*
�



�z_Rledecoderengine._fillcCs|j��dSr)rgrrrr	r/[sz_Rledecoderengine.closeN)rrrrrrkr/rrrr	rh(s#rhc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsft|t�rt�|d�}|�d�}|s,td��|dkr6q|dkrqBqt|�}t|�|_d|_	|�
�dS)Nrr
zNo binhex data foundr;�:r)rCrDrrrrrarhr`rE�_readheader)rr`ZchZhqxifprrr	r_s


zHexBin.__init__cCs |j�|�}t�||j�|_|Sr))r`rr8rXrE)rr7r$rrr	�_readuszHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkrDtd|j|f��d|_dS)NrMrri��zCRC error, computed %x, read %x)rP�unpackr`rrEr)rZfilecrcrrr	�	_checkcrczs
�zHexBin._checkcrccCs�|�d�}|�t|��}|�d�}|��|dd�}|dd�}t�d|dd��d}t�d|dd	��d|_t�d|d	d��d|_||_t�|_||j_	||j_
||j_t|_
dS)
Nr
���	rM�rz>l�)rt�ordrvrPrurFrG�FNamer
rrrrIrJ)rr7Zfname�rest�typeZcreator�flagsrrr	rs�s

zHexBin._readheadercGsj|jtkrtd��|r,|d}t||j�}n|j}d}t|�|krZ||�|t|��}q6|j||_|S)NzRead data at wrong timerr-)rJrIr�minrFr7rt)r�nrlrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|�|j�}|��t|_dS)Nzclose_data at wrong time)rJrIrrFrtrvrZ�rZdummyrrr	r[�s
zHexBin.close_datacGsZ|jtkr|��|jtkr$td��|r>|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rJrIr[rZrr�rGrt)rr�rrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|�|j�}|��W5d|_|j��XdSr))rJr`r/rGr�rvr�rrr	r/�s
zHexBin.closeN)rrrrrtrvrsrr[r�r/rrrr	rq^s

rqc	Cs�t|�}|j}|s|j}t�|d��"}|�d�}|s6qB|�|�q&W5QRX|��|�d�}|r�t	|d�}|�|�|�d�}|s�q�|�|�qv|�
�|�
�dS)NrBr])rqr
r}rrrr.r[r�r(r/)r^r_r`r"r1rUrrr	r�s(




)rrrPr8�__all__�	ExceptionrrIrZr>r3rpr
r'r(r0r=rArrarhrqrrrrr	�<module>s*


&^*6h