Ë
    òT•j  ã                   ó`   — d Z ddlZddlZddlZddlZg d¢Zi Zd„ Zd
d„Zd
d„Z	d
d„Z
d
d„Zd	„ Zy)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)zClear the cache entirely.N)ÚcacheÚclear© ó    ú /usr/lib/python3.12/linecache.pyr   r      s   € ä	‡K�K…Mr   c                 óZ   — t        | |«      }d|cxk  rt        |«      k  rn y||dz
     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        |«      dk7  rt         |    d   S 	 t        | |«      S # t        $ r t	        «        g cY S w xY 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ÁAc                 ó�  — | €t        t        j                  «       «      }n| t        v r| g}ny|D ]o  } t        |    }t        |«      dk(  rŒ|\  }}}}|€Œ%	 t	        j
                  |«      }||j                  k7  s||j                  k7  sŒZt        j                  | d«       Œq y# t        $ r t        j                  | d«       Y Œ”w xY 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ÃCc                 ó‚  — | t         v r+t        t         |    «      dk7  rt         j                  | d«       | r"| j                  d«      r| j	                  d«      rg S | }	 t        j                  |«      }	 t#        j$                  |«      5 }|j'                  «       }	ddd«       	r!|	d   j	                  d«      s|	dxx   dz  cc<   |j,                  |j.                  }}
|
||	|ft         | <   |	S # t        $ �r  | }t        | |«      ru	 t        |    d   «       }|€g cY S t        |«      d|j                  «       D �cg c]  }|dz   ‘Œ	 nc c}w c}|ft         | <   t         |    d   cY S # t        t        f$ r Y nw xY wt
        j                  j                  | «      rg cY S t        j                  D ]_  }	 t
        j                  j                  ||«      }n# t        t         f$ r Y Œ6w xY w	 t        j                  |«      } n# t        $ r Y Œ]w xY w g cY S Y �Œ¢w xY w# 1 sw Y   �Œ�xY w# t        t(        t*        f$ r g cY S w xY w)	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.r   Nú<ú>r   ú
r   éÿÿÿÿ)r   r   r!   Ú
startswithÚendswithr   r   r    r   Ú
splitlinesÚImportErrorÚpathÚisabsÚsysÚjoinÚ	TypeErrorÚAttributeErrorÚtokenizeÚopenÚ	readlinesÚUnicodeDecodeErrorÚSyntaxErrorr"   r#   )r   r   r'   r   ÚbasenameÚdataÚlineÚdirnameÚfpr   r%   r&   s               r   r   r   P   s5  € ð
 ”5ÑÜŒu�X‰Ó 1Ò$Ü�I‰I�h Ô%Ù˜×+Ñ+¨CÔ0°X×5FÑ5FÀsÔ5KØˆ	à€Hð*Ü�w‰w�xÓ ˆðTÜ�]‰]˜8Ó$ð 	#¨Ø—L‘L“NˆE÷	#ñ �U˜2‘Y×'Ñ'¨Ô-Øˆb‹	�TÑ‹	Ø—,‘, §¡ˆ%€DØ˜E 5¨(Ð2„Eˆ(�OØ€Løôe ó (Øˆô �X˜~Ô.ð*Ü˜X‘ qÑ)Ó+�ð �<ð ’Iä˜“IØØ-1¯_©_Ó->Ö? T�T˜D“[Ñ?ùÔ?Øð	#”�h‘ô ˜X‘ qÑ)Ò)øô  ¤Ð)ò Ùðúô" �7‰7�=‰=˜Ô"ØŠIä—x‘xò 	ˆGðÜŸ7™7Ÿ<™<¨°Ó:‘øÜœ~Ð.ò áðúðÜ—w‘w˜xÓ(�ÙøÜò Ùðúð	ð ŠIò	 ðI(ú÷T	#ñ 	#ûäÔ'¬Ð5ò ØŠ	ðúsÀ   ÁC+ Á3H% ÂHÂH% Ã+HÄE#ÄHÄHÄ7E
ÅHÅ#E5Å2HÅ4E5Å5$HÆHÆ/ GÇHÇG"ÇHÇ!G"Ç"HÇ&G=Ç;HÇ=	H	ÈHÈH	È	HÈHÈH"ÈH% È%H>È=H>c                 ó†  — | t         v rt        t         |    «      dk(  ryy| r"| j                  d«      r| j                  d«      ry|r{d|v rw|j	                  d«      }t        |dd	«      xs |d   }t        |d
d	«      }|€|j	                  d«      }t        |dd	«      }|r#|r!t        j                  ||«      }|ft         | <   yy)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.
    r   TFr)   r*   Ú__name__Ú__spec__ÚnameNÚloaderÚ
__loader__Ú
get_source)r   r   r-   r.   ÚgetÚgetattrÚ	functoolsÚpartial)r   r   ÚspecrD   rE   rG   Ú	get_liness          r   r   r   “   sÎ   € ð ”5ÑÜŒu�X‰Ó 1Ò$ØàÙ˜×+Ñ+¨CÔ0°X×5FÑ5FÀsÔ5KØá˜*¨Ñ6Ø×!Ñ! *Ó-ˆÜ�t˜V TÓ*ÒH¨n¸ZÑ.HˆÜ˜˜x¨Ó.ˆØˆ>Ø#×'Ñ'¨Ó5ˆFÜ˜V \°4Ó8ˆ
á‘JÜ!×)Ñ)¨*°dÓ;ˆIØ(˜lŒE�(‰OØØr   )N)Ú__doc__rJ   r3   r   r7   Ú__all__r   r   r   r   r   r   r   r
   r   r   ú<module>rP      sD   ðñó Û 
Û 	Û â
>€ð
 	€òó
óó &ó8@óF!r   