Qft`dZddlZddlZddlZddlZgdZiZdZd dZd dZ d dZ d dZ d Z y) zCache 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 checkcache lazycachec,tjy)zClear the cache entirely.N)cacheclear0/opt/alt/python312/lib64/python3.12/linecache.pyrrs  KKMr cZt||}d|cxkrt|kr ny||dz Sy)z~Get a line for a Python source file from the cache. Update the cache if it doesn't contain an entry for this file already.)getlineslen)filenamelinenomodule_globalsliness r rrs8 X~ .EF c%j VaZ  r c|tvr#t|}t|dk7r t|dS t||S#t$rt gcYSwxYw)zGet the lines for a Python source file from the cache. Update the cache if it doesn't contain an entry for this file already.r)rr updatecache MemoryErrorr)rrentrys r rr$sZ5h u:??1% %8^44   s 9AAc|ttj}n |tvr|g}ny|D]o}t|}t|dk(r|\}}}}|% t j |}||jk7s||jk7sZtj|dqy#t tf$rtj|dYwxYw)zUDiscard cache entries that are out of date. (This is not checked upon each call!)Nr) listrkeysrosstatOSError ValueErrorpopst_sizest_mtime)r filenamesrsizemtimerfullnamers r rr4s& U J h u:? ',$eUH =  778$D 4<< 5DMM#9 IIh %$  IIh %  sB##%C  C c|tvr+tt|dk7rtj|d|r"|jdr|j drgS|} t j |} t%j&|5}|j)} ddd r!| dj ds | dxxdz cc<|j.|j0} } | | | |ft|<| S#t$r&|}t||ru t|d}|gcYSt|d|jDcgc]}|dz ncc}wc}|ft|<t|dcYS#ttf$rYnwxYwt jj|rgcYStjD]e} t jj||}n#tt f$rY6wxYw t j |}n#tt"f$rYcwxYwgcYSYt"$rgcYSwxYw#1swYxYw#tt*t,f$rgcYSwxYw) zUpdate 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.rN<>r r)rrr" startswithendswithrrr r splitlines ImportErrorpathisabssysjoin TypeErrorAttributeErrorr!tokenizeopen readlinesUnicodeDecodeError SyntaxErrorr#r$) rrr(rbasenamedatalinedirnamefprr&r's r rrPs> 5 uX 1 $ IIh % ++C0X5F5Fs5K H,wwx X ]]8 $LLNE% U2Y''- b T ,, %DE5(2E(O Li ( X~ . *Xq)+<II-1__->?->TTD[->? #h Xq)) )  " 77== "IxxG 77<<:~.   wwx(Z(   I   % $ ' 5 sC+3H7H*H7+H'E#H'H'7 E H'#E52H'4E55$H'H'/ GH'G"H'!G""H'&G=;H'=H H'HH' H'&H'*H4/H77IIc|tvrtt|dk(ryy|r"|jdr|jdry|r{d|vrw|j d}t |dd xs|d}t |d d }||j d }t |d d }|r#|r!t j||}|ft|<yy) aSeed the cache for filename with module_globals. The module loader will be asked for the source only when getlines is called, not immediately. If there is an entry in the cache already, it is not altered. :return: True if a lazy load is registered in the cache, otherwise False. To register such a load a module loader with a get_source method must be found, the filename must be a cacheable filename, and the filename must not be already cached. rTFr*r+__name____spec__nameNloader __loader__ get_source)rrr.r/getgetattr functoolspartial)rrspecrErFrH get_liness r rrs5 uX 1 $ ++C0X5F5Fs5K*6!!*-tVT*HnZ.Hx. >#'' 5FV\48 J!))*d;I(lE(O r )N) __doc__rKr4rr8__all__rrrrrrrr r r rQsD  >    &8BJ!r