ok

Mini Shell

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



>�Ma:[�@s�dZddlZddlZddlZddlmZdddgZGdd�de�ZGdd�d�Z	d	d
�Z
Gdd�d�Zdd
�Zdd�Z
Gdd�de	�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�r
r
�(/opt/alt/python35/lib64/python3.5/bdb.pyr
sc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&d'�Zdd(d)�Zd*d+�Zd,d-�Zd.d/�Zdd0d1�Zd2d3�Zd4d5�Zd6ddd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(dOdPdQ�Z)dddRdS�Z*dddTdU�Z+dVdW�Z,dXdY�Z-dS)Zrz�Generic Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.
    NcCs:|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
rrs
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�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argr
r
rr*,s$	
zBdb.trace_dispatchcCsA|j|�s|j|�r:|j|�|jr:t�|jS)N)�	stop_here�
break_here�	user_liner%rr*)rr-r
r
rr&@s

	zBdb.dispatch_linecCs�|jdkr"|j|_|jS|j|�p=|j|�sDdS|jrd|jjt@rd|jS|j	||�|j
r�t�|jS)N)r �f_backr*r/�break_anywhere�	stopframe�f_code�co_flagsr�	user_callr%r)rr-r.r
r
rr'Fs	zBdb.dispatch_callcCs�|j|�s||jkr�|jr>|jjt@r>|jSz||_|j||�Wdd|_X|j	rwt
�|j|kr�|jdkr�|jdd�|jS)Nrr)
r/�returnframer4r5r6rr*r�user_returnr%r�
stoplinenor!)rr-r.r
r
rr(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�)r/r5r6r�
StopIteration�user_exceptionr%rr4�
GeneratorExitr*)rr-r.r
r
rr)fs 			zBdb.dispatch_exceptioncCs.x'|jD]}tj||�r
dSq
WdS)NTF)r
�fnmatch)rZmodule_name�patternr
r
r�is_skipped_moduleszBdb.is_skipped_modulecCsk|jr(|j|jjd��r(dS||jkrZ|jdkrJdS|j|jkS|jsgdSdS)NrFrTr)r
rA�	f_globalsrr4r:�f_lineno)rr-r
r
rr/�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)rr5�co_filenamerrC�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr-r�lineno�bpZflagr
r
rr0�s	zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr.r
r
rrI�szBdb.do_clearcCs|j|jj�|jkS)N)rr5rDr)rr-r
r
rr3�szBdb.break_anywherecCsdS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nr
)rr-Z
argument_listr
r
rr7�sz
Bdb.user_callcCsdS)z9This method is called when we stop or break at this line.Nr
)rr-r
r
rr1�sz
Bdb.user_linecCsdS)z5This method is called when a return trap is set here.Nr
)rr-Zreturn_valuer
r
rr9�szBdb.user_returncCsdS)zmThis method is called if an exception occurs,
        but only if we are to stop at or just below this level.Nr
)rr-�exc_infor
r
rr=�szBdb.user_exceptionrcCs(||_||_d|_||_dS)NF)r4r8r%r:)rr4r8r:r
r
rr!�s			zBdb._set_stopinfocCs0|dkr|jd}|j|||�dS)zxStop when the line with the line no greater than the current one is
        reached or when returning from current frameNr)rCr!)rr-rKr
r
r�	set_until�s
z
Bdb.set_untilcCsE|jr1|jj}|r1|jr1|j|_|jdd�dS)zStop after one line of code.N)rr2�f_tracer*r!)rZcaller_framer
r
r�set_step�s
	zBdb.set_stepcCs|j|d�dS)z2Stop on the next line in or below the given frame.N)r!)rr-r
