7ec @ sd d Z d d l m Z d d l Z d d l Z d d d YZ d Z e d k r` e n d S( s" Show file statistics by extension.i( t print_functionNt Statsc B s> e Z d Z d Z d Z d Z d Z d Z RS( c C s
i | _ d S( N( t stats( t self( ( s+ /usr/lib64/python2.7/Tools/scripts/byext.pyt __init__ s c C s xy | D]q } t j j | r/ | j | q t j j | rQ | j | q t j j d | | j d d d q Wd S( Ns Can't find %s
s ??>t unknowni (
t ost patht isdirt statdirt isfilet statfilet syst stderrt writet addstats( R t argst arg( ( s+ /usr/lib64/python2.7/Tools/scripts/byext.pyt statargs s
c C s | j d d d y t t j | } WnD t j k
rr } t j j d | | f | j d d d d SXx | D] } | j d r qz n | j d r qz n t j
j | | } t j
j | r | j d d d qz t j
j
| r | j | qz | j | qz Wd S(
Ns
t dirsi s Can't list %s: %s
t
unlistables .#t ~s t links( R t sortedR t listdirt errorR R
R t
startswitht endswithR t joint islinkR R R ( R t dirt namest errt namet full( ( s+ /usr/lib64/python2.7/Tools/scripts/byext.pyR s$
c
C s t j j | \ } } t j j | \ } } | | k rE d } n t j j | } | sf d } n | j | d d y t | d } WnA t k
r } t j j
d | | f | j | d d d SX| j } | j | j | d t
| d | k r"| j | d
d d S| s>| j | d d n | j } | j | d t
| ~ | j } | j | d
t
| d S( Nt s t filesi t rbs Can't open %s: %s
t
unopenablet bytess t binaryt emptyt linest words( R R t splitextt splitt normcaseR t opent IOErrorR R
R t readt closet lent
splitlines(
R t filenamet headt extt baset fR t dataR* R+ ( ( s+ /usr/lib64/python2.7/Tools/scripts/byext.pyR . s6
c C s3 | j j | i } | j | d | | |