grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|j:ã@sldZddlZddlZddlZddlZgd¢ZiZdd„Zddd„Zddd „Z dd d „Z dd d „Z dd„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Ú lazycachecCs t ¡dS)zClear the cache entirely.N)ÚcacheÚclear©rrú0/opt/alt/python310/lib64/python3.10/linecache.pyrs rcCs8t||ƒ}d|krt|ƒkrndS||dSdS)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Úlinesrrr rs  ÿrcCsR|tvrt|}t|ƒdkrt|dSzt||ƒWSty(tƒgYSw)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Úentryrrr r $s    þr c Cs²|dur tt ¡ƒ}n |tvr|g}ndS|D]?}t|}t|ƒdkr$q|\}}}}|dur/qzt |¡}WntyEt |d¡Yqw||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Úfullnamerrrr r4s,    þ €òrc Csì|tvrtt|ƒdkrt |d¡|r| d¡r | d¡r gS|}zt |¡}Wn€ty©|}t||ƒrmz t|dƒ}Wn t tfyKYn"w|durTgYSt|ƒddd„|  ¡Dƒ|ft|<t|dYStj   |¡rwgYSt j D](}z tj  ||¡}Wn ttfy�Yqzwzt |¡}Wn ty¢YqzwgYSYnwzt |¡� }| ¡}Wdƒn1s¿wYWntttfyÓgYSw|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.r Nú<ú>rcSsg|]}|d‘qS)Ú r)Ú.0Úlinerrr Ú pszupdatecache..réÿÿÿÿr$)rr rÚ startswithÚendswithrrrrÚ ImportErrorÚ splitlinesÚpathÚisabsÚsysÚjoinÚ TypeErrorÚAttributeErrorÚtokenizeÚopenÚ readlinesÚUnicodeDecodeErrorÚ SyntaxErrorrr) rrr!rÚbasenameÚdataÚdirnameÚfprrr rrr rPsl   ÿü  þ  ÿüÜ)  ÿ€ÿrcCsÀ|tvrtt|ƒdkrdSdS|r| d¡r| d¡rdS|r^d|vr^|d}| d¡}durG| d ¡}rGz|j}Wn tyFYnwt|d dƒ}|r^|r^t  ||¡}|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. r TFr"r#Ú__name__Ú __loader__NÚ__spec__Ú get_source) rr r)r*ÚgetÚloaderr2ÚgetattrÚ functoolsÚpartial)rrÚnamerAÚspecr?Ú get_linesrrr r“s*    ÿ   r)N) Ú__doc__rCr/rr3Ú__all__rrrr rrrrrrr Ús    C