\d:bdZddlZddlZddlZddlZgdZiZdZd dZd dZ d dZ d dZ d Z dS) 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 lazycachec8tdS)zClear the cache entirely.N)cacheclear7J:\tools\MySQL Workbench 8.0 CE\python\Lib\linecache.pyrrs KKMMMMMr cvt||}d|cxkrt|krnn ||dz SdS)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 rrsO X~ . .EF    c%jj     VaZ  2r c|tvr3t|}t|dkrt|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$sx5h u::???1% %8^444   sAA+*A+c|'tt}n|tvr|g}ndS|D]}t|}t|dkr#|\}}}}|- t j|}n+#t $rt|dYjwxYw||jks ||j krt|ddS)zUDiscard cache entries that are out of date. (This is not checked upon each call!)Nr) listrkeysrosstatOSErrorpopst_sizest_mtime)r filenamesrsizemtimerfullnamers r rr4s&& U  J &&h u::?? ',$eUH =  78$$DD    IIh % % % H  4<  5DM#9#9 IIh % % %&&s)A>>%B&%B&c|tvr9tt|dkrt|d|r*|dr|drgS|} t j|}n<#t$r.|}t||r t|d}|gcYSt|dd| D|ft|<t|dcYS#ttf$rYnwxYwt j |rgcYStj D]a} t j ||}n#tt f$rY7wxYw t j|}n#t$rY^wxYwgcYSYnwxYw t#j|5}|}dddn #1swxYwYn#tt(t*f$rgcYSwxYw|r+|dd s|dxxd z cc<|j|j} } | | ||ft|<|S) 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<>rcg|]}|dzS) r ).0lines r zupdatecache..ps???TTD[???r rr,)rrr! startswithendswithrrr r splitlines ImportErrorpathisabssysjoin TypeErrorAttributeErrortokenizeopen readlinesUnicodeDecodeError SyntaxErrorr"r#) rrr'rbasenamedatadirnamefprr%r&s r rrPs 5 uX  1 $ $ IIh % % % ++C00X5F5Fs5K5K H*wx   ((( X~ . . * *Xq)++<IIIII??T__->->??? #h Xq)))) )    " 7== " " IIIx  G 7<<::~.     wx((    III I(R ]8 $ $ #LLNNE # # # # # # # # # # # # # # # ' 5  U2Y''-- b T , %DE5(2E(O Ls4B G(DGA GD(%G'D(($GG E>=G>FGFGF,*G, F96G8F99GGHG<0 H<HHHHH$#H$c|tvr"tt|dkrdSdS|r*|dr|drdS|rd|vr|d}|dx}0|d x}r |j}n#t $rYnwxYwt|d d}|r$|r"tj ||}|ft|<dSdS) 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__ __loader__N__spec__ get_source) rrr1r2getloaderr:getattr functoolspartial)rrnamerJspecrH get_liness r rrs,5 uX  1 $ $45 ++C00X5F5Fs5K5Ku *66j)$((66 6F ?%))*555t ![FF%DV\488  J !)*d;;I(lE(O4 5sB B,+B,)N) __doc__rLr7rr;__all__rrrrrrrr r r rSs  > > >       &&&&8@@@@F#####r