AlkantarClanX12

Your IP : 18.225.95.229


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/pdb.cpython-35.pyc



��Yf���"@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
Gdd�de�Zddddd	d
ddd
g	Zdd�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	r�d
ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"Zx2eD]*Zeeed8e�jj�d97Zq�Weejj7Z[[ddd:d�Zddd;d�Z d<d	�Z!d=d
�Z"d>d�Z#dd?d�Z$d@d�Z%dAZ&dBdC�Z'dDd
�Z(dEZ)dFdG�Z*e+dHkr�ddl,Z,e,j*�dS)Ia_	
The Python Debugger Pdb
=======================

To use the debugger in its simplest form:

        >>> import pdb
        >>> pdb.run('<a statement>')

The debugger's prompt is '(Pdb) '.  This will stop in the first
function call in <a statement>.

Alternatively, if a statement terminated with an unhandled exception,
you can use pdb's post-mortem facility to inspect the contents of the
traceback:

        >>> <a statement>
        <exception traceback>
        >>> import pdb
        >>> pdb.pm()

The commands recognized by the debugger are listed in the next
section.  Most can be abbreviated as indicated; e.g., h(elp) means
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
nor as 'H' or 'Help' or 'HELP').  Optional arguments are enclosed in
square brackets.  Alternatives in the command syntax are separated
by a vertical bar (|).

A blank line repeats the previous command literally, except for
'list', where it lists the next 11 lines.

Commands that the debugger doesn't recognize are assumed to be Python
statements and are executed in the context of the program being
debugged.  Python statements can also be prefixed with an exclamation
point ('!').  This is a powerful way to inspect the program being
debugged; it is even possible to change variables or call functions.
When an exception occurs in such a statement, the exception name is
printed but the debugger's state is not changed.

The debugger supports aliases, which can save typing.  And aliases can
have parameters (see the alias help entry) which allows one a certain
level of adaptability to the context under examination.

Multiple commands may be entered on a single line, separated by the
pair ';;'.  No intelligence is applied to separating the commands; the
input is split at the first ';;', even if it is in the middle of a
quoted string.

If a file ".pdbrc" exists in your home directory or in the current
directory, it is read in and executed as if it had been typed at the
debugger prompt.  This is particularly useful for aliases.  If both
files exist, the one in the home directory is read first and aliases
defined there can be overridden by the local file.

Aside from aliases, the debugger is not directly programmable; but it
is implemented as a class from which you can derive your own debugger
class, which you can make as fancy as you like.


Debugger commands
=================

�Nc@seZdZdZdS)�RestartzBCauses a debugger to be restarted for the debugged python program.N)�__name__�
__module__�__qualname__�__doc__�rr�(/opt/alt/python35/lib64/python3.5/pdb.pyrTsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpcCs�tjdtj|��}yt|�}Wntk
rDdSYnX|�Dx<t|dd�D](\}}|j|�r_|||fSq_WWdQRXdS)Nzdef\s+%s\s*[(]�start�)�re�compile�escape�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function[s
	r cCsztj|�\}}tj|�r@|j|jkr@|dfStj|�rY|dfStj||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelineshs!

r&cCsJttj|��}|j�x$|D]\}}||kr&|Sq&WdS)Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenoqs
r,c@s"eZdZdZdd�ZdS)�_rstrz#String that doesn't quote its repr.cCs|S)Nr)�selfrrr�__repr__|sz_rstr.__repr__N)rrrrr/rrrrr-zsr-z
-> c@s�eZdZdZddddddd�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%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZeZd6d7d8�Zd9d:�ZeZ eZ!eZ"d;d<�Z#eZ$d=d>�Z%d?d@�Z&dAdB�Z'eZ(dCdD�Z)eZ*dEdF�Z+eZ,dGdH�Z-eZ.dIdJ�Z/e/Z0eZ1eZ2dKdL�Z3e3Z4e3Z5dMdN�Z6dOdP�Z7e7Z8dQdR�Z9e9Z:dSdT�Z;e;Z<dUdV�Z=e=Z>dWdX�Z?e?Z@dYdZ�ZAeAZBd[d\�ZCeCZDd]d^�ZEeEZFZGd_d`�ZHeHZIdadb�ZJeZKdcdd�ZLeLZMeLZNdedf�ZOdgdh�ZPePZQdidj�ZReRZSdkdl�ZTddmdn�ZUdodp�ZVdqdr�ZWeZXeZYeZZdsdt�Z[e[Z\dudv�Z]e]Z^dwdx�Z_eZ`fddydz�Zad{d|�ZbeZcd}d~�ZdeZedd��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmend�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��ZudS)�rNZtabFc	$Cs�tjj|d|�tjj||||�|r>d|_d|_i|_i|_d|_	d|_
i|_yddl}|j
d�Wntk
r�YnXd|_||_g|_dtjkr+tjd}y9ttjj|d���}|jj|�WdQRXWntk
r*YnXy*td��}|jj|�WdQRXWntk
riYnXi|_i|_i|_d|_d|_dS)	N�skiprz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?�HOMEz.pdbrc)�bdb�Bdb�__init__�cmd�CmdZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLines�os�environr�path�join�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)	r.�completekey�stdin�stdoutr0rAr>ZenvHomeZrcFilerrrr5�sF							
			


				zPdb.__init__cCs7|jrt�|jd�|j�|j|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)r@�KeyboardInterrupt�message�set_stepr)r.Zsignum�framerrr�sigint_handler�s
	

