Mini Shell
a
�DOgU � @ 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&