Hacked By AnonymousFox

Current Path : /proc/thread-self/root/usr/lib64/python2.7/Tools/scripts/
Upload File :
Current File : //proc/thread-self/root/usr/lib64/python2.7/Tools/scripts/pindent.pyc

�
�fc@s�ddlmZdZdZeZddlZddlZddlZiZ	d e	d<e	d<d!e	d<e	d	<d"e	d<d#e	d
<de	d<e	d<e	d
<e	d<e	d<d$e	d<d%Z
dd&d��YZejej
eeed�Zejej
eeed�Zejej
eeed�Zeeed�Zeeed�Zeeed�Zd�Zeeed�Zeeed�Zeeed�Zde�Zd�Zd�Zedkr�e�ndS('i����(tprint_functioniNteliftelsetendtiftwhiletfortexcepttfinallyttrytwithtdeftclasstPythonIndentercBsneZejejeeed�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�ZRS(	cCs|||_||_||_||_d|_||_|j|_tj	d�|_
tj	d�|_tj	d�|_dS(NisC^(?:\s|\\\n)*(?P<kw>[a-z]+)((?:\s|\\\n)+(?P<id>[a-zA-Z_]\w*))?[^\w]sE^(?:\s|\\\n)*#?\s*end\s+(?P<kw>[a-z]+)(\s+(?P<id>[a-zA-Z_]\w*))?[^\w]s^[ \t]*(
tfpitfpot
indentsizettabsizetlinenot
expandtabstwritet_writetretcompiletkwprogtendprogtwsprog(tselfRRRRR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt__init__fs						cCs6|jr%|j|j|j��n
|j|�dS(N(RRR(Rtline((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRzs	cCs+|jj�}|r'|jd7_n|S(Ni(RtreadlineR(RR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyR�scGsE|r||}ntjjd|j|f�|jd|�dS(NsError at line %d: %s
s### %s ###
(tsyststderrRR(Rtfmttargs((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyterror�s
cCsG|j�}x4|ddkrB|j�}|s5Pn||7}qW|S(Ni����s\
(R(RRtline2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytgetline�scCs{t||j|j�\}}|jj|�j�}||}|d dkrjd|d||}n|j|�dS(Nis
s
ts	t (s
s
R&(tdivmodRRRtmatchRR(RRtindentttabstspacesti((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytputline�s
cCs�g}xutr}|j�}|s%Pn|jj|�}|r�d}|jd�}|sh|jd�n&|j�d|kr�|jd�n|j|t|��q	n|j	j|�}|rd|jd�}|t
kr|j|t|��|j||f�q	ntj
|�rd|rd|j|t|�d�|d\}}||f|d<q	qdn|j|t|��q	W|r�|jd�x(|D]\}}|jd	|�q�WndS(
NRtkwsunexpected endis
unmatched endii����sunterminated keywordss	%s
(tTrueR%RR)tgroupR#tpopR.tlenRtstarttappendtnextthas_keyR(RtstackRtmR/tkw2tkwatkwb((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat�s@		
cCs�d}d}x�tr�|j�}|s+Pn|jj|�}|rS|d7}qn|jj|�}|r�|jd�}|tkr�|d7}q�n|j|�qW||dkr�tj	jd�n#||dkr�tj	jd�ndS(NiiR/s5Warning: input contained more end tags than expected
s5Warning: input contained less end tags than expected
(
R0R%RR)RR1R4RRR (Rt
begin_countertend_counterRR9R/((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytdelete�s(	
cCs\g}g}d}}}}}x3trW|j�}|jj|�j�}	|jj|�}
|
r�d}|
jd�}|
jd�}n�|jj|�}
|
r�|
jd�}tj	|�s�d}n|d
kr�|
jd�}q$d}n0||	|	d!dkr|j
|�q%nd}||	 }
t|
j|j
��}t|j|j
��}x�||kr�|r�|r�d
||f}n
d|}|j||�d}}n|j�\}}}}t|j|j
��}qaW||kr�|r�|dkr/||kr"|jd�nd}}q�|sB|tkr�|r[d
||f}n
d|}|j||�d}}}q�n||kr�|j
||||f�|r�|tkr�d}n|
|||f\}}}}n|r|tkr|}}|}q|}nx|D]}|j|�q Wg}|sGPn|j|�q%WdS(NR&RR/tidRRis
t#s# end %s %s
s	# end %s
smismatched end(RR(s
RB(R0R%RR)RRR1RR6R7R5R3RRRR2R#R4(RR8ttodot	currentwstthisidtfirstkwtlastkwttopidRR-R9tthiskwtendkwtindentwsR*tcurrenttstl((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete�s�			





	!
		
(t__name__t
__module__RtstdintstdouttSTEPSIZEtTABSIZEt
EXPANDTABSRRRR#R%R.R=R@RO(((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyR
ds					
	+	cCs&t|||||�}|j�dS(N(R
RO(tinputtoutputtstepsizeRRtpi((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete_filterMscCs&t|||||�}|j�dS(N(R
R@(RWRXRYRRRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
delete_filterSscCs&t|||||�}|j�dS(N(R
R=(RWRXRYRRRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat_filterYscCsGtj|�}tj�}t|||||�}|j�|j�S(N(tiotBytesIOR
ROtgetvalue(tsourceRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete_string_s

cCsGtj|�}tj�}t|||||�}|j�|j�S(N(R^R_R
R@R`(RaRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
delete_stringgs

cCsGtj|�}tj�}t|||||�}|j�|j�S(N(R^R_R
R=R`(RaRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat_stringos

cCs�ddl}ddl}|d}|jj|�ryy|j|�Wqy|jk
rutd|fdtj�qyXny|j	||�Wn1|jk
r�td||fdtj�nXdS(Ni����t~sCan't remove backup %rtfilesCan't rename %r to %r(
tostos.pathtpathtlexiststremoveR#tprintRR trename(tfilenameRgtbackup((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytmake_backupws
!cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(Ntritwi(topentreadRbRpR(RnRYRRtfRatresult((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
complete_file�s
cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(NRqiRri(RsRtRcRpR(RnRYRRRuRaRv((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytdelete_file�s
cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(NRqiRri(RsRtRdRpR(RnRYRRRuRaRv((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
reformat_file�s
sG
usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
-c         : complete a correctly indented program (add #end directives)
-d         : delete #end directives
-r         : reformat a completed program (use #end directives)
-s stepsize: indentation step (default %(STEPSIZE)d)
-t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
-e         : expand TABs into spaces (default OFF)
[file] ... : files are changed in place, with backups in file~
If no files are specified or a single - is given,
the program acts as a filter (reads stdin, writes stdout).
cCsEtjjd|d|dd�tjjt�tjd�dS(Ns Error: You can not specify both s and -is at the same time
i(RR Rtusagetexit(top1top2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
error_both�s$cCs'ddl}y#|jtjdd�\}}WnG|jk
rx}tjjd|�tjjt�tjd�nXd}t	}t
}t}x�|D]�\}}	|dkr�|r�t||�nd}q�|dkr�|r�t||�nd	}q�|d
kr%|rt||�nd}q�|dkr@t
|	�}q�|d
kr[t
|	�}q�|dkr�t}q�q�W|s�tjjd�tjjt�tjd�n|s�|dgkr�t|d�}|tjtj|||�n4t|d�}x!|D]}
||
|||�qWdS(Ni����iscdrs:t:es
Error: %s
is-cROs-dR@s-rR=s-ss-ts-es7You must specify -c(omplete), -d(elete) or -r(eformat)
t-t_filtert_file(tgetoptRtargvR#R RRzR{tNoneRTRURVR~tintR0tevalRRRS(R�toptsR"tmsgtactionRYRRtotaRn((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyttest�sR#			
	
t__main__(RRR(RR(RR(RRRR((RRRR	R
RR((t
__future__RRTRUtFalseRVR^RRR6R4R
RRRSR[R\R]RbRcRdRpRwRxRytvarsRzR~R�RP(((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt<module>OsB

*
�	
		3

Hacked By AnonymousFox1.0, Coded By AnonymousFox