Hacked By AnonymousFox

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

B

YI~d�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/python37/lib64/python3.7/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�|��}WdQRXtj�	|�\}}|�
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�r)rr(rrr	rFsz
openrsrc.readcGsdS)Nr)rr(rrr	�writeIszopenrsrc.writecCsdS)Nr)rrrr	�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)rr-rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jt�|�|_|�d�dS)N�r)r#�lenr.�binascii�b2a_hqx�_flush)rr#ZdatalenZtodorrr	r*Xs
z_Hqxcoderengine.writecCsvd}xF|t|j�|jkrJ||j}|j�|j||�d�t|_|}qW|j|d�|_|rr|j�|jd�dS)Nr�
s:
)r2r.r0r-r*r/)r�force�firstZlastrrr	r5cs
z_Hqxcoderengine._flushcCs6|jr|jt�|j�|_|�d�|j��|`dS)Nr
)r#r.r3r4r5r-r+)rrrr	r+ns


z_Hqxcoderengine.closeN)rrrrr*r5r+rrrr	r,Osr,c@s$eZdZdd�Zdd�Zdd�ZdS)�_RlecoderenginecCs||_d|_dS)Nr))r-r#)rr-rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdSt�|j�}|j�|�d|_dS)Nr))r#r2�REASONABLY_LARGEr3�rlecode_hqxr-r*)rr#�rledatarrr	r*|sz_Rlecoderengine.writecCs0|jrt�|j�}|j�|�|j��|`dS)N)r#r3r;r-r*r+)rr<rrr	r+�s

z_Rlecoderengine.closeN)rrrrr*r+rrrr	r9usr9c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r.|}t�|d�}d}yR|�d�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|�||�t
|_Wn|r�|���YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr*r,r9r-�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater+)
rZname_finfo_dlen_rlenr-r r!rBrCZclose_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�z>hz>ii)r2r�bytes�encoderrr?r@�struct�packrrBrC�_write�	_writecrc)rr r!�nl�d�tpZcrZd2Zd3Zd4�inforrr	rD�s




zBinHex._writeinfocCs t�||j�|_|j�|�dS)N)r3�crc_hqxrAr-r*)rr#rrr	rM�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)Nrz>hz>H)rAr-r*rKrL)rZfmtrrr	rN�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|�|�dS)NzWriting data at the wrong time)rFrErrBr2rM)rr#rrr	r*�s
zBinHex.writecCs,|jdkrtd|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rBrrCrN�	_DID_DATArF)rrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|��|jtkr$td��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rFrTrUrrCr2rM)rr#rrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|��|jtkr4td��|jdkrNtd|jf��|��Wdd|_|j}|`|��XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rFrTrUrrCrNr-r+)rr-rrr	r+�s



zBinHex.closeN)rrrrrDrMrNr*rUrVr+rrrr	r=�s
r=c	Cs�t|�}t||�}t�|d��.}x|�d�}|s2P|�|�q"W|��WdQRXt|d�}x|�d�}|snP|�|�q^W|�	�|�	�dS)Nri�)
r&r=rrrr*rUr'rVr+)�inp�outr!r-�ifprPrrr	r�s"



c@s$eZdZdd�Zdd�Zdd�ZdS)�_HqxdecoderenginecCs||_d|_dS)Nr)rY�eof)rrYrrr	rsz_Hqxdecoderengine.__init__cCs�d}|}x�|dkr�|jr|S|ddd}|j�|�}xRyt�|�\}|_PWntjk
rfYnX|j�d�}|s�td��||}q:W||}|t|�}|s
|js
td��q
W|S)Nr)rrr1�r
zPremature EOF on binhex file)r[rYrr3Za2b_hqxZ
Incompleterr2)rZtotalwtdZdecdata�wtdr#Z
decdatacur�newdatarrr	rs,

z_Hqxdecoderengine.readcCs|j��dS)N)rYr+)rrrr	r+%sz_Hqxdecoderengine.closeN)rrrrrr+rrrr	rZ�s rZc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_RledecoderenginecCs||_d|_d|_d|_dS)Nr)r)rY�
pre_buffer�post_bufferr[)rrYrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|�|t|j��|jd|�}|j|d�|_|S)N)r2ra�_fill)rr]�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)
Nr\r)���rHr1���r���r
)	r`rYrr[rar3Z
rledecode_hqxr2�RUNCHAR)rr]Zmarkrrr	rb8s&



z_Rledecoderengine._fillcCs|j��dS)N)rYr+)rrrr	r+[sz_Rledecoderengine.closeN)rrrrrrbr+rrrr	r_(s#r_c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsjt|t�rt�|d�}x.|�d�}|s.td��|dkr8q|dkrPqWt|�}t|�|_d|_	|�
�dS)Nrr
zNo binhex data found�
�:r)r?r@rrrrrZr_rYrA�_readheader)rrYZchZhqxifprrr	r_s


zHexBin.__init__cCs |j�|�}t�||j�|_|S)N)rYrr3rSrA)rr2r#rrr	�_readuszHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkrDtd|j|f��d|_dS)Nz>hrri��zCRC error, computed %x, read %x)rK�unpackrYrrAr)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
���	z>h�rz>l�)rl�ordrnrKrmrBrC�FNamer
rrrrErF)rr2Zfname�rest�typeZcreator�flagsrrr	rk�s

zHexBin._readheadercGsn|jtkrtd��|r,|d}t||j�}n|j}d}x&t|�|kr\||�|t|��}q8W|j||_|S)NzRead data at wrong timerr))rFrEr�minrBr2rl)r�nrcrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|�|j�}|��t|_dS)Nzclose_data at wrong time)rFrErrBrlrnrT)r�dummyrrr	rU�s
zHexBin.close_datacGsZ|jtkr|��|jtkr$td��|r>|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rFrErUrTrryrCrl)rrzrrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|�|j�}|��Wdd|_|j��XdS)N)rFrCr|rnrYr+)rr{rrr	r+�s
zHexBin.closeN)rrrrrlrnrkrrUr|r+rrrr	rh^s

rhc	Cs�t|�}|j}|s|j}t�|d��&}x|�d�}|s8P|�|�q(WWdQRX|��|�d�}|r�t	|d�}|�|�x|�d�}|s�P|�|�q|W|�
�|�
�dS)Nr>i�)rhr
rurrrr*rUr|r'r+)rWrXrYr!r-rPrrr	r�s,




)rrrKr3�__all__�	ExceptionrrErTr:r/rgr
r&r'r,r9r=rrZr_rhrrrrr	�<module>s*


&^*6h

Hacked By AnonymousFox1.0, Coded By AnonymousFox