zPdb.sigint_handlercCstjj|�|j�dS)N)r3r4�reset�forget)r.rrrrU�sz	Pdb.resetcCs5d|_g|_d|_d|_|jj�dS)Nr)r�stack�curindex�curframer=�clear)r.rrrrV�s
				z
Pdb.forgetcCs�|j�|j||�\|_|_x;|ret|jj|j�}||j|j<|j	}q+W|j|jd|_
|j
j|_|j
�S)Nr)rVZ	get_stackrWrXr,�tb_frame�f_code�tb_lastir=�tb_nextrYr#�curframe_locals�execRcLines)r.�f�tbrrrr�setup�s
	
z	Pdb.setupcCs�|js
dS|j}|j�g|_xZ|r�|j�j�}|r,|ddkr,|j|�r,|jt|�7_dSq,WdS)Nr�#T)rBr)�pop�strip�onecmd�reversed)r.rBrrrrr`�s		
		zPdb.execRcLinescCs=|jr
dS|j|�r9|jd�|j|d�dS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nz--Call--)r<Z	stop_hererQ�interaction)r.rSZ
argument_listrrr�	user_call�s
	
z
Pdb.user_callcCsf|jrC|j|j|jj�ks6|jdkr:dSd|_|j|�rb|j|d�dS)z;This function is called when we stop or break at this line.rNF)r<r;�canonicr\�co_filename�f_lineno�bp_commandsri)r.rSrrr�	user_line�s		z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|j|d�x"|j|D]}|j|�q]W||_|j|s�|j|j|j	�|j
|r�|j�|j�dSdS)z�Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise.�	currentbpFrNr)
�getattrrprH�lastcmdrcrgrJ�print_stack_entryrWrXrI�_cmdlooprV)r.rSrpZlastcmd_backrrrrrns 				



zPdb.bp_commandscCs;|jr
dS||jd<|jd�|j|d�dS)z7This function is called when a return trap is set here.N�
__return__z
--Return--)r<r#rQri)r.rSZreturn_valuerrr�user_returns
	

zPdb.user_returncCs�|jr
dS|\}}}||f|jd<|rH|tkrHdnd}|jd|tj||�dj�f�|j||�dS)zoThis function is called if an exception occurs,
        but only if we are to stop at or just below this level.NZ
__exception__z	Internal r1z%s%sr���)r<r#�
StopIterationrQ�	traceback�format_exception_onlyrfri)r.rS�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception%s	!zPdb.user_exceptioncCsNxGy!d|_|j�d|_PWqtk
rE|jd�YqXqWdS)NTFz--KeyboardInterrupt--)r@�cmdlooprPrQ)r.rrrrt9s	
	
zPdb._cmdloopcCs�|jj|j�}|r�xe|j�D]W\}}|j|�}||k	r(||kr(|||<|jd|||f�q(WdS)Nzdisplay %s: %r  [old: %r])r:�getrY�items�_getval_exceptrQ)r.r:�exprZoldvalueZnewvaluerrr�preloopFs
	zPdb.preloopcCswtjr(tjtjtj�dt_|j||�rH|j�dS|j|j|j�|j	�|j�dS)N)
r�_previous_sigint_handler�signal�SIGINTrcrVrsrWrXrt)r.rSryrrrriSs		

zPdb.interactioncCs#|dk	r|jt|��dS)z{Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N)rQ�repr)r.r$rrr�displayhookaszPdb.displayhookc	Cs|dd�dkr&|dd�}|j}|jj}y�t|ddd�}tj}tj}tj}z8|jt_|jt_|jt_t|||�Wd|t_|t_|t_XWn>tj	�dd�}|j
tj|�dj
��YnXdS)Nr�!�
z<stdin>Zsingle�rw)r_rYr"r�sysrOrNr��execr{�errorryrzrf)	r.r�locals�globalsr*Zsave_stdoutZ
save_stdinZsave_displayhookr{rrr�defaultis(						zPdb.defaultcCs.|j�s|S|j�}x�|d|jkr�|j|d}d}x>|dd�D],}|jdt|�|�}|d7}qZW|jddj|dd���}|j�}qW|ddkr*|jd�}|dkr*||d	d�j�}|jj	|�|d|�j
�}|S)
z*Handle alias expansion and ';;' separator.rrN�%z%*� �aliasz;;r�)rf�splitr9�replace�strrF�find�lstrip�cmdqueue�append�rstrip)r.r�argsZiiZtmpArgZmarker�nextrrr�precmds&	%z
Pdb.precmdcCs-|jstjj||�S|j|�SdS)z�Interpret the argument as though it had been typed in response
        to the prompt.

        Checks whether this line is typed at the normal prompt or in
        a breakpoint command list definition.
        N)rKr6r7rg�handle_command_def)r.rrrrrg�s	z
