a
    zeU                     @   sh   d dl Z d dlZd dlZd dlZg dZi Zdd ZdddZdddZdd	d
Z	dddZ
dd ZdS )    N)getline
clearcache
checkcache	lazycachec                   C   s   t   d S )N)cacheclear r   r   /usr/lib/python3.9/linecache.pyr      s    r   c                 C   s6   t | |}d|  kr"t|kr2n n||d  S dS )N    )getlineslen)filenamelinenomodule_globalslinesr   r   r	   r      s    
r   c                 C   sV   | t v r(t |  }t|dkr(t |  d S zt| |W S  tyP   t  g  Y S 0 d S )Nr
      )r   r   updatecacheMemoryErrorr   )r   r   entryr   r   r	   r   $   s    r   c              	   C   s   | d u rt t }n| tv r&| g}nd S |D ]} t|  }t|dkrHq.|\}}}}|d u r^q.zt|}W n" ty   t| d  Y q.Y n0 ||jks||j	kr.t| d  q.d S )Nr
   )
listr   keysr   osstatOSErrorpopst_sizest_mtime)r   	filenamesr   sizemtimer   fullnamer   r   r   r	   r   4   s&    
r   c                 C   s  | t v r$tt |  dkr$t | d  | r<| dr@| dr@g S | }zt|}W n tyf   | }t| |rzt |  d  }W n t	tfy   Y nD0 |d u rg  Y S t|d dd |
 D |ft | < t |  d  Y S tj| rg  Y S tjD ]`}ztj||}W n ttfy*   Y qY n0 zt|}W  qbW q tyV   Y q0 qg  Y S Y n0 z8t|}| }W d    n1 s0    Y  W n ty   g  Y S 0 |r|d d	s|d  d	7  < |j|j }	}
|	|
||ft | < |S )
Nr
   <>r   c                 S   s   g | ]}|d  qS )
r   ).0liner   r   r	   
<listcomp>p       zupdatecache.<locals>.<listcomp>r   r$   )r   r   r   
startswithendswithr   r   r   r   ImportError
splitlinespathisabssysjoin	TypeErrorAttributeErrortokenizeopen	readlinesr   r   )r   r   r!   r   basenamedatadirnamefpr   r   r    r   r   r	   r   P   s\    



,
r   c                 C   s   | t v r tt |  dkrdS dS | r8| dr<| dr<dS |rd|v r|d}|d }t|dd }|r|rt||}|ft | < dS dS )	Nr
   TFr"   r#   
__loader____name__
get_source)r   r   r*   r+   getgetattr	functoolspartial)r   r   nameloaderr=   	get_linesr   r   r	   r      s    

r   )N)N)N)N)r@   r0   r   r4   __all__r   r   r   r   r   r   r   r   r   r   r	   <module>   s   




C