7ec@sddZddlmZddlZddlZdddYZdZedkr`endS( s"Show file statistics by extension.i(tprint_functionNtStatscBs>eZdZdZdZdZdZdZRS(cCs i|_dS(N(tstats(tself((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt__init__ scCsxy|D]q}tjj|r/|j|qtjj|rQ|j|qtjjd||j dddqWdS(NsCan't find %s stunknowni( tostpathtisdirtstatdirtisfiletstatfiletsyststderrtwritetaddstats(Rtargstarg((s+/usr/lib64/python2.7/Tools/scripts/byext.pytstatargss cCs|jdddyttj|}WnDtjk rr}tjjd||f|jddddSXx|D]}|jdrqzn|j drqzntj j ||}tj j |r|jdd dqztj j |r |j|qz|j|qzWdS( NstdirsisCan't list %s: %s t unlistables.#t~stlinks(RtsortedRtlistdirterrorR R Rt startswithtendswithRtjointislinkRR R (Rtdirtnamesterrtnametfull((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR s$ c Cstjj|\}}tjj|\}}||krEd}ntjj|}|sfd}n|j|ddyt|d}WnAtk r}tj j d||f|j|dddSX|j }|j |j|dt |d |kr"|j|d ddS|s>|j|d dn|j}|j|d t |~|j} |j|d t | dS(NtstfilesitrbsCan't open %s: %s t unopenabletbytesstbinarytemptytlinestwords(RRtsplitexttsplittnormcaseRtopentIOErrorR R Rtreadtclosetlent splitlines( RtfilenametheadtexttbasetfR tdataR*R+((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR .s6        cCs3|jj|i}|j|d|||s  o