Pdb.onecmdcCs�|j|�\}}}|s"dS|dkrBd|j|j<dS|dkr[g|_dS|j|j}|r�|j|d|�n
|j|�yt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)	z8Handles one command line during command list definition.NZsilentT�endrr��do_F)Z	parselinerJrLr�rHr�rq�AttributeErrorr�r�commands_resumingrI)r.rr6�argZcmdlist�funcrrrr��s,	

	zPdb.handle_command_defcCst|d|j�dS)N�file)�printrO)r.�msgrrrrQ�szPdb.messagecCstd|d|j�dS)Nz***r�)r�rO)r.r�rrrr��sz	Pdb.errorcCs�|j�jd�rgSy|j||||�}Wntk
rOg}YnXtj|d�}xl|D]d}tjj|�r�|j|d�qjtjj	|�rj|j
�jd�rj|j|d�qjW|S)	N�:�,�*�/�.py�.pyw)r�r�)r�r�)rf�endswith�_complete_expression�	Exception�globrCrE�isdirr��isfile�lower)r.�textr�begidx�endidxZret�globs�fnrrr�_complete_location�s

'zPdb._complete_locationcs#�fdd�ttjj�D�S)NcsCg|]9\}}|dk	rt|�j��rt|��qS)N)r��
startswith)�.0r+�bp)r�rr�
<listcomp>�s		z*Pdb._complete_bpnumber.<locals>.<listcomp>)rr3�
Breakpoint�
bpbynumber)r.r�rr�r�r)r�r�_complete_bpnumber�szPdb._complete_bpnumbercs|js
gS|jjj�}|j|j�d�kr��jd��y<|�d}x'�dd�D]}t||�}qlWWnttfk
r�gSYnXdj	�dd��d���fdd�t
|�D�S�fdd�|j�D�SdS)	N�.rrcs-g|]#}|j�d�r�|�qS)rrw)r�)r��n)�dottedrrrr��s	z,Pdb._complete_expression.<locals>.<listcomp>cs%g|]}|j��r|�qSr)r�)r�r�)r�rrr��s	rwrw)rYr"�copy�updater_r�rq�KeyErrorr�rF�dir�keys)r.r�rr�r��nsr$�partr)r�rr�rr��s		 zPdb._complete_expressioncCsz|sttjj�d}n,yt|�}Wn|jd�dSYnX||_||jkr�|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_z�y|j�Wnyt
k
r^|r/|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|jd	�YnXWdd|_||_
XdS)
a4commands [bpnumber]
        (com) ...
        (com) end
        (Pdb)

        Specify a list of commands for breakpoint number bpnumber.
        The commands themselves are entered on the following lines.
        Type a line containing just 'end' to terminate the commands.
        The commands are executed when the breakpoint is hit.

        To remove all commands from a breakpoint, type commands and
        follow it immediately with end; that is, give no commands.

        With no bpnumber argument, commands refers to the last
        breakpoint set.

        You can use breakpoint commands to start your program up
        again.  Simply use the continue command, or step, or any other
        command that resumes execution.

        Specifying any command resuming execution (currently continue,
        step, next, return, jump, quit and their abbreviations)
        terminates the command list (as if that command was
        immediately followed by end).  This is because any time you
        resume execution (even with a simple next or step), you may
        encounter another breakpoint -- which could have its own
        command list, leading to ambiguities about which list to
        execute.

        If you use the 'silent' command in the command list, the usual
        message about stopping at a breakpoint is not printed.  This
        may be desirable for breakpoints that are to print a specific
        message and then continue.  If none of the other commands
        print anything, you will see no sign that the breakpoint was
        reached.
        rz.Usage: commands [bnum]
        ...
        endNTFz(com) rr�z1command definition aborted, old commands restored)�lenr3r�r��intr�rLrHrIrJr8rKr�rP)r.r�ZbnumZold_command_defsZprompt_backrrr�do_commandss@%
		




			



	zPdb.do_commandsrcCs�|sP|jrL|jd�x-tjjD]}|r)|j|j��q)WdSd}d}d}|jd�}|dkr�||dd�j�}|d|�j�}|j	d�}d}	|dkrk|d|�j�}|j
