a
´iU ã @ sl d Z ddlZddlZddlZddlZg d¢Zi Zdd„ Zddd„Zddd „Z dd
d„Z
ddd
„Zdd„ ZdS )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Ú
checkcacheÚ lazycachec C s t ¡ dS )zClear the cache entirely.N)ÚcacheÚclear© r r ú!/usr/lib64/python3.9/linecache.pyr s r c C s6 t | |ƒ}d| kr"t|ƒkr2n n||d S dS )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.é Ú )ÚgetlinesÚlen)ÚfilenameÚlinenoÚmodule_globalsÚlinesr r r r s
r c C sV | t v r(t | }t|ƒdkr(t | d S zt| |ƒW S tyP tƒ g Y S 0 dS )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.r
é N)r r
ÚupdatecacheÚMemoryErrorr )r r Úentryr r r r $ s r c C s¶ | du rt t ¡ ƒ}n| tv r&| g}ndS |D ]‚} t| }t|ƒdkrHq.|\}}}}|du r^q.zt |¡}W n" tyŽ t | d¡ Y q.Y n0 ||jks¤||j kr.t | d¡ q.dS )zUDiscard cache entries that are out of date.
(This is not checked upon each call!)Nr
)
Úlistr Úkeysr
ÚosÚstatÚOSErrorÚpopÚst_sizeÚst_mtime)r Ú filenamesr ÚsizeÚmtimer Úfullnamer r r r r 4 s&