ó fc@sddZddlmZddlZddlZddd„ƒYZd„Zedkr`eƒndS( s"Show file statistics by extension.iÿÿÿÿ(tprint_functionNtStatscBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs i|_dS(N(tstats(tself((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt__init__ scCs€xy|D]q}tjj|ƒr/|j|ƒqtjj|ƒrQ|j|ƒqtjjd|ƒ|j dddƒqWdS(NsCan't find %s stunknowni( tostpathtisdirtstatdirtisfiletstatfiletsyststderrtwritetaddstats(Rtargstarg((s+/usr/lib64/python2.7/Tools/scripts/byext.pytstatargss cCs|jdddƒyttj|ƒƒ}WnDtjk rr}tjjd||fƒ|jdddƒdSXx¤|D]œ}|jdƒr•qzn|j dƒrªqzntj j ||ƒ}tj j |ƒrç|jdd dƒqztj 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|ddƒyt|dƒ}WnAtk rÏ}tj j d||fƒ|j|ddƒdSX|j ƒ}|j ƒ|j|dt |ƒƒd |kr"|j|d dƒdS|s>|j|d dƒn|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