%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.6/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.6/__pycache__/bdb.cpython-36.pyc

3


 \\�@s�dZddlZddlZddlZddlmZmZmZdddgZeeBeBZ	Gdd�de
�ZGdd�d�Zd	d
�Z
Gdd�d�Zdd
�Zdd�ZGdd�de�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/bdb.pyr
sc@speZdZdZdZdd�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'�Zd\d(d)�Zd*d+�Zd,d-�Zd.d/�Zd]d0d1�Zd2d3�Zd4d5�Zd^d7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(d_dPdQ�Z)d`dRdS�Z*dadTdU�Z+dVdW�Z,dXdY�Z-dS)brz�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(|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrrrr
�__init__szBdb.__init__cCsR|d|dd�dkr|S|jj|�}|sNtjj|�}tjj|�}||j|<|S)N�<��>���)r�get�os�path�abspath�normcase)r�filename�canonicrrr
rs
zBdb.canoniccCs&ddl}|j�d|_|jdd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rr rrr
�reset)sz	Bdb.resetcCs�|jr
dS|dkr|j|�S|dkr0|j||�S|dkrD|j||�S|dkrX|j||�S|dkrf|jS|dkrt|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r
r,/s$
zBdb.trace_dispatchcCs.|j|�s|j|�r(|j|�|jr(t�|jS)N)�	stop_here�
break_here�	user_liner'rr,)rr/rrr
r(Cs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|j|�p*|j|�s0dS|jrH|jjt@rH|jS|j	||�|j
r^t�|jS)N)r"�f_backr,r1�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr'r)rr/r0rrr
r)Is
zBdb.dispatch_callcCs||j|�s||jkrv|jr,|jjt@r,|jSz||_|j||�Wdd|_X|j	rVt
�|j|krv|jdkrv|jdd�|jS)Nrr)
r1�returnframer6r7r8r9r,r�user_returnr'r�
stoplinenor#)rr/r0rrr
r*YszBdb.dispatch_returncCs�|j|�rF|jjt@o,|dtko,|ddks�|j||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|j||�|jr�t�|j
S)Nr�)r1r7r8r9�
StopIteration�user_exceptionr'rr6�
GeneratorExitr,)rr/r0rrr
r+is
zBdb.dispatch_exceptioncCs$x|jD]}tj||�rdSqWdS)NTF)r�fnmatch)rZmodule_name�patternrrr
�is_skipped_module�szBdb.is_skipped_modulecCsN|jr|j|jjd��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)NrFrTr)rrD�	f_globalsrr6r=�f_lineno)rr/rrr
r1�s

z
Bdb.stop_herecCs�|j|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|j
t|j��dSdSdS)NFT)rr7�co_filenamerrF�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr/r�lineno�bp�flagrrr
r2�s

zBdb.break_herecCstd��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)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r
r:�sz
Bdb.user_callcCsdS)z9This method is called when we stop or break at this line.Nr)rr/rrr
r3�sz
Bdb.user_linecCsdS)z5This method is called when a return trap is set here.Nr)rr/Zreturn_valuerrr
r<�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r
r@�szBdb.user_exceptionrcCs||_||_d|_||_dS)NF)r6r;r'r=)rr6r;r=rrr
r#�szBdb._set_stopinfocCs$|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)rFr#)rr/rNrrr
�	set_until�s
z
Bdb.set_untilcCs2|jr"|jj}|r"|jr"|j|_|jdd�dS)zStop after one line of code.N)rr4�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)r7r8r9r#r4)rr/rrr
�
set_return�szBdb.set_returncCsP|dkrtj�j}|j�x|r6|j|_||_|j}qW|j�tj|j�dS)zpStart debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer4r$r,rTr"rU�settrace)rr/rrr
�	set_trace�s

z
Bdb.set_tracecCsL|j|jdd�|jsHtjd�tj�j}x|rF||jk	rF|`|j}q,WdS)Nrr)r#r"rrXrZrYr4rT)rr/rrr
�set_continues

zBdb.set_continuecCs"|j|_d|_d|_tjd�dS)NT)r"r6r;r'rXrZ)rrrr
�set_quitszBdb.set_quitFc
Csb|j|�}ddl}|j||�}|s.d||fS|jj|g�}||krN|j|�t|||||�}	dS)NrzLine %s:%d does not exist)rr �getliner�
setdefault�appendr)
rrrNrK�cond�funcnamer r%�listrOrrr
�	set_breaks

z
Bdb.set_breakcCs4||ftjkr|j|j|�|j|s0|j|=dS)N)r�bplistr�remove)rrrNrrr
�
_prune_breaks$s
zBdb._prune_breakscCsn|j|�}||jkrd|S||j|kr6d||fSx&tj||fdd�D]}|j�qNW|j||�dS)NzThere are no breakpoints in %szThere is no breakpoint at %s:%d)rrrre�deleteMerg)rrrNrOrrr
�clear_break*s

zBdb.clear_breakcCsPy|j|�}Wn$tk
r2}zt|�Sd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrMrhrg�filer%)rr0rO�errrrr
�clear_bpbynumber6szBdb.clear_bpbynumbercCs`|j|�}||jkrd|Sx6|j|D](}tj||f}x|D]}|j�q@Wq(W|j|=dS)NzThere are no breakpoints in %s)rrrrerh)rrr%ZblistrOrrr
�clear_all_file_breaks>s


