ok

Mini Shell

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



���]�6�@s3ddlZddlZddlZddlZdddgZGdd�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@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�+/opt/alt/python35/lib64/python3.5/binhex.pyrs�i��@s�c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags)�selfrrr	�__init__0s		zFInfo.__init__N)rrrrrrrr	r/srcCs�t�}tj|d��G}|jd�}d|krBd|_|jdd�|j�}WdQRXtjj	|�\}}|j
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&Bsr&c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_HqxcoderenginecCs,||_d|_d|_td|_dS)Nr(r
)�ofpr"�hqxdata�LINELEN�linelen)rr,rrr	rRs			z_Hqxcoderengine.__init__cCs�|j||_t|j�}|dd}|jd|�}|j|d�|_|s`dS|jtj|�|_|jd�dS)N�r)r"�lenr-�binascii�b2a_hqx�_flush)rr"ZdatalenZtodorrr	r)Xsz_Hqxcoderengine.writecCs�d}x]|t|j�|jkre||j}|jj|j||�d�t|_|}q	W|j|d�|_|r�|jj|jd�dS)Nrs
s:
)r1r-r/r,r)r.)r�force�firstZlastrrr	r4cs
!	
z_Hqxcoderengine._flushcCsI|jr%|jtj|j�|_|jd�|jj�|`dS)Nr
)r"r-r2r3r4r,r*)rrrr	r*ns
	

z_Hqxcoderengine.closeN)rrrrr)r4r*rrrr	r+Osr+c@s4eZdZdd�Zdd�Zdd�ZdS)�_RlecoderenginecCs||_d|_dS)Nr()r,r")rr,rrr	rxs	z_Rlecoderengine.__init__cCsX|j||_t|j�tkr)dStj|j�}|jj|�d|_dS)Nr()r"r1�REASONABLY_LARGEr2�rlecode_hqxr,r))rr"�rledatarrr	r)|sz_Rlecoderengine.writecCsB|jr+tj|j�}|jj|�|jj�|`dS)N)r"r2r9r,r)r*)rr:rrr	r*�s
	
z_Rlecoderengine.closeN)rrrrr)r*rrrr	r7usr7c@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
	Cs�|\}}}}d}t|t�rE|}tj|d�}d}yu|jd�t|�}	t|	�|_d|_|dkr�t	�}||_
||_|j||�t
|_Wn|r�|j��YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr)r+r7r,�crcr�dlen�rlen�
_writeinfo�_DID_HEADER�stater*)
rZname_finfo_dlen_rlenr,rr r@rAZclose_on_errorZofnameZhqxerrrr	r�s*
				

zBinHex.__init__cCs�t|�}|dkr$td��t|g�|jd�d}|j|j}}t|t�ru|jd�}t|t�r�|jd�}||}tj	d|j
�}tj	d|j|j�}	||||	}
|j
|
�|j�dS)N�?zFilename too longzlatin-1sz>hz>ii)r1r�bytes�encoder
rr=r>�struct�packrr@rA�_write�	_writecrc)rrr �nl�d�tpZcrZd2Zd3Zd4�inforrr	rB�s 

zBinHex._writeinfocCs,tj||j�|_|jj|�dS)N)r2�crc_hqxr?r,r))rr"rrr	rJ�sz
BinHex._writecCsJ|jdkrd}nd}|jjtj||j��d|_dS)Nrz>hz>H)r?r,r)rHrI)r�fmtrrr	rK�s
	zBinHex._writecrccCsB|jtkrtd��|jt|�|_|j|�dS)NzWriting data at the wrong time)rDrCrr@r1rJ)rr"rrr	r)�szBinHex.writecCs<|jdkr%td|jf��|j�t|_dS)NrzIncorrect data size, diff=%r)r@rrArK�	_DID_DATArD)rrrr	�
