Hacked By AnonymousFox
�
�fc @ s� d Z d Z d d l Z d d l Z d d l Z d d l Z d a d � Z d � Z d � Z e
d � \ Z Z Z
Z Z d d
d
� � YZ e d k r� e � n d S( 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)
i i i����Nc G s3 d j | � } t j j | � t j j d � d S( Nt s
( t joint syst stderrt write( t argst msg( ( s1 /usr/lib64/python2.7/Tools/scripts/checkappend.pyt errprint+ s c C s� t j d } y# t j t j d d � \ } } Wn/ t j k
ra } t t | � d t � d SXx- | D]% \ } } | d k ri t d a qi qi W| s� t t � d Sx | D] } t | � q� Wd S( Ni t vs
s -v( R t argvt getoptt errorR t strt __doc__t verboset check( R t optsR t optt optargt arg( ( s1 /usr/lib64/python2.7/Tools/scripts/checkappend.pyt main0 s
#
c C sK t j j | � r� t j j | � r� t r: d | f GHn t j | � } xq | D]i } t j j | | � } t j j | � r� t j j | � s� t j j | d � d k rP t | � qP qP Wd Sy t | � } Wn( t
k
r� } t d | | f � d SXt d k rd | f GHn t | | � j
� } t rG| rGd | f GHn d S( Ns %r: listing directoryi����s .pys %r: I/O Error: %si s checking %r ...s %r: Clean bill of health.( t ost patht isdirt islinkR t listdirR t normcaseR t opent IOErrorR t
AppendCheckert run( t filet namest namet fullnamet fR t ok( ( s1 /usr/lib64/python2.7/Tools/scripts/checkappend.pyR A s* %
i R c B sD e Z d � Z d � Z e j e j e j f e j e j d � Z
RS( c C s( | | _ | | _ t | _ d | _ d S( Ni ( t fnameR t FIND_DOTt statet nerrors( t selfR% R ( ( s1 /usr/lib64/python2.7/Tools/scripts/checkappend.pyt __init__b s c C sj y t j | j j | j � Wn= t j k
r\ } t d | j | f � | j d | _ n X| j d k S( Ns %r: Token Error: %si i ( t tokenizeR t readlinet
tokeneatert
TokenErrorR R% R( ( R) R ( ( s1 /usr/lib64/python2.7/Tools/scripts/checkappend.pyR h s c
C s� | j }
| | k r n�|
t k rH | | k r�| d k r�t }
q�n�|
t k r� | | k r� | d k r� | | _ | d | _ t }
q�t }
n9|
t k r� | | k r� | d k r� d | _ t }
q�t }
n� |
t k r�| | k r�| d k r
| j d | _ q�| d k rA| j d | _ | j d k r�t }
q�q�| d k r�| j d k r�| j d | _ d | j | j | j f GHt
}
q�q�n7 |
t
k r�| | k r�t }
q�n t d
|
f � � |
| _ d S( Nt .t appendi t (i t {t [t )t }t ]t ,s
%s(%d):
%ss unknown internal state '%r'( R1 R2 R3 ( R4 R5 R6 ( R'