ó
fc @ 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 ƒ | | |