zBdb.clear_all_file_breakscCs0|js
dSxtjD]}|r|j�qWi|_dS)NzThere are no breakpoints)rr�
bpbynumberrh)rrOrrr
�clear_all_breaksHszBdb.clear_all_breakscCs�|std��yt|�}Wn tk
r8td|��YnXytj|}Wn tk
rhtd|��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
rjPszBdb.get_bpbynumbercCs"|j|�}||jko ||j|kS)N)rr)rrrNrrr
�	get_break_s

z
Bdb.get_breakcCs4|j|�}||jkr0||j|kr0tj||fp2gS)N)rrrre)rrrNrrr
�
get_breaksds

zBdb.get_breakscCs&|j|�}||jkr|j|SgSdS)N)rr)rrrrr
�get_file_breaksjs


zBdb.get_file_breakscCs|jS)N)r)rrrr
�get_all_breaksqszBdb.get_all_breakscCs�g}|r|j|kr|j}x.|dk	rF|j||jf�||jkr>P|j}qW|j�tdt|�d�}x$|dk	r�|j|j|j	f�|j}qdW|dkr�tdt|�d�}||fS)Nrr)
�tb_frame�tb_nextr`rFr"r4�reverse�max�len�	tb_lineno)r�f�t�stack�irrr
�	get_stackws 




z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|j|jj�}d||f}|jjrH||jj7}n|d7}d|jkrf|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_linenoZlprefixr r�r/rNr�s�args�rvr%rrr
�format_stack_entry�s*


zBdb.format_stack_entrycCs�|dkrddl}|j}|dkr"|}|j�t|t�r@t|dd�}tj|j�z*yt	|||�Wnt
k
rrYnXWdd|_tjd�XdS)Nrz<string>�execT)�__main__�__dict__r$�
isinstancerM�compilerXrZr,r�rr')r�cmd�globals�localsr�rrr
�run�s

zBdb.runcCst|dkrddl}|j}|dkr"|}|j�tj|j�z&yt|||�Stk
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.runctxcOsX|j�tj|j�d}z(y|||�}Wntk
r<YnXWdd|_tjd�X|S)NT)r$rXrZr,rr')r�funcr��kwds�resrrr
�runcall�s
zBdb.runcall)N)r)N)N)FNN)r�)NN)NN).rr	r
rrrr$r,r(r)r*r+rDr1r2rLr5r:r3r<r@r#rSrUrVrWr[r\r]rdrgrirnrorqrjrtrurvrwr�r�r�r�r�r�rrrr
rsX










cCst�j�dS)N)rr[rrrr
r[�sr[c@sZeZdZdZdZiZdgZddd�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)rb�func_first_executable_linerlr%rKra�enabled�ignore�hitsr�nextrJrpr`re)rrlr%rKrarbrrr
r�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|j|�|j|s:|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)N)rl)rX�stdoutr-�bpformat)r�outrrr
�bpprintszBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|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�)rZdispZretZssrrr
r�s$

zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rJrlr%)rrrr
�__str__6szBreakpoint.__str__)FNN)N)rr	r
rr�rerprrhr�r�r�r�r�rrrr
r�s

cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)z;Check whether we should break here because of `b.funcname`.FT)rbr%rFr7r�r�)�br/rrr
�
checkfuncname;sr�cCs�tj||f}x�|D]�}|js qt||�s,q|jd7_|jsf|jdkr\|jd8_qq�|dfSqy<t|j|j|j	�}|r�|jdkr�|jd8_n|dfSWq|dfSqWdS)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)
rrer�r�r�rar�r�rEr�)rlr%r/Z	possiblesr��valrrr
rIWs*




rIc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)Nz???z+++ call)r7r�r-)rr/r��namerrr
r:�sz
Tdb.user_callcCsTddl}|jj}|sd}|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
r r7r�rrGr^rFrEr-r�)rr/r r��fnr%rrr
r3�sz
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)rr	r
r:r3r<r@rrrr
r��sr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r-�bar)�n�xrrr
�foo�sr�cCstd|d�|dS)Nzbar(r�r>)r-)�arrr
r��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)rrrr
�test�sr�)rrBrXr�inspectrrr�__all__r9�	Exceptionrrr[rr�rIr�r�r�r�rrrr
�<module>s&
OZ0

Zerion Mini Shell 1.0