File: //lib/python3.12/__pycache__/linecache.cpython-312.pyc
�
    )!�h  �                   �`   � d Z ddlZddlZddlZddlZg d�Zi Zd� Zd
d�Zd
d�Z	d
d�Z
d
d�Zd	� Zy)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                  �,   � t         j                  �        y)zClear the cache entirely.N)�cache�clear� �    � /usr/lib/python3.12/linecache.pyr   r      s   � �	�K�K�Mr   c                 �Z   � t        | |�      }d|cxk  rt        |�      k  rn y||dz
     S y)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�liness       r   r   r      s8   � � 
�X�~�.�E��F� �c�%�j� �
� �V�a�Z� � �
r   c                 �   � | t         v r#t         |    }t        |�      dk7  rt         |    d   S 	 t        | |�      S # t        $ r t	        �        g cY S w xY 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   �entrys      r   r   r   $   sZ   � � �5���h����u�:��?���?�1�%�%���8�^�4�4��� ����	��s   �9 �A�Ac                 �  � | �t        t        j                  �       �      }n
| t        v r| g}ny|D ]o  } t        |    }t        |�      dk(  r�|\  }}}}|��%	 t	        j
                  |�      }||j                  k7  s||j                  k7  s�Zt        j                  | d�       �q y# t        $ r t        j                  | d�       Y ��w xY w)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   s           r   r   r   4   s�   � � �������&�	�	�U�	��J�	��� &���h����u�:��?��',�$��e�U�H��=��	��7�7�8�$�D� �4�<�<��5�D�M�M�#9��I�I�h��%�&�� � 	��I�I�h��%��	�s   �B#�#C�Cc                 �  � | t         v r+t        t         |    �      dk7  rt         j                  | d�       | r"| j                  d�      r| j	                  d�      rg S | }	 t        j                  |�      }	 t#        j$                  |�      5 }|j'