� !A?h��b�dZddlZddlZddlZddlZgd�ZiZd�Zd d�Zd d�Z d d�Z d d�Z 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� checkcache� lazycachec�8�t���dS)zClear the cache entirely.N)�cache�clear���6/opt/alt/python-internal/lib64/python3.11/linecache.pyrrs�� �K�K�M�M�M�M�Mr c�v�t||��}d|cxkrt|��krnn ||dz SdS)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 rrsO�� �X�~� .� .�E��F� � � � �c�%�j�j� � � � � ��V�a�Z� � � �2r c���|tvr3t|}t|��dkrt|dS t||��S#t$rt ��gcYSwxYw)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�)rr� updatecache� MemoryErrorr)rr�entrys r rr$sx���5����h��� �u�:�:��?�?���?�1�%� %���8�^�4�4�4�� ����� � � �� � � ����s�A�A+�*A+c��|�'tt�����}n|tvr|g}ndS|D]�}t|}t|��dkr�#|\}}}}|��- t j|��}n+#t $rt�|d��Y�jwxYw||jks ||j krt�|d����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�fullnamers r rr4s�����������&�&� � � �U� � ��J� � ����&�&���h��� �u�:�:��?�?� �',�$��e�U�H� �=� � ��7�8�$�$�D�D��� � � � �I�I�h�� %� %� %� �H� ���� �4�<� � �5�D�M�#9�#9� �I�I�h�� %� %� %��&�&s�)A>�>%B&�%B&c���|tvr9tt|��dkrt�|d��|r*|�d��r|�d��rgS|} t j|��}�n<#t$�r.|}t||��r� t|d��}|�gcYSt|��dd�|� ��D��|ft|<t|dcYS#ttf$rYnwxYwt j � |��rgcYStj D]a} t j �||��}n#tt f$rY�7wxYw t j|��}n#t$rY�^wxYwgcYSYnwxYw t#j|��5}|���}ddd��n #1swxYwYn#tt(t*f$rgcYSwxYw|r+|d�d ��s|dxxd z cc<|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�<�>rc��g|]}|dz��S)� r )�.0�lines r � zupdatecache..ps��?�?�?�T�T�D�[�?�?�?r r�����r,)rrr!� startswith�endswithrrr r� splitlines� ImportError�path�isabs�sys�join� TypeError�AttributeError�tokenize�open� readlines�UnicodeDecodeError� SyntaxErrorr"r#) rrr'r�basename�data�dirname�fprr%r&s r rrPs�� �5��� �u�X�� � �1� $� $� �I�I�h�� %� %� %� ���+�+�C�0�0��X�5F�5F�s�5K�5K��� ��H�*��w�x� � ���� �(�(�(��� �X�~� .� .� *� *��X��q�)�+�+���<��I�I�I���I�I��?�?�T�_�_�->�->�?�?�?�� #��h�� �X��q�)�)�)�)�� ��)� � � ��� ����" �7�=�=�� "� "� ��I�I�I��x� � �G� ��7�<�<���:�:�����~�.� � � ��� ���� ��w�x�(�(������ � � ��� �����I�I�I� ��I(����R� �]�8� $� $� #���L�L�N�N�E� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #��� �'�� 5����� � � ����� ��U�2�Y�'�'��-�-�� �b� � � �T�� � � ��,�� �%�D��E�5�(�2�E�(�O� �Ls��4B � G�(D�G�A G�D(�%G�'D(�($G�G� E>�=G�>F�G�F�G�F,�*G�, F9�6G�8F9�9G�G�H�G<�0 H�<H�H�H�H�H$�#H$c���|tvr"tt|��dkrdSdS|r*|�d��r|�d��rdS|r�d|vr�|�d��}t |dd ��p|d}t |d d ��}|�|�d ��}t |d d ��}|r$|r"t j||��}|ft|<dSdS) a�Seed the cache for filename with module_globals. The module loader will be asked for the source only when getlines is called, not immediately. If there is an entry in the cache already, it is not altered. :return: True if a lazy load is registered in the cache, otherwise False. To register such a load a module loader with a get_source method must be found, the filename must be a cacheable filename, and the filename must not be already cached. rTFr)r*�__name__�__spec__�nameN�loader� __loader__� get_source)rrr1r2�get�getattr� functools�partial)rr�specrGrHrJ� get_liness r rr�s���5��� �u�X�� � �1� $� $��4��5� ���+�+�C�0�0��X�5F�5F�s�5K�5K���u�� �*��6�6��!�!�*�-�-���t�V�T�*�*�H�n�Z�.H����x��.�.�� �>�#�'�'� �5�5�F��V�\�4�8�8� � � �J� �!�)�*�d�;�;�I�(�l�E�(�O��4� �5r )N) �__doc__rMr7rr;�__all__rrrrrrrr r r �rSs��������� � � � � � � � ����� >� >� >�� ����� ���� � � � � &�&�&�&�8@�@�@�@�F!�!�!�!�!r