3 \À ã @ sn d Z ddlZddlZddlZddlZdddgZddd„Zi add„ Zddd „Z dd d„Z ddd„Zd d„ ZdS )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Ú checkcachec C s: t | |ƒ}d| ko t|ƒkn r2||d S dS d S )Né Ú )ÚgetlinesÚlen)ÚfilenameÚlinenoÚmodule_globalsÚlines© r ú!/usr/lib64/python3.6/linecache.pyr s c C s i a dS )zClear the cache entirely.N)Úcacher r r r r s c C sR | t kr(t | }t|ƒdkr(t | d S y t| |ƒS tk rL tƒ g S X dS )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)r r ÚupdatecacheÚMemoryErrorr )r r Úentryr r r r % s r c C s® | dkrt tjƒ ƒ}n| tkr&| g}ndS x~|D ]v} t| }t|ƒdkrJq0|\}}}}|dkr`q0ytj|ƒ}W n tk rŠ t| = w0Y nX ||jks ||jkr0t| = q0W dS )zUDiscard cache entries that are out of date. (This is not checked upon each call!)Nr ) Úlistr Úkeysr ÚosÚstatÚOSErrorÚst_sizeÚst_mtime)r Ú filenamesr ÚsizeÚmtimer Úfullnamer r r r r 5 s&