close_data�s
zBinHex.close_datacCs[|jtkr|j�|jtkr4td��|jt|�|_|j|�dS)Nz'Writing resource data at the wrong time)rDrRrSrrAr1rJ)rr"rrr	�
write_rsrc�s
zBinHex.write_rsrccCs�|jdkrdSzg|jtkr/|j�|jtkrJtd��|jdkrotd|jf��|j�Wdd|_|j}|`|j�XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rDrRrSrrArKr,r*)rr,rrr	r*�s
		zBinHex.closeN)rrrrrBrJrKr)rSrTr*rrrr	r;�s
r;c
Cs�t|�}t||�}tj|d��;}x'|jd�}|sIP|j|�q3W|j�WdQRXt|d�}x'|jd�}|s�P|j|�q}W|j	�|j	�dS)Nri�)
r%r;rrrr)rSr&rTr*)�inp�outr r,�ifprMrrr	r�s"
c@s4eZdZdd�Zdd�Zdd�ZdS)�_HqxdecoderenginecCs||_d|_dS)Nr)rW�eof)rrWrrr	rs	z_Hqxdecoderengine.__init__cCs�d}|}x�|dkr�|jr(|S|ddd}|jj|�}xgytj|�\}|_PWntjk
r�YnX|jjd�}|s�td��||}qOW||}|t|�}|r|jrtd��qW|S)Nr(rrr0�r
zPremature EOF on binhex file)rYrWrr2Za2b_hqxZ
Incompleterr1)rZtotalwtdZdecdata�wtdr"Z
decdatacur�newdatarrr	rs,	
z_Hqxdecoderengine.readcCs|jj�dS)N)rWr*)rrrr	r*%sz_Hqxdecoderengine.closeN)rrrrrr*rrrr	rX�s rXc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_RledecoderenginecCs(||_d|_d|_d|_dS)Nr(r)rW�
pre_buffer�post_bufferrY)rrWrrr	r+s			z_Rledecoderengine.__init__cCs\|t|j�kr/|j|t|j��|jd|�}|j|d�|_|S)N)r1r_�_fill)rr[�rvrrr	r1s
z_Rledecoderengine.readcCsH|j|jj|d�|_|jjrU|jtj|j�|_d|_dSt|j�}|jdd�tdtkr�|d}nv|jdd�tkr�|d}nP|jd	d�tdkr�|d}n&|jd
d�tkr�n
|d}|jtj|jd|��|_|j|d�|_dS)NrZr(r0sr
r���������rdrc)	r^rWrrYr_r2Z
rledecode_hqxr1�RUNCHAR)rr[�markrrr	r`8s& 	
!



 z_Rledecoderengine._fillcCs|jj�dS)N)rWr*)rrrr	r*[sz_Rledecoderengine.closeN)rrrrrr`r*rrrr	r](s#r]c@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCs�t|t�r!tj|d�}xA|jd�}|sEtd��|dkrTq$|dkr$Pq$Wt|�}t|�|_d|_	|j
�dS)Nrr
zNo binhex data founds
�:r)r=r>rrrrrXr]rWr?�_readheader)rrWZchZhqxifprrr	r_s	zHexBin.__init__cCs.|jj|�}tj||j�|_|S)N)rWrr2rPr?)rr1r"rrr	�_readuszHexBin._readcCsktjd|jjd��dd@}|jd@|_||jkr^td|j|f��d|_dS)Nz>hrri��zCRC error, computed %x, read %x)rH�unpackrWrr?r)rZfilecrcrrr	�	_checkcrczs&zHexBin._checkcrccCs	|jd�}|jt|��}|jd�}|j�|dd�}|dd�}tjd|dd��d}tjd	|dd
��d|_tjd	|d
d��d|_||_t�|_||j_	||j_
||j_t|_
dS)Nr
rZr��	z>h�rz>l��rmrnrorprq)rj�ordrlrHrkr@rA�FNamerrr
rrCrD)rr1Zfname�rest�typeZcreator�flagsrrr	ri�s
 ##	zHexBin._readheadercGs�|jtkrtd��|r@|d}t||j�}n	|j}d}x3t|�|kr�||j|t|��}qRW|j||_|S)NzRead data at wrong timerr()rDrCr�minr@r1rj)r�nrarrr	r�s
	!zHexBin.readcCsM|jtkrtd��|jr6|j|j�}|j�t|_dS)Nzclose_data at wrong time)rDrCrr@rjrlrR)r�dummyrrr	rS�s	
zHexBin.close_datacGs|jtkr|j�|jtkr4td��|rY|d}t||j�}n	|j}|j||_|j|�S)Nz Read resource data at wrong timer)rDrCrSrRrrwrArj)rrxrrr	�	read_rsrc�s

	zHexBin.read_rsrccCsZ|jdkrdSz)|jr1|j|j�}|j�Wdd|_|jj�XdS)N)rDrArzrlrWr*)rryrrr	r*�s		zHexBin.closeN)rrrrrjrlrirrSrzr*rrrr	rg^s

rgc
Cs�t|�}|j}|s$|j}tj|d��1}x'|jd�}|sRP|j|�q<WWdQRX|j�|jd�}|r�t	|d�}|j|�x'|jd�}|s�P|j|�q�W|j
�|j
�dS)Nr<i�)rgrrsrrrr)rSrzr&r*)rUrVrWr r,rMrrr	r�s,		


)rrrHr2�__all__�	ExceptionrrCrRr8r.rerr%r&r+r7r;rrXr]rgrrrrr	�<module>s*

&^*6h

Zerion Mini Shell 1.0