ok

Mini Shell

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

�
iцdc@s�dZdZddlZddlZddlZddlZdad�Zd�Zd�Z	e
d�\ZZZ
ZZd	d
d
��YZedkr�e�ndS(s�checkappend.py -- search for multi-argument .append() calls.

Usage:  specify one or more file or directory paths:
    checkappend [-v] file_or_dir [file_or_dir] ...

Each file_or_dir is checked for multi-argument .append() calls.  When
a directory, all .py files in the directory, and recursively in its
subdirectories, are checked.

Use -v for status msgs.  Use -vv for more status msgs.

In the absence of -v, the only output is pairs of the form

    filename(linenumber):
    line containing the suspicious append

Note that this finds multi-argument append calls regardless of whether
they're attached to list objects.  If a module defines a class with an
append method that takes more than one argument, calls to that method
will be listed.

Note that this will not find multi-argument list.append calls made via a
bound method object.  For example, this is not caught:

    somelist = []
    push = somelist.append
    push(1, 2, 3)
iii����NcGs3dj|�}tjj|�tjjd�dS(Nt s
(tjointsyststderrtwrite(targstmsg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyterrprint+scCs�tjd}y#tjtjdd�\}}Wn/tjk
ra}tt|�dt�dSXx-|D]%\}}|dkritdaqiqiW|s�tt�dSx|D]}t|�q�WdS(Nitvs

s-v(	RtargvtgetoptterrorRtstrt__doc__tverbosetcheck(RtoptsRtopttoptargtarg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pytmain0s
#

cCsKtjj|�r�tjj|�r�tr:d|fGHntj|�}xq|D]i}tjj||�}tjj|�r�tjj|�s�tjj|d�dkrPt|�qPqPWdSyt	|�}Wn(t
k
r�}td||f�dSXtdkrd|fGHnt||�j
�}trG|rGd|fGHndS(Ns%r: listing directoryi����s.pys%r: I/O Error: %sischecking %r ...s%r: Clean bill of health.(tostpathtisdirtislinkRtlistdirRtnormcaseRtopentIOErrorRt
AppendCheckertrun(tfiletnamestnametfullnametfRtok((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRAs*%
iRcBsDeZd�Zd�Zejejejfejej	d�Z
RS(cCs(||_||_t|_d|_dS(Ni(tfnameRtFIND_DOTtstatetnerrors(tselfR%R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt__init__bs			cCsjytj|jj|j�Wn=tjk
r\}td|j|f�|jd|_nX|jdkS(Ns%r: Token Error: %sii(ttokenizeRtreadlinet
tokeneatert
TokenErrorRR%R((R)R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRhsc
Cs�|j}
||krn�|
tkrH||kr�|dkr�t}
q�n�|
tkr�||	kr�|dkr�||_|d|_t}
q�t}
n9|
tkr�||kr�|dkr�d|_t}
q�t}
n�|
tkr�||kr�|dkr
|jd|_q�|dkrA|jd|_|jdkr�t}
q�q�|dkr�|jdkr�|jd|_d|j	|j|jfGHt
}
q�q�n7|
t
kr�||kr�t}
q�ntd
|
f��|
|_dS(Nt.tappendit(it{t[t)t}t]t,s
%s(%d):
%ssunknown internal state '%r'(R1R2R3(R4R5R6(R'R&tFIND_APPENDtlinetlinenotFIND_LPARENtlevelt
FIND_COMMAR(R%t	FIND_STMTtSystemError(R)ttypettokentstarttendR9tNEWLINEtJUNKtOPtNAMER'((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyR-psF		
					(t__name__t
__module__R*RR+RDtCOMMENTtNLRFRGR-(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRas			t__main__(iii((R
t__version__RRR
R+RRRRtrangeR&R8R;R=R>RRH(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt<module> s			E

Zerion Mini Shell 1.0