Hacked By AnonymousFox

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

�
�fc@s�dZdZddlZddlZddlZddlZddlZdadada	e
add�Z
d�Zd�Zd�Zd	�Zd
d�Zddd
��YZd�Zedkr�e�ndS(sAreindent [-d][-r][-v] [ path ... ]

-d (--dryrun)   Dry run.   Analyze, but don't make any changes to, files.
-r (--recurse)  Recurse.   Search for all .py files in subdirectories too.
-n (--nobackup) No backup. Does not make a ".bak" file before reindenting.
-v (--verbose)  Verbose.   Print informative msgs; else no output.
-h (--help)     Help.      Print this usage information and exit.

Change Python (.py) files to use 4-space indents and no hard tab characters.
Also trim excess spaces and tabs from ends of lines, and remove empty lines
at the end of files.  Also ensure the last line ends with a newline.

If no paths are given on the command line, reindent operates as a filter,
reading a single source file from standard input and writing the transformed
source to standard output.  In this case, the -d, -r and -v flags are
ignored.

You can pass one or more file and/or directory paths.  When a directory
path, all .py files within the directory will be examined, and, if the -r
option is given, likewise recursively for subdirectories.

If output is not to standard output, reindent overwrites files in place,
renaming the originals with a .bak extension.  If it finds nothing to
change, the file is left alone.  If reindent does change a file, the changed
file is a fixed-point for future runs (i.e., running reindent on the
resulting .py file won't change it again).

The hard part of reindenting is figuring out what to do with comment
lines.  So long as the input files get a clean bill of health from
tabnanny.py, reindent should do a good job.

The backup file is a copy of the one that is being reindented. The ".bak"
file is generated with shutil.copy(), but some corner cases regarding
user/group and permissions could leave the backup file more readable than
you'd prefer. You can always use the --nobackup option to prevent this.
t1i����NicCs-|dk	rtj|IJntjtIJdS(N(tNonetsyststderrt__doc__(tmsg((s./usr/lib64/python2.7/Tools/scripts/reindent.pytusage6scGsKd}x.|D]&}tjj|t|��d}q
Wtjjd�dS(Ntt s
(RRtwritetstr(targstseptarg((s./usr/lib64/python2.7/Tools/scripts/reindent.pyterrprint;s


cCsEddl}y5|jtjdddddddg�\}}Wn!|jk
rd}t|�dSXx�|D]�\}}|dkr�td7aql|dkr�td7aql|dkr�taql|dkr�t	d7a	ql|dkrlt�dSqlW|s&t
tj�}|j�|j
tj�dSx|D]}t|�q-WdS(Ni����itdrnvhtdryruntrecursetnobackuptverbosethelps-ds--dryruns-rs	--recurses-ns
--nobackups-vs	--verboses-hs--help(s-ds--dryrun(s-rs	--recurse(s-ns
--nobackup(s-vs	--verbose(s-hs--help(tgetoptRtargvterrorRRRtFalset
makebackupRt
ReindentertstdintrunR	tstdouttcheck(RtoptsRRtotatrR
((s./usr/lib64/python2.7/Tools/scripts/reindent.pytmainBs4"


	


c	Cs6tjj|�r�tjj|�r�tr7dG|GHntj|�}x�|D]�}tjj||�}tr�tjj|�r�tjj|�r�tjj|�dj	d�s�|j
�jd�rMt|�qMqMWdStr�dG|GdGnyt
|d�}Wn.tk
r5}td|t|�f�dSXt|�}|j�|j}t|t�rvtd	|�dS|j�r tr�d
GHtr�dGHq�nts|d}tr�tj||�tr�d
G|GdG|GHq�nt
|d�}|j|�|j�trdG|GHqntStr.dGHntSdS(Nslisting directoryit.s.pytcheckings...trbs%s: I/O Error: %ss0%s: mixed newlines detected; cannot process fileschanged.s+But this is a dry run, so leaving it alone.s.baks	backed upttotwbs	wrote news
unchanged.(tostpathtisdirtislinkRtlistdirtjoinRtsplitt
startswithtlowertendswithRtopentIOErrorRR
Rtclosetnewlinest
isinstancettupleRRRtshutiltcopyfileR	tTrueR(	tfiletnamestnametfullnametfRR"tnewlinetbak((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_sZ%
 
	


cCsWd�|D�}|jd�tt|��}|s9dSt|�dkrS|dS|S(NcSsXh|]N}|ddkr"dn/|ddkr8dn|ddkrNdnd�qS(i����s
i����s
s
R((t.0tline((s./usr/lib64/python2.7/Tools/scripts/reindent.pys	<setcomp>�s	Rs
ii(tdiscardR8tsortedtlen(tlinesR6((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_detect_newlines�s

s
 	cCsEt|�}x.|dkr<||d|kr<|d8}qW|| S(sReturn line stripped of trailing spaces, tabs, newlines.

    Note that line.rstrip() instead also strips sundry control characters,
    but at least one known Emacs user expects to keep junk like that, not
    mentioning Barry by name or anything <wink>.
    ii(RG(RDtJUNKti((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_rstrip�s#RcBsSeZd�Zd�Zd�Zd�Zejejej	ej
ejd�ZRS(cCs�d|_d|_|j�|_t|j�|_t|jt�rX|jd|_n|j|_g|jD]}t	|�j
�|j^qn|_|jjdd�d|_g|_dS(Nii(t	find_stmttlevelt	readlinestrawRIR6R7R8RARLt
expandtabsRHtinsertRtindextstats(tselfR@RD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt__init__�s		/	cCstj|j|j�|j}x'|rH|d|jkrH|j�q"W|j}|jt|�df�i}g}|_	|dd}|j
|d|!�xftt|�d�D]N}||\}}||dd}t||�}	|d}
|
dkr.|	r%|j
|	d�}
|
dkr�xkt|dt|�d�D]I}||\}}
|
dkrG|	t||�kr�|
d}
nPqGqGWn|
dkr
xgt|ddd�D]L}||\}}
|
dkr�|	t||d�t||�}
Pq�q�Wn|
dkr+|	}
q+q.d}
n|
dks@t�|
||	<|
|	}|dksl|	dkr�|j
|||!�q�x|||!D]p}|dkr�||jkr�|j|�q|jd||�q�tt|�|�}|j||�q�Wq�W|j|j	kS(Ni����iiiR(ttokenizetgetlinet
tokeneaterRHRAtpopRTtappendRGtaftertextendtranget	getlspacetgettxrangetAssertionErrortminRP(RURHRTt	have2wantR\RKtthisstmtt	thisleveltnextstmtthavetwanttjtjlinetjleveltdiffRDtremove((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR�s`		

$
	

cCs|j|j�dS(N(t
writelinesR\(RUR@((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR	scCsD|jt|j�kr!d}n|j|j}|jd7_|S(NRi(RSRGRH(RURD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRXs
	c
Cs�|\}}||kr$d|_n�||krKd|_|jd7_n�||krrd|_|jd8_nw||	kr�|jr�|jj|df�q�nF||
kr�n7|jr�d|_|r�|jj||jf�q�ndS(Nii����i(RMRNRTR[(
RUttypettokent.3tendRDtINDENTtDEDENTtNEWLINEtCOMMENTtNLtslinetscol((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRYs$						(
t__name__t
__module__RVRR	RXRWRtRuRvRwRxRY(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR�s		E		
cCsDdt|�}}x*||kr?||dkr?|d7}qW|S(NiRi(RG(RDRKtn((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_Fst__main__((Rt__version__RWR)R9RtioRRRR;RRRRR#RRIRLRR_R{(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt<module>(s&			4	
�	

Hacked By AnonymousFox1.0, Coded By AnonymousFox