mò ú~Ac@sadZdkZdkZdddgZd„Zhad„Zd„Zdd„Z d „Z dS( 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. Ntgetlinet clearcachet checkcachecCsHt|ƒ}d|jot|ƒjno||dSndSdS(Nit(tgetlinestfilenametlinestlinenotlen(RRR((t//mirror/zmath/src/Python-2.4.4/Lib/linecache.pyR s $cCs hadS(sClear the cache entirely.N(tcache(((R RscCs+|tjot|dSn t|ƒSdS(ssGet the lines for a file from the cache. Update the cache if it doesn't contain an entry for this file already.iN(RR t updatecache(R((R R!s cCsÇ|djotiƒ}n|tjo |g}ndSx…|D]}}t|\}}}}yt i |ƒ}Wn t i j ot|=qBnX||i jp||i jo t|=qBqBWdS(sUDiscard cache entries that are out of date. (This is not checked upon each call!)N(RtNoneR tkeyst filenamestsizetmtimeRtfullnametoststatterrortst_sizetst_mtime(RRRRRRR((R R+s     c Csw|tjo t|=n| p|d|ddjogSn|}yti|ƒ}Wn¨tij o™}tii|ƒd}x|t iD]h}ytii ||ƒ}Wnt tfj oqXyti|ƒ}PWqtij oqXqWgSnXy)t|dƒ}|iƒ}|iƒWntj o }gSnX|i|i} }| |||ft|<|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.ii˙˙˙˙s<>itrUN(RR RRRRtmsgtpathtsplittbasenametsystdirnametjoint TypeErrortAttributeErrortopentfpt readlinesRtclosetIOErrorRRRR( RR"RRRRRRRR((R R Bs>  !     ( t__doc__RRt__all__RR RRR RR (R RR'RRRRR((R t?s