|�}
|
s|jd|�dS|
}||dd�j�}yt|�}WqPt
k
rg|jd|�dSYqPXn�yt|�}Wn�t
k
rOyt||jj|j�}Wn|}YnXy@t|d	�r�|j}|j}|j}	|j}|j}WnM|j|�\}
}}|
s4|jd
|�dS|
}	t|�}YnXYnX|sb|j�}|j||�}|r�|j|||||	�}|r�|j|�n9|j||�d}|jd|j|j|jf�dS)
a�b(reak) [ ([filename:]lineno | function) [, condition] ]
        Without argument, list all breaks.

        With a line number argument, set a break at this line in the
        current file.  With a function name, set a break at the first
        executable line of that function.  If a second argument is
        present, it is a string specifying an expression which must
        evaluate to true before the breakpoint is honored.

        The line number may be prefixed with a filename and a colon,
        to specify a breakpoint in another file (probably one that
        hasn't been loaded yet).  The file is searched for on
        sys.path; the .py suffix may be omitted.
        z!Num Type         Disp Enb   WhereNr�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drw) �breaksrQr3r�r�Zbpformatr�r�r��rfind�lookupmoduler�r��
ValueError�evalrYr"r_�hasattrr��__code__�co_name�co_firstlinenorl�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r)r.r�Z	temporaryr�rr�condZcommaZcolonrrar�r*�ok�lnr�errrrr�do_breakRs~	


					
		zPdb.do_breakcCs1|jjj}|dkr-|jr-|j}|S)zProduce a reasonable default.z<string>)rYr\rlr;)r.rrrrr��s	zPdb.defaultFilecCs|j|d�dS)z�tbreak [ ([filename:]lineno | function) [, condition] ]
        Same arguments as break, but sets a temporary breakpoint: it
        is automatically deleted when first hit.
        rN)r�)r.r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Csd}|jd�}t|�dkr:|dj�}n)t|�dkr_|dj�}n|S|dkrs|S|jd�}|ddkr�|d=t|�dkr�|S|j�}t|�dkr�|d}n)|j|d�}|r�|}|d}t||�}	|	p|S)	N�'rr�r1r�r.)NNN)r�r�rfr�r�r )
r.Z
identifierZfailedZidstring�id�partsZfname�itemraZanswerrrrr��s.

