*j@ j S r / SQr0 r0 rS rSS jrSS jrS rS rS r SS jr
SS
jrS rS r
S
rg)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.
)getline
clearcache
checkcache lazycachec , [ R 5 g)zClear the cache entirely.N)cacheclear 0/opt/alt/python313/lib64/python3.13/linecache.pyr r s KKMr
Nc Z [ X5 nSUs=:: a [ U5 :: a
O gX1S-
$ g)zzGet 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 r r s4
X.EF c%j
aZ
r
c [ R U S5 nUb [ U5 S:w a US $ [ X5 $ ! [ a [ 5 / s $ f = f)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.Nr
)r getr updatecacheMemoryErrorr )r r entrys r r r sV
IIh%ESZ1_Qx844 s
: AAc Z [ U 5 nSUs=:: a [ U5 :: a
O gX!S-
$ g)Nr
r )_getlines_from_coder )r r r s r _getline_from_coder / s2 )EF c%j
aZ
r
c H U R U R U R 4$ N)co_filenameco_qualnameco_firstlineno)codes r _make_keyr$ 5 s! d..0C0CDDr
c v [ U 5 n[ R US 5 nUb [ U5 S:w a US $ / $ )Nr
r )r$ _interactive_cacher r )r# code_idr s r r r 8 s; oG""7D1ESZ1_Qx
Ir
c U c# [ R 5 R 5 nOU /nU H n [ R U S5 nUb [ U5 S:X a M- Uu p4pVUc M7 SSKn UR U5 nX8R :w d XHR :w d Mn [ R U S5 M g! [ a gf = f! [ [ 4 a [ R U S5 M f = f)zQDiscard cache entries that are out of date.
(This is not checked upon each call!)Nr
)
r copykeysr r osImportErrorstatOSError
ValueErrorpopst_sizest_mtime) r filenamesr sizemtimer fullnamer, r. s r r r @ s JJL%%' J (D)=CJ!O',$U= 778$D <<5MM#9IIh%' $ IIh% s$ $B5)C5
CC&C0/C0c SSK nSSKnSSKn[ R U S5 nU ( a, U R
S5 ( a U R S5 ( a / $ U n UR U5 n UR' U5 n
U
R) 5 nSSS5 W( d S/nO&US R S5 ( d
US== S-
ss' UR. UR0 nnUUX4[ U ' U$ ! [ a / s $ f = f! [ Ga3 U nUb [ U5 S:X a UOSn U c [ X5 n U bn U S " 5 n
U
c / s $ [ U
5 SU
R 5 Vs/ s H oS- PM Os snf snU4nU[ U ' US s $ ! [ [ 4 a Of = fUR R U 5 ( a / s $ UR Hc n UR R X5 nO! [ [" 4 a M3 f = f UR U5 n GM ! [ [$ 4 a Ma f = f / s $ [$ a / s $ f = f! , ( d f GN= f! [ [* [, 4 a / s $ f = f) 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.r) N<>r
r )r, systokenizer- r r1
startswithendswithr. r/ r _make_lazycache_entry
splitlinespathisabsjoin TypeErrorAttributeErrorr0 open readlinesUnicodeDecodeErrorSyntaxErrorr2 r3 )r r r, r= r> r r7 r. basename
lazy_entrydatalinedirnamefpr r5 r6 s r r r ` sl
IIh%E++C00X5F5Fs5K5K H0wwx `
]]8
$LLNE %
2Y
%
%
b T ,,
%DE52E(OLK , $/CJ!OU
.xHJ!
!!} < II-1__->?->TD[->? #(hQx )
$ 77==""IxxG
77<<:~.
wwx(Z(
I %
$'5 s C/ D .I! ?II! /C>=C>4I6
F
II$E3
2I
F IF %IIG32I3HIHIH!I!H51I4H55I>II
II! I! !I;:I;c [ R U S5 nUb [ U5 S:H $ [ X5 nUb
U[ U ' gg)a Seed 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.
Nr
TF)r r r rA )r r r rM s r r r sG
IIh%E5zQ&x@J$hr
c l ^ U ( a, U R S5 ( a U R S5 ( a g U( ax SU; ar UR S5 n[ USS 5 =( d US n[ USS 5 nUc UR S5 n[ USS 5 mU( a T( a U4U4S jjnU4$ g )
Nr9 r: __name____spec__nameloader
__loader__
get_sourcec > T" U /UQ70 UD6$ r r )rV argskwargsrY s r get_lines(_make_lazycache_entry.