mς
­fIc           @   s   d  Z  d k Z e i d e  [ d k Z d k Td d d d d d	 d
 g Z h  Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d S(   sy   Maintain a cache of stat() information on files.

There are functions to reset the cache or to selectively remove items.
Ns9   The statcache module is obsolete.  Use os.stat() instead.(   t   *t   statt   resett   forgett   forget_prefixt
   forget_dirt   forget_except_prefixt   isdirc         C   s>   t  i |  d  } | d j o t i |   t  |  <} n | S(   s'   Stat a file, possibly out of the cache.N(   t   cachet   gett   patht   Nonet   rett   _osR   (   R
   R   (    (    t&   /mit/python/lib/python2.4/statcache.pyR      s
     c           C   s   t  i   d S(   s   Clear the cache.N(   R   t   clear(    (    (    R   R      s     c         C   s%   y t  |  =Wn t j
 o n Xd S(   s1   Remove a given item from the cache, if it exists.N(   R   R
   t   KeyError(   R
   (    (    R   R   $   s
     c         C   s9   x2 t  i   D]$ } | i |   o t |  q q Wd S(   s)   Remove all pathnames with a given prefix.N(   R   t   keysR
   t
   startswitht   prefixR   (   R   R
   (    (    R   R   +   s
      c         C   s   d k  l } l } | | |  d   d }  t |   xI t i   D]; } | i |   o% | |  d |  j o t |  qC qC Wd S(   sA   Forget a directory and all entries except for entries in subdirs.(   s   splits   joint   xxxi    N(	   t   os.patht   splitt   joinR   R   R   R   R
   R   (   R   R   R   R
   (    (    R   R   1   s     
 'c         C   s9   x2 t  i   D]$ } | i |   p t |  q q Wd S(   sk   Remove all pathnames except with a given prefix.

    Normally used with prefix = '/' after a chdir().
    N(   R   R   R
   R   R   R   (   R   R
   (    (    R   R   B   s
      c         C   s:   y t  |   } Wn t i j
 o t Sn Xt | i  S(   s%   Return True if directory, else False.N(   R   R
   t   stR   t   errort   Falset   S_ISDIRt   st_mode(   R
   R   (    (    R   R   L   s     	(   t   __doc__t   warningst   warnt   DeprecationWarningt   osR   R   t   __all__R   R   R   R   R   R   R   (   R   R   R   R   R"   R   R   R   R   R   R   (    (    R   t   ?   s   									