zPdb.lineinfocCs�t|d�r|jjnd}tj|||�}|sM|jd�dS|j�}|s�|ddks�|dd�dks�|dd�dkr�|jd	�dS|S)
z�Check whether specified line seems to be executable.

        Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
        line or EOF). Warning: testing is not comprehensive.
        rYNzEnd of filerrdr�z"""z'''zBlank or comment)r�rYr"�	linecache�getlinerQrfr�)r.rrr�rrrrr��s!
,
z
Pdb.checklinecCs�|j�}xq|D]i}y|j|�}Wn2tk
r`}z|j|�WYdd}~XqX|j�|jd|�qWdS)z�enable bpnumber [bpnumber ...]
        Enables the breakpoints given as a space separated list of
        breakpoint numbers.
        Nz
Enabled %s)r��get_bpbynumberr�r��enablerQ)r.r�r�r+r�r�rrr�	do_enable�s
 
z
Pdb.do_enablecCs�|j�}xq|D]i}y|j|�}Wn2tk
r`}z|j|�WYdd}~XqX|j�|jd|�qWdS)aNdisable bpnumber [bpnumber ...]
        Disables the breakpoints given as a space separated list of
        breakpoint numbers.  Disabling a breakpoint means it cannot
        cause the program to stop execution, but unlike clearing a
        breakpoint, it remains in the list of breakpoints and can be
        (re-)enabled.
        NzDisabled %s)r�r�r�r��disablerQ)r.r�r�r+r�r�rrr�
do_disables
 
zPdb.do_disablecCs�|jdd�}y|d}Wntk
r:d}YnXy|j|dj��}WnPtk
ry|jd�Ynltk
r�}z|j|�WYdd}~Xn;X||_|s�|jd|j�n|jd|j�dS)a#condition bpnumber [condition]
        Set a new condition for the breakpoint, an expression which
        must evaluate to true before the breakpoint is honored.  If
        condition is absent, any existing condition is removed; i.e.,
        the breakpoint is made unconditional.
        r�rNrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rfr�r�r�rQr�)r.r�r�r�r�r�rrr�do_conditions

 	zPdb.do_conditioncCs|j�}yt|dj��}Wnd}YnXy|j|dj��}WnPtk
ru|jd�Yn�tk
r�}z|j|�WYdd}~XnfX||_|dkr�|dkr�d|}nd}|jd||j	f�n|jd|j	�dS)	a�ignore bpnumber [count]
        Set the ignore count for the given breakpoint number.  If
        count is omitted, the ignore count is set to 0.  A breakpoint
        becomes active when the ignore count is zero.  When non-zero,
        the count is decremented each time the breakpoint is reached
        and the breakpoint is not disabled and any associated
        condition evaluates to true.
        rrzBreakpoint number expectedNz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rfr�r�r�r��ignorerQr�)r.r�r��countr�r�Zcountstrrrr�	do_ignore:s(	
 	
		z
Pdb.do_ignorec
!Cs�|s�ytd�}Wntk
r0d}YnX|j�j�}|dkr�dd�tjjD�}|j�x|D]}|jd|�qyWdSd	|krf|j	d	�}|d|�}||d
d�}yt
|�}Wntk
rd|}Yn%X|j||�}|j
||�}|r@|j|�n"x|D]}|jd|�qGWdS|j�}	xt|	D]l}y|j|�}Wn2tk
r�}z|j|�WYdd}~XqyX|j|�|jd|�qyWdS)
a=cl(ear) filename:lineno
cl(ear) [bpnumber [bpnumber...]]
        With a space separated list of breakpoint numbers, clear
        those breakpoints.  Without argument, clear all breaks (but
        first ask confirmation).  With a filename:lineno argument,
        clear all breaks at that line in that file.
        zClear all breaks? �no�y�yescSsg|]}|r|�qSrr)r�r�rrrr�ks	z Pdb.do_clear.<locals>.<listcomp>z
Deleted %sNr�rzInvalid line number (%s))r�r�)�input�EOFErrorrfr�r3r�r�Zclear_all_breaksrQr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r.r�ZreplyZbplistr�r+rrr�Z
numberlistrrr�do_clear]sF





 
zPdb.do_clearcCs|j�dS)z�w(here)
        Print a stack trace, with the most recent frame at the bottom.
        An arrow indicates the "current frame", which determines the
        context of most commands.  'bt' is an alias for this command.
        N)�print_stack_trace)r.r�rrr�do_where�szPdb.do_wherecCs~d|ko t|j�kns+t�||_|j|jd|_|jj|_|j|j|j�d|_dS)Nr)	r�rW�AssertionErrorrXrYr#r_rsr)r.r�rrr�
_select_frame�s+	zPdb._select_framecCs�|jdkr |jd�dSyt|p/d�}Wn'tk
r_|jd|�dSYnX|dkrud}ntd|j|�}|j|�dS)z�u(p) [count]
        Move the current frame count (default one) levels up in the
        stack trace (to an older frame).
        rzOldest frameNrzInvalid frame count (%s))rXr�r�r��maxr)r.r�r��newframerrr�do_up�s

		z	Pdb.do_upcCs�|jdt|j�kr-|jd�dSyt|p<d�}Wn'tk
rl|jd|�dSYnX|dkr�t|j�d}n#tt|j�d|j|�}|j|�dS)z�d(own) [count]
        Move the current frame count (default one) levels down in the
        stack trace (to a newer frame).
        rzNewest frameNzInvalid frame count (%s)r)rXr�rWr�r�r��minr)r.r�r�rrrr�do_down�s

	#zPdb.do_downcCs�|rfyt|�}Wn'tk
r?|jd|�dSYnX||jjkrl|jd�dSnd}|j|j|�dS)aNunt(il) [lineno]
        Without argument, continue execution until the line with a
        number greater than the current one is reached.  With a line
        number, continue execution until a line with a number greater
        or equal to that is reached.  In both cases, also stop when
        the current frame returns.
        zError in argument: %rNz7"until" line number is smaller than current line numberr)r�r�r�rYrmZ	set_until)r.r�rrrr�do_until�s
	
zPdb.do_untilcCs|j�dS)z�s(tep)
        Execute the current line, stop at the first possible occasion
        (either in a function that is called or in the current
        function).
        r)rR)r.r�rrr�do_step�s
zPdb.do_stepcCs|j|j�dS)zxn(ext)
        Continue execution until the next line in the current function
        is reached or it returns.
        r)Zset_nextrY)r.r�rrr�do_next�szPdb.do_nextcCsT|rJddl}tjdd�}|j|�t_|tjdd�<t�dS)arun [args...]
        Restart the debugged python program. If a string is supplied
        it is split with "shlex", and the result is used as the new
        sys.argv.  History, breakpoints, actions and debugger options
        are preserved.  "restart" is an alias for "run".
        rNr)�shlexr��argvr�r)r.r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|j|j�dS)zPr(eturn)
        Continue execution until the current function returns.
        r)Z
set_returnrY)r.r�rrr�	do_returnsz
Pdb.do_returncCsK|js=ytjtj|j�t_Wntk
r<YnX|j�dS)z]c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        r)rAr�r�rTrr�r�Zset_continue)r.r�rrr�do_continues	

zPdb.do_continuecCs�|jdt|j�kr-|jd�dSyt|�}Wntk
r^|jd�Yn�XyK||j_|j|jd|f|j|j<|j|j|j�Wn6tk
r�}z|jd|�WYdd}~XnXdS)a�j(ump) lineno
        Set the next line that will be executed.  Only available in
        the bottom-most frame.  This lets you jump back and execute
        code again, or jump forward to skip code that you don't want
        to run.

        It should be noted that not all jumps are allowed -- for
        instance it is not possible to jump into the middle of a
        for loop or out of a finally clause.
        rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s)	rXr�rWr�r�r�rYrmrs)r.r��errr�do_jump s

$zPdb.do_jumpcCs�tjd�|jj}|j}t|j|j|j�}d|j	j
�|_	|jd�tj|j
|||f�|jd�tj|j�|j|_dS)z�debug code
        Enter a recursive debugger that steps through the code
        argument (which is an arbitrary expression or statement to be
        executed in the current environment).
        Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)r��settracerYr"r_rrMrNrOr8rfrQ�call_tracingr	Ztrace_dispatchrr)r.r�r�r��prrr�do_debug=s
	

zPdb.do_debugcCsd|_|j�dS)z[q(uit)
exit
        Quit from the debugger. The program being executed is aborted.
        Tr)�_user_requested_quit�set_quit)r.r�rrr�do_quitPs	
zPdb.do_quitcCs$|jd�d|_|j�dS)z=EOF
        Handles the receipt of EOF as a command.
        r1Tr)rQrr)r.r�rrr�do_EOF[s
	
z
Pdb.do_EOFcCs�|jj}|j}|j}|jd@r5|d}|jd@rL|d}x_t|�D]Q}|j|}||kr�|jd|||f�qY|jd|f�qYWdS)zHa(rgs)
        Print the argument list of the current function.
        �r�z%s = %rz%s = *** undefined ***N)rYr\r_�co_argcount�co_flags�range�co_varnamesrQ)r.r��co�dictr�r+�namerrr�do_argsds		




zPdb.do_argscCs=d|jkr,|jt|jd��n
|jd�dS)zQretval
        Print the return value for the last return of a function.
        ruzNot yet returned!N)r_rQr�r�)r.r�rrr�	do_retvalusz
Pdb.do_retvalc
Cseyt||jj|j�SWnAtj�dd�}|jtj|�dj	���YnXdS)Nr�rrw)
r�rYr"r_r�r{r�ryrzrf)r.r�r{rrr�_getvals zPdb._getvalc
Cs�y?|dkr(t||jj|j�St||j|j�SWnEtj�dd�}tj|�dj	�}t
d|�SYnXdS)Nr�rz** raised %s **rw)r�rYr"r_r#r�r{ryrzrfr-)r.r�rSr{r�rrrr��szPdb._getval_exceptc
Cs/y |jt|j|���WnYnXdS)z@p expression
        Print the value of the expression.
        N)rQr�r&)r.r�rrr�do_p�s zPdb.do_pc
Cs2y#|jtj|j|���WnYnXdS)zHpp expression
        Pretty-print the value of the expression.
        N)rQ�pprintZpformatr&)r.r�rrr�do_pp�s#z	Pdb.do_ppcCs�d|_d}|r�|dkr�y�d|kr�|jd�\}}t|j��}t|j��}||kr�||}n%t|j��}td|d�}Wqtk
r�|jd|�dSYqXnD|jdks�|dkrtd|jj	d�}n
|jd}|dkr/|d}|jj
j}|j|�}yzt
j||jj�}|j||d|�|||j�t|t|��|_t|�|kr�|jd	�Wntk
r�YnXdS)
a�l(ist) [first [,last] | .]

        List source code for the current file.  Without arguments,
        list 11 lines around the current line or continue the previous
        listing.  With . as argument, list 11 lines around the current
        line.  With one argument, list 11 lines starting at that line.
        With two arguments, list the given range; if the second
        argument is less than the first, it is a count.

        The current line in the current frame is indicated by "->".
        If an exception is being debugged, the line where the
        exception was originally raised or propagated is indicated by
        ">>", if it differs from the current line.
        r'Nr�r�r�zError in argument: %r�
z[EOF])rrr�r�rfrr�r�rrYrmr\rl�get_file_breaksr��getlinesr"�_print_linesrr�rQrP)r.r�Zlast�firstr�	breaklistr%rrr�do_list�s>	





zPdb.do_listcCs�|jjj}|j|�}yt|j�\}}Wn6tk
ro}z|j|�dSWYdd}~XnX|j||||j�dS)z\longlist | ll
        List the whole source code for the current function or frame.
        N)rYr\rlr,r&rr�r.)r.r�rr0r%rr�rrr�do_longlist�s
zPdb.do_longlistcCs�y|j|�}WndSYnXyt|�\}}Wn<ttfk
rv}z|j|�dSWYdd}~XnX|j||�dS)z^source expression
        Try to get source code for the given object and display it.
        N)r&r&r�	TypeErrorr�r.)r.r�r$r%rr�rrr�	do_source�s	
z
Pdb.do_sourcec
Cs�|r'|j}|jj|d
�}n
d}}x�t||�D]�\}}t|�jd�}	t|	�dkr~|	d7}	||kr�|	d7}	n
|	d7}	||kr�|	d7}	n||kr�|	d7}	|j|	d|j��qAWd	S)zPrint a range of lines.rr�rr��Bz->z>>�	Nrwrw)	rmr=r�rr��rjustr�rQr�)
r.r%rr�rSZcurrent_linenoZ
exc_linenorr�srrrr.�s 	





zPdb._print_linescCs�y|j|�}WndSYnXd}y
|j}Wntk
rIYnX|rh|jd|j�dSy|jj}Wntk
r�YnX|r�|jd|j�dS|jtkr�|jd|j|j	f�dS|jt|��dS)z;whatis arg
        Print the type of the argument.
        NzFunction %sz	Method %szClass %s.%s)
r&r�r�rQr�r��	__class__�typerr)r.r��valuer*rrr�	do_whatiss.	


z
Pdb.do_whatiscCs�|sP|jd�x||jj|ji�j�D]}|jd|�q2WnB|j|�}||jj|ji�|<|jd||f�dS)z�display [expression]

        Display the value of the expression if it changed, each time execution
        stops in the current frame.

        Without expression, list all display expressions for the current frame.
        zCurrently displaying:z%s: %rzdisplay %s: %rN)rQr:r�rYr�r��
setdefault)r.r�r��valrrr�
do_display2s
%zPdb.do_displaycCsf|rLy|jj|ji�|=Wqbtk
rH|jd|�YqbXn|jj|jd�dS)z�undisplay [expression]

        Do not display the expression any more in the current frame.

        Without expression, clear all display expressions for the current frame.
        znot displaying %sN)r:r�rYr�r�re)r.r�rrr�do_undisplayEs
zPdb.do_undisplaycs)�fdd�|jj|ji�D�S)Ncs%g|]}|j��r|�qSr)r�)r�r)r�rrr�Us	z*Pdb.complete_undisplay.<locals>.<listcomp>)r:r�rY)r.r�rr�r�r)r�r�complete_undisplayTszPdb.complete_undisplaycCs9|jjj�}|j|j�tjdd|�dS)z�interact

        Start an interactive interpreter whose global namespace
        contains all the (global and local) names found in the current scope.
        z
*interactive*ZlocalN)rYr"r�r�r_r*�interact)r.r�r�rrr�do_interactXszPdb.do_interactcCs�|j�}t|�dkrft|jj��}x,|D]$}|jd||j|f�q:WdS|d|jkr�t|�dkr�|jd|d|j|df�n$dj|dd��|j|d<dS)acalias [name [command [parameter parameter ...] ]]
        Create an alias called 'name' that executes 'command'.  The
        command must *not* be enclosed in quotes.  Replaceable
        parameters can be indicated by %1, %2, and so on, while %* is
        replaced by all the parameters.  If no command is given, the
        current alias for name is shown. If no name is given, all
        aliases are listed.

        Aliases may be nested and can contain anything that can be
        legally typed at the pdb prompt.  Note!  You *can* override
        internal pdb commands with aliases!  Those internal commands
        are then hidden until the alias is removed.  Aliasing is
        recursively applied to the first word of the command line; all
        other words in the line are left alone.

        As an example, here are two useful aliases (especially when
        placed in the .pdbrc file):

        # Print instance variables (usage "pi classInst")
        alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
        # Print instance variables in self
        alias ps pi self
        rz%s = %sNrr�)r�r��sortedr9r�rQrF)r.r�r�r�r�rrr�do_aliasbs
"%)zPdb.do_aliascCsG|j�}t|�dkr"dS|d|jkrC|j|d=dS)z9unalias name
        Delete the specified alias.
        rN)r�r�r9)r.r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncs%g|]}|j��r|�qSr)r�)r��a)r�rrr��s	z(Pdb.complete_unalias.<locals>.<listcomp>)r9)r.r�rr�r�r)r�r�complete_unalias�szPdb.complete_unaliasrr
rrrrcCs>y%x|jD]}|j|�q
WWntk
r9YnXdS)N)rWrsrP)r.�frame_linenorrrr�s

zPdb.print_stack_tracecCsK|\}}||jkr$d}nd}|j||j||��dS)Nz> z  )rYrQZformat_stack_entry)r.rIZ
prompt_prefixrSrrrrrrs�s		zPdb.print_stack_entrycCs�|stjj||�SyJyt|d|�}|�SWn%tk
rat|d|�}YnXWn#tk
r�|jd|�Yn>Xtjjdkr�|jd|�dS|j	|j
j��dS)z�h(elp)
        Without argument, print the list of available commands.
        With a command name as argument, print help about that command.
        "help pdb" shows the full pdb documentation.
        "help exec" gives help on the ! command.
        Zhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command helpN)r6r7�do_helprqr�r�r��flags�optimizerQrr�)r.r�ZtopicZcommandrrrrJ�s

	zPdb.do_helpcCs#|j|jjpdj��dS)a�(!) statement
        Execute the (one-line) statement in the context of the current
        stack frame.  The exclamation point can be omitted unless the
        first word of the statement resembles a debugger command.  To
        assign to a global variable you must always prefix the command
        with a 'global' command, e.g.:
        (Pdb) global list_options; list_options = ['-l']
        (Pdb)
        r1N)rQ�	help_execrrf)r.rrrrM�s
z
Pdb.help_execcCst�dS)N)r)r.rrr�help_pdb�szPdb.help_pdbcCs!tjj|�r(tjj|�r(|Stjjtjd|�}tjj|�rr|j|�|jkrr|Stjj|�\}}|dkr�|d}tjj|�r�|SxdtjD]Y}x%tjj	|�r�tj
|�}q�Wtjj||�}tjj|�r�|Sq�WdS)z�Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        rr1z.pyN)rCrE�isabs�existsrFr�rkr;�splitext�islink�readlink)r.rra�rootZext�dirname�fullnamerrrr��s"$*
zPdb.lookupmodulec
Cs�ddl}|jj�|jjddd|dti�d|_|j|�|_d|_t	|d�� }d	|j
�|jf}WdQRX|j|�dS)
Nrr�__main__�__file__�__builtins__TF�rbzexec(compile(%r, %r, 'exec')))rW�__dict__rZr�rYr<rkr;rr�readr	)r.rrWr�	statementrrr�
_runscript�s

		zPdb._runscript)vrrrr�r5rTrUrVrcr`rjrornrvr�rtr�rir�r�r�rgr�rQr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disabler�Zcomplete_conditionr�Zcomplete_ignorer�Zdo_clZcomplete_clearZcomplete_clrZdo_wZdo_btrrZdo_urZdo_dr	Zdo_untr
Zdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr$Zdo_ar%Zdo_rvr&r�r'r)Zcomplete_printZ
complete_pZcomplete_ppr1Zdo_lr2Zdo_llr4Zcomplete_sourcer.r<Zcomplete_whatisr?Zcomplete_displayr@rArCrErFrHr�r�line_prefixrsrJZdo_hrMrNr�r^rrrrr�s�.	


M]!!.
			1!
#	
ZwhereZdownZup�breakZtbreakrZr�r�r�Z	conditionrH�stepr�ZuntilZjump�returnZretval�continuer'Zlonglistr�rZppZwhatis�sourceZdisplayZ	undisplayrBr�Zunalias�debug�quitr�z

cCst�j|||�dS)N)rr	)r]r�r�rrrr	!scCst�j|||�S)N)rr)Z
expressionr�r�rrrr$scCst|||�dS)N)r	)r]r�r�rrrr
'scOst�j||�S)N)rr)r��kwdsrrrr+scCst�jtj�j�dS)N)rrr��	_getframe�f_backrrrrr.scCs[|dkrtj�d}|dkr4td��t�}|j�|jd|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r�r{r�rrUri)�trrrrr3s	
cCsttj�dS)N)rr��last_tracebackrrrrr
Aszimport x; x.main()cCstt�dS)N)r	�TESTCMDrrrr�testIsrmcCsddl}|jt�dS)Nr)�pydocZpagerr)rnrrrrMsa�usage: pdb.py [-c command] ... pyfile [arg] ...

Debug the Python program given by pyfile.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c	CsNddl}|jtjdd�dddg�\}}|sWtt�tjd�g}xP|D]H\}}|dkr�tt�tj�qd|dkrd|j|�qdW|d}tjj	|�s�td
|d�tjd�|tjdd�<tjj
|�tjd<t�}|jj
|�xy%|j|�|jrKPtd�Wq1tk
r�td
|d�tddj|��Yq1tk
r�tddd�ttj�d�Yq1tk
r�tj�tjd�Yq1tj�td�td�tj�d}|jd|�td|d�Yq1Xq1WdS)Nrrzhc:�--helpz
--command=r��-h�-c�	--commandzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:r6r�z/The program exited via sys.exit(). Exit status:r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rpro)rqrr)�getoptr�r
r��_usage�exitr�rCrErPrUrrBrGr^rrrF�
SystemExitr{�SyntaxErrorry�	print_excri)	rsZoptsr�rHZoptZoptargr;�pdbrjrrr�main^sV.





	
	







rzrW)-rrCrr�r6r3r(r*r�r(r�r!ryr�r�r�__all__r r&r,r�r-r_r4r7rZ_help_orderZ_commandrqrfrMr	rr
rrrr
rlrmrrtrzrryrrrr�<module>Ash
		������
(<