³ò
™›\Kc           @   sp   d  Z  d d k Z d d k Z d d d g Z d d „ Z h  a d „  Z d d „ Z d d	 „ Z	 d d
 „ Z
 d S(   sµ   Cache lines from files.

This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
iÿÿÿÿNt   getlinet
   clearcachet
   checkcachec         C   sK   t  |  | ƒ } d | j o t | ƒ j n o | | d Sn d Sd  S(   Ni   t    (   t   getlinest   len(   t   filenamet   linenot   module_globalst   lines(    (    s   /usr/lib/python2.5/linecache.pyR       s    $c           C   s
   h  a  d S(   s   Clear the cache entirely.N(   t   cache(    (    (    s   /usr/lib/python2.5/linecache.pyR      s    c         C   s.   |  t  j o t  |  d Sn t |  | ƒ Sd S(   ss   Get the lines for a file from the cache.
    Update the cache if it doesn't contain an entry for this file already.i   N(   R
   t   updatecache(   R   R   (    (    s   /usr/lib/python2.5/linecache.pyR   !   s    c         C   sÛ   |  d j o t i ƒ  } n |  t j o |  g } n d Sx™ | D]‘ }  t |  \ } } } } | d j o qB n y t i | ƒ } Wn  t i j
 o t |  =qB n X| | i j p | | i j o t |  =qB qB Wd S(   sU   Discard cache entries that are out of date.
    (This is not checked upon each call!)N(   t   NoneR
   t   keyst   ost   statt   errort   st_sizet   st_mtime(   R   t	   filenamest   sizet   mtimeR	   t   fullnameR   (    (    s   /usr/lib/python2.5/linecache.pyR   +   s"      c         C   s–  |  t  j o t  |  =n |  p |  d |  d d j o g  Sn |  } y t i | ƒ } WnÇt i j
 o¸} t i i |  ƒ d } | od | j oô | i d ƒ } | d } t | d d ƒ } | o¾ | o· | i	 | i d ƒ d d ƒ o’ y | | ƒ }	 Wn t
 t f j
 o q†X|	 d j o g  Sn t |	 ƒ d g  }
 |	 i ƒ  D] } |
 | d	 qR~
 | f t  |  <t  |  d
 SqŠqŽn | d j o
 |  } n x| t i D]h } y t i i | | ƒ } Wn t t f j
 o q¯Xy t i | ƒ } PWq¯t i j
 o q¯Xq¯Wg  Sn Xy) t | d ƒ } | i ƒ  } | i ƒ  Wn t j
 o } g  Sn X| i | i } } | | | | f t  |  <| S(   s”   Update a cache entry and return its list of lines.
    If something's wrong, print a message, discard the cache entry,
    and return an empty list.i    iÿÿÿÿs   <>i   t
   __loader__t   __name__t
   get_sourcet   .s   
i   s   __init__.pyt   rUN(   R
   R   R   R   t   patht   splitt   gett   getattrR   t
   startswitht   ImportErrort   IOErrorR   t
   splitlinest   syst   joint	   TypeErrort   AttributeErrort   opent	   readlinest   closeR   R   (   R   R   R   R   t   msgt   basenamet   namet   loaderR   t   datat   _[1]t   linet   dirnamet   fpR	   R   R   (    (    s   /usr/lib/python2.5/linecache.pyR   D   s^    !
!5

 			(   t   __doc__R$   R   t   __all__R   R    R
   R   R   R   R   (    (    (    s   /usr/lib/python2.5/linecache.pys   <module>   s   
	
