Your IP : 18.118.0.93


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/bdb.cpython-35.opt-2.pyc



���]:[�@s�ddlZddlZddlZddlmZdddgZGdd�de�ZGdd�d�Zdd	�Z	Gd
d�d�Z
dd�Zd
d�ZGdd�de�Z
dd�Zdd�Zdd�ZdS)�N)�CO_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�(/opt/alt/python35/lib64/python3.5/bdb.pyr
sc@s,eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%d&�Zdd'd(�Zd)d*�Zd+d,�Zd-d.�Zdd/d0�Zd1d2�Zd3d4�Zd5ddd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dLdM�Z'dNdOdP�Z(dddQdR�Z)dddSdT�Z*dUdV�Z+dWdX�Z,dS)YrNcCs:|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrr	r	r
�__init__s		zBdb.__init__cCso|d|dd�dkr"|S|jj|�}|sktjj|�}tjj|�}||j|<|S)N�<��>���)r�get�os�path�abspath�normcase)r�filename�canonicr	r	r
rs
zBdb.canoniccCs3ddl}|j�d|_|jdd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rrr	r	r
�reset&s
	z	Bdb.resetcCs�|jr
dS|dkr&|j|�S|dkrB|j||�S|dkr^|j||�S|dkrz|j||�S|dkr�|jS|dkr�|jS|dkr�|jStdt|��|jS)	N�line�call�return�	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frame�event�argr	r	r
r+,s$	
zBdb.trace_dispatchcCsA|j|�s|j|�r:|j|�|jr:t�|jS)N)�	stop_here�
break_here�	user_liner&rr+)rr.r	r	r
r'@s

	zBdb.dispatch_linecCs�|jdkr"|j|_|jS|j|�p=|j|�sDdS|jrd|jjt@rd|jS|j	||�|j
