File: //lib/python3.10/__pycache__/linecache.cpython-310.pyc
o
    E�h:  �                   @   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/lib/python3.10/linecache.pyr      s   r   c                 C   s8   t | |�}d|  krt|�krn dS ||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   sR   | t v rt |  }t|�dkrt |  d S zt| |�W S  ty(   t�  g  Y S w )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
   �   )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|�dkr$q|\}}}}|du r/qzt�|�}W n tyE   t�| d� Y qw ||jksP||j	krVt�| d� qdS )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,   ���r   c              
   C   s�  | t v rtt |  �dkrt �| d� | r| �d�r | �d�r g S | }zt�|�}W n� ty�   | }t| |�rmz	t |  d � }W n t	tfyK   Y n"w |du rTg  Y S t|�ddd� |�
� D �|ft | <