Hacked By AnonymousFox

Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/binhex.cpython-33.pyo

�
��f�5c@sBdZddlZddlZddlZddlZdddgZGdd�de�Zed�\Z	Z
ZdZd	Z
d
ZGdd�d�Zd
d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS(u�Macintosh binhex compression/decompression.

easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
iNubinhexuhexbinuErrorcBs|EeZdZdS(uErrorN(u__name__u
__module__u__qualname__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyuErrorsii�i@s�cBs |EeZdZdd�ZdS(uFInfocCsd|_d|_d|_dS(Nu????i(uTypeuCreatoruFlags(uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__/s		uFInfo.__init__N(u__name__u
__module__u__qualname__u__init__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyuFInfo.suFInfoc
Cs�t�}tj|d��J}|jd�}d|krEd|_n|jdd�|j�}WdQXtjj	|�\}}|j
ddd�}|||dfS(	NurbiiuTEXTiu:u-i(uFInfouiouopenureaduTypeuseekutelluosupathusplitureplace(unameufinfoufpudataudsizeudirufile((u+/opt/alt/python33/lib64/python3.3/binhex.pyugetfileinfo4s	ugetfileinfocBsD|EeZdZdd�Zdd�Zdd�Zdd�Zd	S(
uopenrsrccGsdS(N((uselfuargs((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__Bsuopenrsrc.__init__cGsdS(Ns((uselfuargs((u+/opt/alt/python33/lib64/python3.3/binhex.pyureadEsu
openrsrc.readcGsdS(N((uselfuargs((u+/opt/alt/python33/lib64/python3.3/binhex.pyuwriteHsuopenrsrc.writecCsdS(N((uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyucloseKsuopenrsrc.closeN(u__name__u
__module__u__qualname__u__init__ureaduwriteuclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyuopenrsrcAsuopenrsrccBsJ|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S(u_Hqxcoderengineu(Write data to the coder in 3-byte chunkscCs,||_d|_d|_td|_dS(Nsi(uofpudatauhqxdatauLINELENulinelen(uselfuofp((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__Qs			u_Hqxcoderengine.__init__cCs�|j||_t|j�}|dd}|jd|�}|j|d�|_|s`dS|jtj|�|_|jd�dS(Nii(udataulenuhqxdataubinasciiub2a_hqxu_flush(uselfudataudatalenutodo((u+/opt/alt/python33/lib64/python3.3/binhex.pyuwriteWsu_Hqxcoderengine.writecCs�d}x]|t|j�|jkre||j}|jj|j||�d�t|_|}q	W|j|d�|_|r�|jj|jd�ndS(Nis
s:
(ulenuhqxdataulinelenuofpuwriteuLINELEN(uselfuforceufirstulast((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_flushbs
!	
u_Hqxcoderengine._flushcCsL|jr(|jtj|j�|_n|jd�|jj�|`dS(Ni(udatauhqxdataubinasciiub2a_hqxu_flushuofpuclose(uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyuclosems
	

u_Hqxcoderengine.closeN(u__name__u
__module__u__qualname__u__doc__u__init__uwriteu_flushuclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_HqxcoderengineNs
u_HqxcoderenginecBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	u_Rlecoderengineu4Write data to the RLE-coder in suitably large chunkscCs||_d|_dS(Ns(uofpudata(uselfuofp((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__ws	u_Rlecoderengine.__init__cCsX|j||_t|j�tkr)dStj|j�}|jj|�d|_dS(Ns(udataulenuREASONABLY_LARGEubinasciiurlecode_hqxuofpuwrite(uselfudataurledata((u+/opt/alt/python33/lib64/python3.3/binhex.pyuwrite{su_Rlecoderengine.writecCsE|jr.tj|j�}|jj|�n|jj�|`dS(N(udataubinasciiurlecode_hqxuofpuwriteuclose(uselfurledata((u+/opt/alt/python33/lib64/python3.3/binhex.pyuclose�s
	
u_Rlecoderengine.closeN(u__name__u
__module__u__qualname__u__doc__u__init__uwriteuclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_Rlecoderenginetsu_RlecoderenginecBst|EeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS(uBinHexc
	Cs�|\}}}}d}t|t�rH|}tj|d�}d}nyx|jd�t|�}	t|	�|_	d|_
|dkr�t�}n||_
||_|j||�t|_Wn|r�|j�n�YnXdS(Nuwbs0(This file must be converted with BinHex 4.0)

:iFT(uFalseu
isinstanceustruiouopenuTrueuwriteu_Hqxcoderengineu_RlecoderengineuofpucrcuNoneuFInfoudlenurlenu
_writeinfou_DID_HEADERustateuclose(
uselfuname_finfo_dlen_rlenuofpunameufinfoudlenurlenuclose_on_erroruofnameuhqxer((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__�s*	
			

uBinHex.__init__cCst|�}|dkr'td��nt|g�|jd�d}|j|j}}t|t�r{|jd�}nt|t�r�|jd�}n||}tj	d|j
�}tj	d|j|j�}	||||	}
|j
|
�|j�dS(Ni?uFilename too longulatin-1su>hu>ii(ulenuErrorubytesuencodeuTypeuCreatoru
isinstanceustrustructupackuFlagsudlenurlenu_writeu	_writecrc(uselfunameufinfounludutpucrud2ud3ud4uinfo((u+/opt/alt/python33/lib64/python3.3/binhex.pyu
_writeinfo�s 

uBinHex._writeinfocCs,tj||j�|_|jj|�dS(N(ubinasciiucrc_hqxucrcuofpuwrite(uselfudata((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_write�su
BinHex._writecCsJ|jdkrd}nd}|jjtj||j��d|_dS(Niu>hu>H(ucrcuofpuwriteustructupack(uselfufmt((u+/opt/alt/python33/lib64/python3.3/binhex.pyu	_writecrc�s
	uBinHex._writecrccCsE|jtkrtd��n|jt|�|_|j|�dS(NuWriting data at the wrong time(ustateu_DID_HEADERuErrorudlenulenu_write(uselfudata((u+/opt/alt/python33/lib64/python3.3/binhex.pyuwrite�suBinHex.writecCs?|jdkr(td|jf��n|j�t|_dS(NiuIncorrect data size, diff=%r(udlenuErrorurlenu	_writecrcu	_DID_DATAustate(uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyu
close_data�s
uBinHex.close_datacCsa|jtkr|j�n|jtkr:td��n|jt|�|_|j|�dS(Nu'Writing resource data at the wrong time(ustateu	_DID_DATAu
close_datauErrorurlenulenu_write(uselfudata((u+/opt/alt/python33/lib64/python3.3/binhex.pyu
write_rsrc�s
uBinHex.write_rsrccCs�|jtkr|j�n|jtkr:td��n|jdkrbtd|jf��n|j�|jj�d|_|`dS(NuClose at the wrong timeiu$Incorrect resource-datasize, diff=%r(	ustateu	_DID_DATAu
close_datauErrorurlenu	_writecrcuofpucloseuNone(uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyuclose�s


	uBinHex.closeN(u__name__u
__module__u__qualname__u__init__u
_writeinfou_writeu	_writecrcuwriteu
close_datau
write_rsrcuclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyuBinHex�s
uBinHexcCs�t|�}t||�}tj|d�}x)|jd�}|sIPn|j|�q0|j�|j�t|d�}x)|jd�}|s�Pn|j	|�q|j�|j�dS(uEbinhex(infilename, outfilename): create binhex-encoded copy of a fileurbi�N(
ugetfileinfouBinHexuiouopenureaduwriteu
close_dataucloseuopenrsrcu
write_rsrc(uinpuoutufinfouofpuifpud((u+/opt/alt/python33/lib64/python3.3/binhex.pyubinhex�s$


cBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	u_Hqxdecoderengineu*Read data via the decoder in 4-byte chunkscCs||_d|_dS(Ni(uifpueof(uselfuifp((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__�s	u_Hqxdecoderengine.__init__cCs�d}|}x�|dkr�|jr(|S|ddd}|jj|�}xiytj|�\}|_PWntjk
r�YnX|jjd�}|s�td��n||}qO||}|t|�}|r|jrtd��qqW|S(u&Read at least wtd bytes (or until EOF)siiiiiuPremature EOF on binhex file(ueofuifpureadubinasciiua2b_hqxu
IncompleteuErrorulen(uselfutotalwtdudecdatauwtdudatau
decdatacurunewdata((u+/opt/alt/python33/lib64/python3.3/binhex.pyureads,	

u_Hqxdecoderengine.readcCs|jj�dS(N(uifpuclose(uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyuclose su_Hqxdecoderengine.closeN(u__name__u
__module__u__qualname__u__doc__u__init__ureaduclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_Hqxdecoderengine�s u_HqxdecoderenginecBsJ|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S(u_RledecoderengineuRead data via the RLE-codercCs(||_d|_d|_d|_dS(Nsi(uifpu
pre_bufferupost_bufferueof(uselfuifp((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__&s			u_Rledecoderengine.__init__cCs_|t|j�kr2|j|t|j��n|jd|�}|j|d�|_|S(N(ulenupost_bufferu_fill(uselfuwtdurv((u+/opt/alt/python33/lib64/python3.3/binhex.pyuread,s
u_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(Nisisiii����i����i����i����i����(	u
pre_bufferuifpureadueofupost_bufferubinasciiu
rledecode_hqxulenuRUNCHAR(uselfuwtdumark((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_fill3s& 	
!



 u_Rledecoderengine._fillcCs|jj�dS(N(uifpuclose(uself((u+/opt/alt/python33/lib64/python3.3/binhex.pyucloseVsu_Rledecoderengine.closeN(u__name__u
__module__u__qualname__u__doc__u__init__ureadu_filluclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_Rledecoderengine#s
#u_RledecoderenginecBst|EeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS(uHexBincCs�t|t�r$tj|d�}nxI|jd�}|sKtd��n|dkr]q'n|dkr'Pq'q't|�}t|�|_d|_	|j
�dS(NurbiuNo binhex data founds
s:i(u
isinstanceustruiouopenureaduErroru_Hqxdecoderengineu_Rledecoderengineuifpucrcu_readheader(uselfuifpuchuhqxifp((u+/opt/alt/python33/lib64/python3.3/binhex.pyu__init__Zs	uHexBin.__init__cCs.|jj|�}tj||j�|_|S(N(uifpureadubinasciiucrc_hqxucrc(uselfulenudata((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_readpsuHexBin._readcCsntjd|jjd��dd@}|jd@|_||jkratd|j|f��nd|_dS(Nu>hiii��uCRC error, computed %x, read %x(ustructuunpackuifpureaducrcuError(uselfufilecrc((u+/opt/alt/python33/lib64/python3.3/binhex.pyu	_checkcrcus&uHexBin._checkcrccCs	|jd�}|jt|��}|jd�}|j�|dd�}|dd�}tjd|dd��d}tjd	|dd
��d|_tjd	|d
d��d|_||_t�|_||j_	||j_
||j_t|_
dS(Niiiii	u>hiiu>liiii	iii(u_readuordu	_checkcrcustructuunpackudlenurlenuFNameuFInfouCreatoruTypeuFlagsu_DID_HEADERustate(uselfulenufnameurestutypeucreatoruflags((u+/opt/alt/python33/lib64/python3.3/binhex.pyu_readheaders
 ##	uHexBin._readheadercGs�|jtkrtd��n|rC|d}t||j�}n	|j}d}x3t|�|kr�||j|t|��}qUW|j||_|S(NuRead data at wrong timeis(ustateu_DID_HEADERuErroruminudlenulenu_read(uselfunurv((u+/opt/alt/python33/lib64/python3.3/binhex.pyuread�s
	!uHexBin.readcCsS|jtkrtd��n|jr<|j|j�}n|j�t|_dS(Nuclose_data at wrong time(ustateu_DID_HEADERuErrorudlenu_readu	_checkcrcu	_DID_DATA(uselfudummy((u+/opt/alt/python33/lib64/python3.3/binhex.pyu
close_data�s	
uHexBin.close_datacGs�|jtkr|j�n|jtkr:td��n|r_|d}t||j�}n	|j}|j||_|j|�S(Nu Read resource data at wrong timei(ustateu_DID_HEADERu
close_datau	_DID_DATAuErroruminurlenu_read(uselfun((u+/opt/alt/python33/lib64/python3.3/binhex.pyu	read_rsrc�s

	uHexBin.read_rsrccCsB|jr|j|j�}n|j�t|_|jj�dS(N(urlenu	read_rsrcu	_checkcrcu	_DID_RSRCustateuifpuclose(uselfudummy((u+/opt/alt/python33/lib64/python3.3/binhex.pyuclose�s
	
	uHexBin.closeN(u__name__u
__module__u__qualname__u__init__u_readu	_checkcrcu_readheaderureadu
close_datau	read_rsrcuclose(u
__locals__((u+/opt/alt/python33/lib64/python3.3/binhex.pyuHexBinYs

uHexBincCs�t|�}|j}|s'|j}ntj|d�}x)|jd�}|sUPn|j|�q<|j�|j�|j	d�}|r�t
|d�}|j|�x)|j	d�}|s�Pn|j|�q�|j�n|j�dS(u6hexbin(infilename, outfilename) - Decode binhexed fileuwbi�N(uHexBinuFInfouFNameuiouopenureaduwriteucloseu
close_datau	read_rsrcuopenrsrc(uinpuoutuifpufinfouofpud((u+/opt/alt/python33/lib64/python3.3/binhex.pyuhexbin�s.	



(u__doc__uiouosustructubinasciiu__all__u	ExceptionuErrorurangeu_DID_HEADERu	_DID_DATAu	_DID_RSRCuREASONABLY_LARGEuLINELENuRUNCHARuFInfougetfileinfouopenrsrcu_Hqxcoderengineu_RlecoderengineuBinHexubinhexu_Hqxdecoderengineu_RledecoderengineuHexBinuhexbin(((u+/opt/alt/python33/lib64/python3.3/binhex.pyu<module>s*

&Y*6d

Hacked By AnonymousFox1.0, Coded By AnonymousFox