r
r�set_next�szBdb.set_nextcCs=|jjt@r&|j|dd�n|j|j|�dS)z)Stop when returning from the given frame.Nrr)r5r6rr!r2)rr-r
r
r�
set_return�szBdb.set_returncCsn|dkrtj�j}|j�x(|rO|j|_||_|j}q(W|j�tj|j�dS)zpStart debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer2r"r*rPr rQ�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!r rrTrVrUr2rP)rr-r
r
r�set_continue�s	
zBdb.set_continuecCs/|j|_d|_d|_tjd�dS)NT)r r4r8r%rTrV)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)
rrrKrH�cond�funcnamerr#�listrLr
r
r�	set_breaks
z
Bdb.set_breakcCsD||ftjkr)|j|j|�|j|s@|j|=dS)N)r�bplistr�remove)rrrKr
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)rrrra�deleteMerc)rrrKrLr
r
r�clear_break's$zBdb.clear_breakcCsiy|j|�}Wn/tk
rD}zt|�SWYdd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrJrdrc�filer#)rr.rL�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)rrrrard)rrr#ZblistrLr
r
r�clear_all_file_breaks;s
zBdb.clear_all_file_breakscCs>|js
dSx!tjD]}|r|j�qWi|_dS)NzThere are no breakpoints)rr�
bpbynumberrd)rrLr
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)rg�intrrl�
IndexError)rr.rGrLr
r
rrfMs

zBdb.get_bpbynumbercCs/|j|�}||jko.||j|kS)N)rr)rrrKr
r
r�	get_break\sz
Bdb.get_breakcCsH|j|�}||jkrD||j|krDtj||fpGgS)N)rrrra)rrrKr
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\rCr r2�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�reprlibrr5rD�co_name�f_localsr,rZrB�strip)rZframe_linenoZlprefixrrr-rKr�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"�
isinstancerJ�compilerTrVr*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"rTrVr*�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"rTrVr*rr%)r�funcr��kwds�resr
r
r�runcall�s

		zBdb.runcall).rrrr	rrr"r*r&r'r(r)rAr/r0rIr3r7r1r9r=r!rOrQrRrSrWrXrYr`rcrerjrkrmrfrprqrrrsr~r�r�r�r�r�r
r
r
rrsX


cCst�j�dS)N)rrWr
r
r
rrW�srWc@s�eZdZdZdZiZdgZddddd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)ra�Breakpoint class.

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the file,line tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    rNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|jj
|�||f|jkr�|j||fj
|�n|g|j||f<dS)NTrr)r^�func_first_executable_linerhr#rHr]�enabled�ignore�hitsr�nextrGrlr\ra)rrhr#rHr]r^r
r
rr�s									zBreakpoint.__init__cCsQ|j|jf}d|j|j<|j|j|�|j|sM|j|=dS)N)rhr#rlrGrarb)r�indexr
r
rrd	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)Nrh)rT�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)rHr�rGrhr#r]r�r�)rZdispZretZssr
r
rr�s$			

				zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rGrhr#)rr
r
r�__str__3szBreakpoint.__str__)rrrr	r�rarlrrdr�r�r�r�r�r
r
r
rr�s	cCsk|js#|j|jkrdSdS|jj|jkr<dS|jsQ|j|_|j|jkrgdSdS)z;Check whether we should break here because of `b.funcname`.FT)r^r#rCr5r�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)z�Determine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a bpt at this
    location.  Returns breakpoint that was triggered and a flag
    that indicates if it is ok to delete a temporary bp.

    rrTFN)NN)
rrar�r�r�r]r�r�rBr�)rhr#r-Z	possiblesr��valr
r
rrFTs*
		
rFc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs,|jj}|sd}td||�dS)Nz???z+++ call)r5r�r+)rr-r��namer
r
rr7�sz
Tdb.user_callcCszddl}|jj}|s$d}|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
rr5r�rrDrZrCrBr+r�)rr-rr��fnr#r
r
rr1�sz
Tdb.user_linecCstd|�dS)Nz
+++ return)r+)rr-Zretvalr
r
rr9�szTdb.user_returncCstd|�|j�dS)Nz
+++ exception)r+rX)rr-Z	exc_stuffr
r
rr=�s
zTdb.user_exceptionN)rrrr7r1r9r=r
r
r
rr��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
rr��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)r{r
r
r�test�s	r�)r	r?rTr�inspectr�__all__�	ExceptionrrrWrr�rFr�r�r�r�r
r
r
r�<module>s ��Z0

Zerion Mini Shell 1.0