;
Êâ"Ic               @   s|   d  Z  d d l Z d d l Z d d l Z d d d g Z d d „ Z i  a d „  Z d d „ Z	 d d	 „ Z
 d d
 „ Z d S(   uµ   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    Nu   getlineu
   clearcacheu
   checkcachec             C   sH   t  |  | ƒ } d | k o t | ƒ k n o | | d Sd Sd  S(   Ni   u    (   u   getlinesu   len(   u   filenameu   linenou   module_globalsu   lines(    (    u&   /mit/python/lib/python3.0/linecache.pyu   getline   s    $c               C   s
   i  a  d S(   u   Clear the cache entirely.N(   u   cache(    (    (    u&   /mit/python/lib/python3.0/linecache.pyu
   clearcache   s    c             C   s+   |  t  k o t  |  d St |  | ƒ Sd S(   us   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(   u   cacheu   updatecache(   u   filenameu   module_globals(    (    u&   /mit/python/lib/python3.0/linecache.pyu   getlines"   s    c          	   C   sâ   |  d k o t t j ƒ  ƒ } n |  t k o |  g } n d Sxš | D]’ }  t |  \ } } } } | d k o qH n y t j | ƒ } Wn! t j k
 o t |  =wH Yn X| | j k p | | j k o t |  =qH qH Wd S(   uU   Discard cache entries that are out of date.
    (This is not checked upon each call!)N(	   u   Noneu   listu   cacheu   keysu   osu   statu   erroru   st_sizeu   st_mtime(   u   filenameu	   filenamesu   sizeu   mtimeu   linesu   fullnameu   stat(    (    u&   /mit/python/lib/python3.0/linecache.pyu
   checkcache,   s"     	 c          &      sþ  |  t  k o t  |  =n |  p |  d |  d d k o g  S|  } y t j | ƒ } Wn­t j k
 ož} zˆt j j |  ƒ d } | oê d | k oÝ | j d ƒ } | d } t | d d ƒ } | o§ | o  | j	 | j d ƒ d d ƒ o{ y | | ƒ }	 Wn t
 t f k
 o YqoX|	 d k o g  St |	 ƒ d d	 „  |	 j ƒ  Dƒ | f t  |  <t  |  d
 Sqsqwn xy t j D]j }
 y t j j |
 | ƒ } Wn t t f k
 o YqXy t j | ƒ } PWqt j k
 o YqXqWg  SWYd d } ~ Xn Xy) t | d ƒ } | j ƒ  } | j ƒ  Wn+ t k
 o } z	 g  SWYd d } ~ Xn Xd ‰  xE | d d
 … D]3 } t j d | ƒ } | o | j d ƒ ‰  PququWy ‡  f d †  | Dƒ } Wn Yn X| j | j } } | | | | f t  |  <| S(   u”   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ÿÿÿÿu   <>i   u
   __loader__u   __name__u
   get_sourceu   .c             S   s   g  } |  ] } | | d  q
 S(   u   
(    (   u   .0u   _[1]u   line(    (    u&   /mit/python/lib/python3.0/linecache.pyu
   <listcomp>h   s    i   Nu   rUu   utf-8u   coding[:=]\s*([-\w.]+)c                s;   g  } |  ]- } | t  | t ƒ o | n t | ˆ  ƒ q
 S(    (   u
   isinstanceu   str(   u   .0u   _[1]u   line(   u   coding(    u&   /mit/python/lib/python3.0/linecache.pyu
   <listcomp>   s   (   u   cacheu   osu   statu   erroru   pathu   splitu   getu   getattru   Noneu
   startswithu   ImportErroru   IOErroru   lenu
   splitlinesu   sysu   joinu	   TypeErroru   AttributeErroru   openu	   readlinesu   closeu	   Exceptionu   reu   searchu   groupu   st_sizeu   st_mtime(   u   filenameu   module_globalsu   fullnameu   statu   msgu   basenameu   nameu   loaderu
   get_sourceu   datau   dirnameu   fpu   linesu   lineu   mu   sizeu   mtime(    (   u   codingu&   /mit/python/lib/python3.0/linecache.pyu   updatecacheE   sr    !
! 
 
 	(   u   __doc__u   sysu   osu   reu   __all__u   Noneu   getlineu   cacheu
   clearcacheu   getlinesu
   checkcacheu   updatecache(    (    (    u&   /mit/python/lib/python3.0/linecache.pyu   <module>   s   
	