r�t�|jS)N)r�f_backr+r1�break_anywhere�	stopframe�f_code�co_flagsr�	user_callr&r)rr.r0r	r	r
r(Fs	zBdb.dispatch_callcCs�|j|�s||jkr�|jr>|jjt@r>|jSz||_|j||�Wdd|_X|j	rwt
�|j|kr�|jdkr�|jdd�|jS)Nrr)
r1�returnframer6r7r8rr+r�user_returnr&r�
stoplinenor )rr.r0r	r	r
r)Vs	
	zBdb.dispatch_returncCs�|j|�ra|jjt@o<|dtko<|ddks�|j||�|jr�t�n`|jr�||jk	r�|jjjt@r�|dtt	fkr�|j||�|jr�t�|j
S)Nr�)r1r7r8r�
StopIteration�user_exceptionr&rr6�
GeneratorExitr+)rr.r0r	r	r
r*fs 			zBdb.dispatch_exceptioncCs.x'|jD]}tj||�r
dSq
WdS)NTF)r�fnmatch)r�module_name�patternr	r	r
�is_skipped_moduleszBdb.is_skipped_modulecCsk|jr(|j|jjd��r(dS||jkrZ|jdkrJdS|j|jkS|jsgdSdS)NrFrTr)rrD�	f_globalsrr6r<�f_lineno)rr.r	r	r
r1�s		z
Bdb.stop_herecCs�|j|jj�}||jkr(dS|j}||j|krg|jj}||j|krgdSt|||�\}}|r�|j|_|r�|j	r�|j
t|j��dSdSdS)NFT)rr7�co_filenamer
rF�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr.r�lineno�bp�flagr	r	r
r2�s	zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr0r	r	r
rL�szBdb.do_clearcCs|j|jj�|jkS)N)rr7rGr
)rr.r	r	r
r5�szBdb.break_anywherecCsdS)Nr	)rr.Z
argument_listr	r	r
r9�sz
Bdb.user_callcCsdS)Nr	)rr.r	r	r
r3�sz
Bdb.user_linecCsdS)Nr	)rr.Zreturn_valuer	r	r
r;�szBdb.user_returncCsdS)Nr	)rr.�exc_infor	r	r
r?�szBdb.user_exceptionrcCs(||_||_d|_||_dS)NF)r6r:r&r<)rr6r:r<r	r	r
r �s			zBdb._set_stopinfocCs0|dkr|jd}|j|||�dS)Nr)rFr )rr.rNr	r	r
�	set_until�s
z
Bdb.set_untilcCsE|jr1|jj}|r1|jr1|j|_|jdd�dS)N)rr4�f_tracer+r )rZcaller_framer	r	r
�set_step�s
	zBdb.set_stepcCs|j|d�dS)N)r )rr.r	r	r
�set_next�szBdb.set_nextcCs=|jjt@r&|j|dd�n|j|j|�dS)Nrr)r7r8rr r4)rr.r	r	r
�
set_return�szBdb.set_returncCsn|dkrtj�j}|j�x(|rO|j|_||_|j}q(W|j�tj|j�dS)N)	�sys�	_getframer4r!r+rTrrU�settrace)rr.r	r	r
�	set_trace�s
		

z
Bdb.set_tracecCsj|j|jdd�|jsftjd�tj�j}x(|re||jk	re|`|j}q>WdS)Nrr)r rr
rXrZrYr4rT)rr.r	r	r
�set_continue�s	
zBdb.set_continuecCs/|j|_d|_d|_tjd�dS)NT)rr6r:r&rXrZ)rr	r	r
�set_quits		zBdb.set_quitFc
Cs�|j|�}ddl}|j||�}|sAd||fS|jj|g�}||kro|j|�t|||||�}	dS)NrzLine %s:%d does not exist)rr�getliner
�
setdefault�appendr)
rrrNrK�cond�funcnamerr"�listrOr	r	r
�	set_breaks
z
Bdb.set_breakcCsD||ftjkr)|j|j|�|j|s@|j|=dS)N)r�bplistr
�remove)rrrNr	r	r
�
_prune_breaks!s
zBdb._prune_breakscCs�|j|�}||jkr&d|S||j|krGd||fSx/tj||fdd�D]}|j�qeW|j||�dS)NzThere are no breakpoints in %szThere is no breakpoint at %s:%d)rr
rre�deleteMerg)rrrNrOr	r	r
�clear_break's$zBdb.clear_breakcCsiy|j|�}Wn/tk
rD}zt|�SWYdd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrMrhrg�filer")rr0rO�errr	r	r
�clear_bpbynumber3s
zBdb.clear_bpbynumbercCsz|j|�}||jkr&d|SxC|j|D]4}tj||f}x|D]}|j�qTWq4W|j|=dS)NzThere are no breakpoints in %s)rr
rrerh)rrr"ZblistrOr	r	r
�clear_all_file_breaks;s
zBdb.clear_all_file_breakscCs>|js
dSx!tjD]}|r|j�qWi|_dS)NzThere are no breakpoints)r
r�
bpbynumberrh)rrOr	r	r
�clear_all_breaksEs	zBdb.clear_all_breakscCs�|std��yt|�}Wn"tk
rFtd|��YnXytj|}Wn"tk
r|td|��YnX|dkr�td|��|S)NzBreakpoint number expectedz Non-numeric breakpoint number %sz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rk�intrrp�
IndexError)rr0rJrOr	r	r
rjMs

