Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/linecache.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
��c@spdZddkZddkZdddgZdd�Zhad�Zdd�Zdd	�Z	dd
�Z
dS(s�Cache lines from 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.
i�Ntgetlinet
clearcachet
checkcachecCsKt||�}d|jot|�jno||dSndSdS(Nit(tgetlinestlen(tfilenametlinenotmodule_globalstlines((s/sys/lib/python/linecache.pyR
s$cCs
hadS(sClear the cache entirely.N(tcache(((s/sys/lib/python/linecache.pyRscCs.|tjot|dSnt||�SdS(ssGet the lines for a file from the cache.
    Update the cache if it doesn't contain an entry for this file already.iN(R
tupdatecache(RR((s/sys/lib/python/linecache.pyR!s
cCs�|djoti�}n|tjo
|g}ndSx�|D]�}t|\}}}}|djoqBnyti|�}Wn tij
ot|=qBnX||ijp||ijot|=qBqBWdS(sUDiscard cache entries that are out of date.
    (This is not checked upon each call!)N(tNoneR
tkeystoststatterrortst_sizetst_mtime(Rt	filenamestsizetmtimeR	tfullnameR((s/sys/lib/python/linecache.pyR+s"



 cCs|tjot|=n|p|d|ddjogSn|}yti|�}Wn�tij
o�}tii|�d}|od|jo�id�}|d}t|dd�}|o�|o�|i	|id�dd�o�y||�}	Wnt
tfj
oq�X|	djogSnt|	�dg}
|	i
�D]}|
|d	qR~
|ft|<t|d
Sq�q�nx|tiD]h}ytii||�}Wnttfj
oq�Xyti|�}PWq�tij
oq�Xq�WgSnXy)t|d�}
|
i�}|
i�Wntj
o
}gSnX|i|i}}||||ft|<|S(
s�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.ii�s<>it
__loader__t__name__t
get_sourcet.s
itrUN(R
RRRtpathtsplittgettgetattrRt
startswithtImportErrortIOErrorRt
splitlinestsystjoint	TypeErrortAttributeErrortopent	readlinestcloseRR(RRRRtmsgtbasenametnametloaderRtdatat_[1]tlinetdirnametfpR	RR((s/sys/lib/python/linecache.pyRDsZ
!
!
5
			(t__doc__R$Rt__all__RRR
RRRR(((s/sys/lib/python/linecache.pys<module>s
	


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.