U e5d��@sndZddlZddlZddlZddlZdddgZddd�Ziadd�Zddd �Z dd d�Z dd d �Z d d�Z dS)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� checkcachecCs:t||�}d|kr"t|�kr2nn ||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r �!/usr/lib64/python3.8/linecache.pyrs  cCsiadS)zClear the cache entirely.N)�cacher r r rrscCsX|tkr(t|}t|�dkr(t|dSz t||�WStk rRt�gYSXdS)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)rr� updatecache� MemoryErrorr)r r �entryr r rr%s   rc Cs�|dkrtt���}n|tkr&|g}ndS|D]�}t|}t|�dkrHq.|\}}}}|dkr^q.zt�|�}Wn$tk r�t�|d�Yq.YnX||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 �fullnamerr r rr5s&    c Cs�|tkr$tt|�dkr$t�|d�|r<|�d�r@|�d�r@gS|}zt�|�}W�ntk �rn|}t||�r�zt|d�}Wnt tfk r�YnDX|dkr�gYSt|�ddd�|� �D�|ft|<t|dYStj � |�r�gYSt j D]d}ztj �||�}Wnttfk �r0Yq�YnXzt�|�}W�qjWq�tk �r^Yq�Xq�gYSYnXz"t�|��}|��}W5QRXWntk �r�gYSX|�r�|d �d ��s�|d d 7<|j|j} } | | ||ft|<|S) z�Update 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.rN�<�>rcSsg|] }|d�qS)� r )�.0�liner r r� qszupdatecache..r�����r")rrr� startswith�endswithrrr� lazycache� ImportError� splitlines�path�isabs�sys�join� TypeError�AttributeError�tokenize�open� readlinesrr) r r rr�basename�data�dirname�fpr rrr r rrRs\  �       rcCs�|tkr tt|�dkrdSdS|r8|�d�r<|�d�rr.rr2�__all__rrrrrrr)r r r r�s     A