Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/binhex.pyo

�
^
bc@s�dZddlZddlZddlZddlZdddgZdefd��YZdZdZ	d	Z
d
Zed�Z
y<ddlmZmZdd
lmZd�Zd�ZWn@ek
r�dd%d��YZd�Zdd&d��YZnXdd'd��YZdd(d��YZdd)d��YZd�Zdd*d��YZdd+d��YZd d,d!��YZd"�Zd#�Zed$kr�e�ndS(-s�Macintosh binhex compression/decompression.

easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
i����NtbinhexthexbintErrorcBseZRS((t__name__t
__module__(((s+/opt/alt/python27/lib64/python2.7/binhex.pyRsiii�i@i�(tFSSpectFInfo(topenrfcCs�t|�j�}tjj|�\}}t|d�}|jdd�|j�}t|d�}|jdd�|j�}||||fS(Ntrbiis*rb(	RtFSpGetFInfotostpathtsplittopentseekttellR(tnametfinfotdirtfiletfptdlentrlen((s+/opt/alt/python27/lib64/python2.7/binhex.pytgetfileinfo4scGs*|sd}nd|d}t||�S(Ns*rbt*i(R(Rtmode((s+/opt/alt/python27/lib64/python2.7/binhex.pytopenrsrc@s	RcBseZd�ZRS(cCsd|_d|_d|_dS(Ns????i(tTypetCreatortFlags(tself((s+/opt/alt/python27/lib64/python2.7/binhex.pyt__init__Ms		(RRR(((s+/opt/alt/python27/lib64/python2.7/binhex.pyRLscCs�t�}t|�}t|�jd�}xF|D]5}|j�r1|dksbt|�dkr1Pq1q1Wd|_|jdd�|j�}|j�t	j
j|�\}}|jddd	�}|||dfS(
Nit itTEXTiit:t-i(
RR
treadtisspacetordRRRtcloseR
RRtreplace(RRRtdatatctdsizeRR((s+/opt/alt/python27/lib64/python2.7/binhex.pyRRs	
+	
RcBs,eZd�Zd�Zd�Zd�ZRS(cGsdS(N((Rtargs((s+/opt/alt/python27/lib64/python2.7/binhex.pyRdscGsdS(Nt((RR,((s+/opt/alt/python27/lib64/python2.7/binhex.pyR$gscGsdS(N((RR,((s+/opt/alt/python27/lib64/python2.7/binhex.pytwritejscCsdS(N((R((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'ms(RRRR$R.R'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyRcs			t_HqxcoderenginecBs2eZdZd�Zd�Zd�Zd�ZRS(s(Write data to the coder in 3-byte chunkscCs,||_d|_d|_td|_dS(NR-i(tofpR)thqxdatatLINELENtlinelen(RR0((s+/opt/alt/python27/lib64/python2.7/binhex.pyRss			cCs~|j||_t|j�}|dd}|j| }|j||_|sTdS|jtj|�|_|jd�dS(Nii(R)tlenR1tbinasciitb2a_hqxt_flush(RR)tdatalenttodo((s+/opt/alt/python27/lib64/python2.7/binhex.pyR.ys
cCs�d}xZ|t|j�|jkrb||j}|jj|j||!d�t|_|}q	W|j||_|r�|jj|jd�ndS(Nis
s:
(R4R1R3R0R.R2(Rtforcetfirsttlast((s+/opt/alt/python27/lib64/python2.7/binhex.pyR7�s
	
cCsL|jr(|jtj|j�|_n|jd�|jj�|`dS(Ni(R)R1R5R6R7R0R'(R((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'�s
	

(RRt__doc__RR.R7R'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyR/ps
			t_RlecoderenginecBs)eZdZd�Zd�Zd�ZRS(s4Write data to the RLE-coder in suitably large chunkscCs||_d|_dS(NR-(R0R)(RR0((s+/opt/alt/python27/lib64/python2.7/binhex.pyR�s	cCsX|j||_t|j�tkr)dStj|j�}|jj|�d|_dS(NR-(R)R4tREASONABLY_LARGER5trlecode_hqxR0R.(RR)trledata((s+/opt/alt/python27/lib64/python2.7/binhex.pyR.�scCsE|jr.tj|j�}|jj|�n|jj�|`dS(N(R)R5R@R0R.R'(RRA((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'�s
	
(RRR=RR.R'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyR>�s		tBinHexcBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(c	Cs�|\}}}}t|�td�krB|}t|d�}n|jd�t|�}t|�|_d|_|dkr�t�}n||_	||_
|j||�t|_
dS(NR-tws0(This file must be converted with BinHex 4.0)

:i(ttypeR
R.R/R>R0tcrctNoneRRRt
_writeinfot_DID_HEADERtstate(	Rtname_finfo_dlen_rlenR0RRRRtofnamethqxer((s+/opt/alt/python27/lib64/python2.7/binhex.pyR�s
			c	Cs�t|�}|dkr$td�nt|�|d}|j|j}tjd|j�}tjd|j|j	�}||||}|j
|�|j�dS(Ni?sFilename too longss>hs>ii(R4RtchrRRtstructtpackRRRt_writet	_writecrc(	RRRtnltdtd2td3td4tinfo((s+/opt/alt/python27/lib64/python2.7/binhex.pyRG�s
cCs,tj||j�|_|jj|�dS(N(R5tcrc_hqxRER0R.(RR)((s+/opt/alt/python27/lib64/python2.7/binhex.pyRP�scCsJ|jdkrd}nd}|jjtj||j��d|_dS(Nis>hs>H(RER0R.RNRO(Rtfmt((s+/opt/alt/python27/lib64/python2.7/binhex.pyRQ�s
	cCsB|jtkrtd�n|jt|�|_|j|�dS(NsWriting data at the wrong time(RIRHRRR4RP(RR)((s+/opt/alt/python27/lib64/python2.7/binhex.pyR.�scCs<|jdkr%td|jf�n|j�t|_dS(NisIncorrect data size, diff=%r(RRRRQt	_DID_DATARI(R((s+/opt/alt/python27/lib64/python2.7/binhex.pyt
close_data�s
cCs^|jtkr|j�n|jtkr7td�n|jt|�|_|j|�dS(Ns'Writing resource data at the wrong time(RIRZR[RRR4RP(RR)((s+/opt/alt/python27/lib64/python2.7/binhex.pyt
write_rsrc�s
cCs�|jdkrdSzj|jtkr2|j�n|jtkrMtd�n|jdkrrtd|jf�n|j�Wdd|_|j}|`|j�XdS(NsClose at the wrong timeis$Incorrect resource-datasize, diff=%r(	RIRFRZR[RRRQR0R'(RR0((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'�s
		(
RRRRGRPRQR.R[R\R'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyRB�s				
			cCs�t|�}t||�}t|d�}x*|jd�}|sFPn|j|�q-W|j�|j�t|d�}x*|jd�}|s�Pn|j|�q}W|j�|j�dS(s@(infilename, outfilename) - Create binhex-encoded copy of a fileRi�N(	RRBR
R$R.R[R'RR\(tinptoutRR0tifpRS((s+/opt/alt/python27/lib64/python2.7/binhex.pyRs$


t_HqxdecoderenginecBs)eZdZd�Zd�Zd�ZRS(s*Read data via the decoder in 4-byte chunkscCs||_d|_dS(Ni(R_teof(RR_((s+/opt/alt/python27/lib64/python2.7/binhex.pyRs	cCs�d}|}x�|dkr�|jr(|S|ddd}|jj|�}xfytj|�\}|_PWntjk
r�nX|jjd�}|s�td�n||}qOW||}|t|�}|r|jrtd�qqW|S(s&Read at least wtd bytes (or until EOF)R-iiiiisPremature EOF on binhex file(RaR_R$R5ta2b_hqxt
IncompleteRR4(RttotalwtdtdecdatatwtdR)t
decdatacurtnewdata((s+/opt/alt/python27/lib64/python2.7/binhex.pyR$s.		
cCs|jj�dS(N(R_R'(R((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'?s(RRR=RR$R'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyR`s		"t_RledecoderenginecBs2eZdZd�Zd�Zd�Zd�ZRS(sRead data via the RLE-codercCs(||_d|_d|_d|_dS(NR-i(R_t
pre_buffertpost_bufferRa(RR_((s+/opt/alt/python27/lib64/python2.7/binhex.pyREs			cCsS|t|j�kr2|j|t|j��n|j| }|j||_|S(N(R4Rkt_fill(RRftrv((s+/opt/alt/python27/lib64/python2.7/binhex.pyR$Ks

cCs$|j|jj|d�|_|jjrU|jtj|j�|_d|_dSt|j�}|jdtdtkr�|d}nd|jdtkr�|d}nD|jdtdkr�|d}n |jdtkr�n
|d	}|jtj|j| �|_|j||_dS(
NiR-i����sii����ii����i(	RjR_R$RaRkR5t
rledecode_hqxR4tRUNCHAR(RRftmark((s+/opt/alt/python27/lib64/python2.7/binhex.pyRlRs& 	




cCs|jj�dS(N(R_R'(R((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'us(RRR=RR$RlR'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyRiBs
			#tHexBincBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs�t|�td�kr't|�}nxb|jd�}|sKtd�n|dkr]q*n|dkrmPn|dkr*|j�}q*q*Wt|�}t|�|_d|_|j	�dS(NR-isNo binhex data founds
R"s
i(
RDR
R$RtreadlineR`RiR_REt_readheader(RR_tchtdummythqxifp((s+/opt/alt/python27/lib64/python2.7/binhex.pyRys 	cCs.|jj|�}tj||j�|_|S(N(R_R$R5RXRE(RR4R)((s+/opt/alt/python27/lib64/python2.7/binhex.pyt_read�scCsktjd|jjd��dd@}|jd@|_||jkr^td|j|f�nd|_dS(Ns>hiii��sCRC error, computed %x, read %x(RNtunpackR_R$RER(Rtfilecrc((s+/opt/alt/python27/lib64/python2.7/binhex.pyt	_checkcrc�s&cCs�|jd�}|jt|��}|jd�}|j�|dd!}|dd!}tjd|dd!�d}tjd	|dd
!�d|_tjd	|d
d!�d|_||_t�|_||j_	||j_
||j_t|_
dS(Niiiii	s>hiis>liiii	iii(RwR&RzRNRxRRtFNameRRRRRHRI(RR4tfnametrestRDtcreatortflags((s+/opt/alt/python27/lib64/python2.7/binhex.pyRs�s


  	cGs�|jtkrtd�n|r@|d}t||j�}n	|j}d}x3t|�|kr�||j|t|��}qRW|j||_|S(NsRead data at wrong timeiR-(RIRHRtminRR4Rw(RtnRm((s+/opt/alt/python27/lib64/python2.7/binhex.pyR$�s
	!cCsP|jtkrtd�n|jr9|j|j�}n|j�t|_dS(Nsclose_data at wrong time(RIRHRRRwRzRZ(RRu((s+/opt/alt/python27/lib64/python2.7/binhex.pyR[�s	
cGs�|jtkr|j�n|jtkr7td�n|r\|d}t||j�}n	|j}|j||_|j|�S(Ns Read resource data at wrong timei(RIRHR[RZRR�RRw(RR�((s+/opt/alt/python27/lib64/python2.7/binhex.pyt	read_rsrc�s

	cCs]|jdkrdSz,|jr4|j|j�}n|j�Wdd|_|jj�XdS(N(RIRFRR�RzR_R'(RRu((s+/opt/alt/python27/lib64/python2.7/binhex.pyR'�s		(
RRRRwRzRsR$R[R�R'(((s+/opt/alt/python27/lib64/python2.7/binhex.pyRqxs			
				
cCs�t|�}|j}|s'|j}nt|d�}x*|jd�}|sRPn|j|�q9W|j�|j�|jd�}|r�t	|d�}|j|�x*|jd�}|s�Pn|j|�q�W|j�n|j�dS(s0(infilename, outfilename) - Decode binhexed filetwbi�N(
RqRR{R
R$R.R'R[R�R(R]R^R_RR0RS((s+/opt/alt/python27/lib64/python2.7/binhex.pyR�s.	



cCsDtjd}t||d�t|d|d�tjd�dS(Nis.hqxs.viahqx(tsystargvRRtexit(R|((s+/opt/alt/python27/lib64/python2.7/binhex.pyt_test�s
t__main__((((((((( R=R�R
RNR5t__all__t	ExceptionRRHRZR?R2RMRotCarbon.FileRRtMacOSRRRtImportErrorR/R>RBRR`RiRqRR�R(((s+/opt/alt/python27/lib64/python2.7/binhex.pyt<module>s>	

	
'S	,6j		

Hacked By AnonymousFox1.0, Coded By AnonymousFox