î
e fq ã @ s‹ d Z d d l Z d d l Z d d l Z d d d g Z d d d „ Z i a d d „ Z d d d „ Z d d
d „ Z d d d „ Z
d S)
zÃCache lines from Python source 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.
é NÚgetlineÚ
clearcacheÚ
checkcachec C sE t | | ƒ } d | k o, t | ƒ k n r= | | d Sd Sd S)Né Ú )ÚgetlinesÚlen)ÚfilenameÚlinenoÚmodule_globalsÚlines© r
ú./opt/alt/python34/lib64/python3.4/linecache.pyr s "c C s
i a d S)zClear the cache entirely.N)Úcacher
r
r
r r s c C sM | t k r t | d Sy t | | ƒ SWn t k
rH t ƒ g SYn Xd S)z�Get the lines for a Python source file from the cache.
Update the cache if it doesn't contain an entry for this file already.é N)r ÚupdatecacheÚMemoryErrorr )r r r
r
r r " s
r c C sÔ | d k r! t t j ƒ ƒ } n | t k r9 | g } n d Sx� | D]ˆ } t | \ } } } } | d k rr qD n y t j | ƒ } Wn t k
r£ t | =wD Yn X| | j k s | | j k rD t | =qD qD Wd S)zUDiscard cache entries that are out of date.
(This is not checked upon each call!)N)Úlistr ÚkeysÚosÚstatÚOSErrorÚst_sizeÚst_mtime)r Ú filenamesÚsizeÚmtimer Úfullnamer r
r
r r 0 s
c " C s_ | t k r t | =n | s; | j d ƒ r? | j d ƒ r? g S| } y t j | ƒ } Wnkt k
rÅ| } | r3d | k r3| j d ƒ } | d } t | d d ƒ } | r3| r3y | | ƒ } Wn t t f k
rá Yq0X| d k rò g St | ƒ d d d „ | j
ƒ Dƒ | f t |