zBdb.get_bpbynumbercCs/|j|�}||jko.||j|kS)N)rr
)rrrNr	r	r
�	get_break\sz
Bdb.get_breakcCsH|j|�}||jkrD||j|krDtj||fpGgS)N)rr
rre)rrrNr	r	r
�
get_breaksaszBdb.get_breakscCs1|j|�}||jkr)|j|SgSdS)N)rr
)rrr	r	r
�get_file_breaksgszBdb.get_file_breakscCs|jS)N)r
)rr	r	r
�get_all_breaksnszBdb.get_all_breakscCs�g}|r$|j|kr$|j}x?|dk	re|j||jf�||jkrYP|j}q'W|j�tdt|�d�}x2|dk	r�|j|j|j	f�|j}q�W|dkr�tdt|�d�}||fS)Nrr)
�tb_frame�tb_nextr`rFrr4�reverse�max�len�	tb_lineno)r�f�t�stack�ir	r	r
�	get_stackts 	


z
Bdb.get_stackz: cCs,ddl}ddl}|\}}|j|jj�}d||f}|jjrh||jj7}n
|d7}d|jkr�|jd}	nd}	|	r�||j|	�7}n
|d7}d|jkr�|jd}
|d7}||j|
�7}|j|||j	�}|r(|||j
�7}|S)Nrz%s(%r)z<lambda>Z__args__z()Z
__return__z->)r�reprlibrr7rG�co_name�f_localsr-r^rE�strip)rZframe_linenoZlprefixrr�r.rNr�s�args�rvr"r	r	r
�format_stack_entry�s*



zBdb.format_stack_entrycCs�|dkr!ddl}|j}|dkr3|}|j�t|t�r^t|dd�}tj|j�z-yt	|||�Wnt
k
r�YnXWdd|_tjd�XdS)Nrz<string>�execT)�__main__�__dict__r!�
isinstancerM�compilerXrZr+r�rr&)r�cmd�globals�localsr�r	r	r
�run�s	

		zBdb.runcCs�|dkr!ddl}|j}|dkr3|}|j�tj|j�z-yt|||�SWntk
rxYnXWdd|_tjd�XdS)NrT)	r�r�r!rXrZr+�evalrr&)r�exprr�r�r�r	r	r
�runeval�s	

		zBdb.runevalcCs|j|||�dS)N)r�)rr�r�r�r	r	r
�runctx�sz
Bdb.runctxcOsj|j�tj|j�d}z,y|||�}Wntk
rJYnXWdd|_tjd�X|S)NT)r!rXrZr+rr&)r�funcr��kwds�resr	r	r
�runcall�s

		zBdb.runcall)-rrrrrr!r+r'r(r)r*rDr1r2rLr5r9r3r;r?r rSrUrVrWr[r\r]rdrgrirnrorqrjrtrurvrwr�r�r�r�r�r�r	r	r	r
rsV


cCst�j�dS)N)rr[r	r	r	r
r[�sr[c@s�eZdZdZiZdgZddddd�Zdd�Zdd	�Zd
d�Z	ddd
�Z
dd�Zdd�ZdS)rrNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|jj
|�||f|jkr�|j||fj
|�n|g|j||f<dS)NTrr)rb�func_first_executable_linerlr"rKra�enabled�ignore�hitsr�nextrJrpr`re)rrlr"rKrarbr	r	r
r�s									zBreakpoint.__init__cCsQ|j|jf}d|j|j<|j|j|�|j|sM|j|=dS)N)rlr"rprJrerf)r�indexr	r	r
rh	s

zBreakpoint.deleteMecCs
d|_dS)NT)r�)rr	r	r
�enableszBreakpoint.enablecCs
d|_dS)NF)r�)rr	r	r
�disableszBreakpoint.disablecCs/|dkrtj}t|j�d|�dS)Nrl)rX�stdoutr,�bpformat)r�outr	r	r
�bpprints	zBreakpoint.bpprintcCs�|jrd}nd}|jr.|d}n
|d}d|j||j|jf}|jrt|d|jf7}|jr�|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)Nzdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rKr�rJrlr"rar�r�)rZdisp�ret�ssr	r	r
r�s$			

				zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rJrlr")rr	r	r
�__str__3szBreakpoint.__str__)
rrrr�rerprrhr�r�r�r�r�r	r	r	r
r�s	cCsk|js#|j|jkrdSdS|jj|jkr<dS|jsQ|j|_|j|jkrgdSdS)NFT)rbr"rFr7r�r�)�br.r	r	r
�
checkfuncname8s		r�cCs�tj||f}x�|D]�}|js,qt||�s>q|jd7_|js�|jdkrz|jd8_qq�|dfSqyPt|j|j|j	�}|r�|jdkr�|jd8_n
|dfSWq|dfSYqXqWdS)NrrTF)NN)
rrer�r�r�rar�r�rEr�)rlr"r.Z	possiblesr��valr	r	r
rITs*
		
rIc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs,|jj}|sd}td||�dS)Nz???z+++ call)r7r�r,)rr.r��namer	r	r
r9�sz
Tdb.user_callcCszddl}|jj}|s$d}|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
rr7r�rrGr^rFrEr,r�)rr.rr��fnr"r	r	r
r3�sz
Tdb.user_linecCstd|�dS)Nz
+++ return)r,)rr.Zretvalr	r	r
r;�szTdb.user_returncCstd|�|j�dS)Nz
+++ exception)r,r\)rr.Z	exc_stuffr	r	r
r?�s
zTdb.user_exceptionN)rrrr9r3r;r?r	r	r	r
r��sr�cCs1td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r,�bar)�n�xr	r	r
�foo�sr�cCstd|d�|dS)Nzbar(r�r=)r,)�ar	r	r
r��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)rr	r	r
�test�s	r�)rArXr�inspectr�__all__�	Exceptionrrr[rr�rIr�r�r�r�r	r	r	r
�<module>s��Z0

?>