ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/pdb.cpython-38.pyc

U

.��c��"@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZGdd�de�Zddddd	d
ddd
g	Zdd�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�rnd
ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"ZeD]"Zeeed8e�j��d97Z�q:eej j7Z[[dJd:d�Z!dKd;d�Z"d<d	�Z#d=d
�Z$dd>�d?d�Z%dLd@d�Z&dAd�Z'dBZ(dCdD�Z)dEd
�Z*dFZ+dGdH�Z,e-dIk�r�ddl.Z.e.�,�dS)Ma�	
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.  This behavior can be
disabled by passing the "readrc=False" argument to the Pdb constructor.

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/python38/lib64/python3.8/pdb.pyrWsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpc
Cs�t�dt�|��}zt�|�}Wntk
r8YdSX|�@t|dd�D],\}}|�|�rL|||fW5QR�SqLW5QRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�tokenize�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function^s
&r!cCsXt�|�\}}t�|�r,|j|jkr,|dfSt�|�r>|dfSt�||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesks
r'cCs8tt�|��}|��|D]\}}||kr|SqdS�Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenots
r.c@seZdZdZdd�ZdS)�_rstrz#String that doesn't quote its repr.cCs|S�Nr��selfrrr�__repr__sz_rstr.__repr__N)rrrrr3rrrrr/}sr/z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�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/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`d�d{d|�Zad}d~�ZbeZcdd��ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��ZvdS)�rN�tabFTc		Cs>tjj||d�tj�||||�t�d�|r6d|_d|_i|_	i|_
d|_d|_i|_
zddl}|�d�Wntk
r�YnXd|_||_g|_|�rz,ttj�d���}|j�|�W5QRXWntk
r�YnXz$td	��}|j�|�W5QRXWntk
�rYnXi|_i|_i|_d|_d|_dS)
N)�skipzpdb.Pdbrz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrcz.pdbrc)�bdb�Bdb�__init__�cmd�Cmd�sys�auditZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLinesr�os�path�
expanduser�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)	r2�completekey�stdin�stdoutr5rGZreadrcrDZrcFilerrrr9�sF

zPdb.__init__cCs*|jr
t�|�d�|��|�|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)rF�KeyboardInterrupt�message�set_stepr)r2Zsignum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstj�|�|��dSr0)r7r8�reset�forgetr1rrrrZ�sz	Pdb.resetcCs&d|_g|_d|_d|_|j��dSr()r�stack�curindex�curframerC�clearr1rrrr[�s
z
Pdb.forgetcCsh|��|�||�\|_|_|rDt|jj|j�}||j|j<|j	}q|j|jd|_
|j
j|_|�
�Sr()r[Z	get_stackr\r]r.�tb_frame�f_code�tb_lastirC�tb_nextr^r$�curframe_locals�execRcLines)r2�f�tbrrrr�setup�s
z	Pdb.setupcCsd|js
dS|j}|��g|_|r`|����}|r|ddkr|�|�r|jt|�7_dSqdS)Nr�#T)rHr+�pop�strip�onecmd�reversed)r2rHr rrrre�s
zPdb.execRcLinescCs.|jr
dS|�|�r*|�d�|�|d�dS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nz--Call--)rBZ	stop_hererV�interaction)r2rXZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|�|jj�ks$|jdkr(dSd|_|�|�rD|�|d�dS)z;This function is called when we stop or break at this line.rNF)rBrA�canonicra�co_filename�f_lineno�bp_commandsrn)r2rXrrr�	user_line�s�
z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|�|d�|j|D]}|�|�q@||_|j|sr|�|j|j	�|j
|r�|��|��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)
�getattrrurM�lastcmdrhrlrO�print_stack_entryr\r]rN�_cmdloopr[)r2rXruZlastcmd_backr rrrrss"
�

zPdb.bp_commandscCs.|jr
dS||jd<|�d�|�|d�dS)z7This function is called when a return trap is set here.N�
__return__z
--Return--)rBr$rVrn)r2rXZreturn_valuerrr�user_return s


zPdb.user_returncCsh|jr
dS|\}}}||f|jd<|s2|tkr2dnd}|�d|t�||�d��f�|�||�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 r6z%s%s���)rBr$�
StopIterationrV�	traceback�format_exception_onlyrkrn)r2rX�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception(s
���zPdb.user_exceptioncCsBzd|_|��d|_Wq>Wqtk
r:|�d�YqXqdS)NTFz--KeyboardInterrupt--)rF�cmdlooprUrVr1rrrry<szPdb._cmdloopcCs^|j�|j�}|rZ|��D]>\}}|�|�}||k	r||kr|||<|�d|||f�qdS)Nzdisplay %s: %r  [old: %r])r@�getr^�items�_getval_exceptrV)r2r@�exprZoldvalueZnewvaluerrr�preloopIs
�zPdb.preloopcCsttjr6zt�tjtj�Wntk
r.YnXdt_|�||�rN|��dS|�|j|j	�|�
�|��dSr0)r�_previous_sigint_handler�signal�SIGINT�
ValueErrorrhr[rxr\r]ry)r2rXr~rrrrnVszPdb.interactioncCs|dk	r|�t|��dS)z{Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N)rV�repr)r2r%rrr�displayhookhszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}zdt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�W5|t_|t_|t_XWn4t�	�dd�}|�
tj|�d�
��YnXdS)Nr�!�
z<stdin>Zsingle�r|)rdr^r#rr<rTrSr��execr��errorr~rrk)	r2r �locals�globalsr,Zsave_stdoutZ
save_stdinZsave_displayhookr�rrr�defaultps(zPdb.defaultcCs�|��s|S|��}|d|jkr�|j|d}d}|dd�D] }|�dt|�|�}|d7}q@|�dd�|dd���}|��}q|ddkr�|�d�}|dkr�||d	d���}|j�	|�|d|��
�}|S)
z*Handle alias expansion and ';;' separator.rrN�%z%*� �aliasz;;r�)rk�splitr?�replace�str�join�find�lstrip�cmdqueue�append�rstrip)r2r �argsZiiZtmpArgZmarker�nextrrr�precmd�s(�


z
Pdb.precmdcCs"|jstj�||�S|�|�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)rPr:r;rl�handle_command_def)r2r rrrrl�sz
Pdb.onecmdcCs�|�|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|�|d|�n
|�|�zt|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	parselinerOrQr�rMr�rv�AttributeErrorr�r�commands_resumingrN)r2r r:�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N��file��printrT�r2�msgrrrrV�szPdb.messagecCstd||jd�dS)Nz***r�r�r�rrrr��sz	Pdb.errorcCs�|���d�rgSz|�||||�}Wntk
r>g}YnXt�t�|�d�}|D]H}tj�|�rx|�	|d�qXtj�
|�rX|���d�rX|�	|d�qX|S)N)�:�,�*�/)�.pyz.pywr�)rk�endswith�_complete_expression�	Exception�globrrIrJ�isdirr��isfile�lower)r2�textr �begidx�endidxZret�globs�fnrrr�_complete_location�s
zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|����rt|��qSr0)r��
startswith)�.0r-�bp�r�rr�
<listcomp>�s�z*Pdb._complete_bpnumber.<locals>.<listcomp>)rr7�
Breakpoint�
bpbynumber�r2r�r r�r�rr�r�_complete_bpnumber�szPdb._complete_bpnumberc	s�|js
gS|jj|j�}d�kr���d��z,|�d}�dd�D]}t||�}qDWnttfk
rrgYSXd��dd��d���fdd�t|�D�S�fdd�|�	�D�SdS)N�.rrr|cs"g|]}|��d�r�|�qS)r|�r��r��n)�dottedr�rrr�sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|���r|�qSrr�r�r�rrr�s
)
r^r#rdr�rv�KeyErrorr�r��dir�keys)r2r�r r�r��nsr%�partr)r�r�r�rr��s

zPdb._complete_expressioncCs,|sttjj�d}n&zt|�}Wn|�d�YdSX||_||jkrj|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzz|��Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|�d	�YnXW5d|_||_
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)�lenr7r�r��intr�rQrMrNrOr>rPr�rU)r2r�ZbnumZold_command_defsZprompt_backrrr�do_commands	sB%

�


zPdb.do_commandsrc
CsB|s8|jr4|�d�tjjD]}|r|�|���qdSd}d}d}|�d�}|dkrz||dd���}|d|���}|�	d�}d}	|dk�r|d|���}|�
|�}
|
s�|�d|�dS|
}||dd���}zt|�}Wn&t
k
�r|�d|�YdSXn�zt|�}Wn�t
k
�r�zt||jj|j�}Wn|}YnXz.t|d	��rj|j}|j}|j}	|j}|j}WnD|�|�\}
}}|
�s�|�d
|�YYdS|
}	t|�}YnXYnX|�s�|��}|�||�}|�r>|�|||||	�}|�r|�|�n*|�||�d}|�d|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.r|zBreakpoint %d at %s:%d) �breaksrVr7r�r�Zbpformatr�r�r��rfind�lookupmoduler�r�r��evalr^r#rd�hasattrr��__code__�co_name�co_firstlinenorq�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r )r2r�Z	temporaryr�rr�condZcommaZcolonrrfr�r,�okZlnr �errrrr�do_breakXs�





�

��zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z<string>)r^rarqrA)r2rrrrr��s
zPdb.defaultFilecCs|�|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��r2r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|�d�}t|�dkr(|d��}nt|�dkrB|d��}n|S|dkrR|S|�d�}|ddkr~|d=t|�dkr~|S|��}t|�dkr�|d}n|�|d�}|r�|}|d}t||�}	|	p�|S)	N)NNN�'rr�r6r�r2)r�r�rkr�r�r!)
r2Z
identifierZfailedZidstring�id�partsZfname�itemrfZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}t�|||�}|s6|�d�dS|��}|rn|ddksn|dd�dksn|dd�dkr||�d	�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.
        r^NzEnd of filerrir�z"""z'''zBlank or comment)r�r^r#�	linecache�getlinerVrkr�)r2rrr�r rrrr��s
��
z
Pdb.checklinecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)z�enable bpnumber [bpnumber ...]
        Enables the breakpoints given as a space separated list of
        breakpoint numbers.
        Nz
Enabled %s)r��get_bpbynumberr�r��enablerV�r2r�r�r-r�r�rrr�	do_enablesz
Pdb.do_enablecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)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��disablerVr�rrr�
do_disableszPdb.do_disablec
Cs�|�dd�}z|d}Wntk
r0d}YnXz|�|d���}WnHtk
rf|�d�YnXtk
r�}z|�|�W5d}~XYn.X||_|s�|�d|j�n|�d|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�rNr�Breakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rkr�r�r�rVr�)r2r�r�r�r�r�rrr�do_condition%s
zPdb.do_conditionc
Cs�|��}zt|d���}Wnd}YnXz|�|d���}WnHtk
rb|�d�Ynvtk
r�}z|�|�W5d}~XYnLX||_|dkr�|dkr�d|}nd}|�d||j	f�n|�d|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.
        rrr�Nz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rkr�rr�r��ignorerVr�)r2r�r��countr�r�Zcountstrrrr�	do_ignore@s,	

��z
Pdb.do_ignorec
Cs�|stztd�}Wntk
r(d}YnX|����}|dkrpdd�tjjD�}|��|D]}|�d|�q\dSd|k�r|�	d�}|d|�}||d	d�}zt
|�}Wntk
r�d
|}YnX|�||�}|�
||�}|r�|�|�n|D]}|�d|�q�dS|��}	|	D]\}z|�|�}Wn.tk
�r^}z|�|�W5d}~XYnX|�|�|�d|��qdS)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? Zno)�yZyescSsg|]}|r|�qSrr)r�r�rrrr�qsz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sNr�rzInvalid line number (%s))�input�EOFErrorrkr�r7r�r�Zclear_all_breaksrVr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r2r�ZreplyZbplistr�r-rrr�Z
numberlistrrr�do_clearcsF



zPdb.do_clearcCs|��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_tracer�rrr�do_where�szPdb.do_wherecCs^d|krt|j�ks nt�||_|j|jd|_|jj|_|�|j|j�d|_dSr()	r�r\�AssertionErrorr]r^r$rdrxr)r2r�rrr�
_select_frame�s 
zPdb._select_framecCsz|jdkr|�d�dSzt|p"d�}Wn$tk
rL|�d|�YdSX|dkr\d}ntd|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 frameNr�Invalid frame count (%s))r]r�r�r��maxr�r2r�rZnewframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|�d�dSzt|p,d�}Wn$tk
rV|�d|�YdSX|dkrpt|j�d}ntt|j�d|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 frameNr
r)r]r�r\r�r�r��minrrrrr�do_down�s
zPdb.do_downcCsh|rRzt|�}Wn$tk
r4|�d|�YdSX||jjkrV|�d�dSnd}|�|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.
        �Error in argument: %rNz7"until" line number is smaller than current line numberr)r�r�r�r^rrZ	set_until)r2r�rrrr�do_until�s
zPdb.do_untilcCs|��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)rWr�rrr�do_step�szPdb.do_stepcCs|�|j�dS)zxn(ext)
        Continue execution until the next line in the current function
        is reached or it returns.
        r)Zset_nextr^r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|�|�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)r2r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|�|j�dS)zPr(eturn)
        Continue execution until the current function returns.
        r)Z
set_returnr^r�rrr�	do_returnsz
Pdb.do_returncCs>|js2zt�tj|j�t_Wntk
r0YnX|��dS)z]c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        r)rGr�r�rYrr�r�Zset_continuer�rrr�do_continues�zPdb.do_continuec
Cs�|jdt|j�kr"|�d�dSzt|�}Wntk
rL|�d�YnnXz:||j_|j|jd|f|j|j<|�|j|j�Wn0tk
r�}z|�d|�W5d}~XYnXdS)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)	r]r�r\r�r�r�r^rrrx)r2r��errr�do_jump&s
zPdb.do_jumpcCs�t�d�|jj}|j}t|j|j|j�}d|j	�
�|_	|�d�zt�|j
|||f�Wn<tk
r�t��dd�}|�tj|�d�
��YnX|�d�t�|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 DEBUGGERr�r|zLEAVING RECURSIVE DEBUGGER)r<�settracer^r#rdrrRrSrTr>rkrV�call_tracingr	r�r�r�r~rZtrace_dispatchrw)r2r�r�r��pr�rrr�do_debugCs


zPdb.do_debugcCsd|_|��dS)z[q(uit)
exit
        Quit from the debugger. The program being executed is aborted.
        Tr)�_user_requested_quit�set_quitr�rrr�do_quitZszPdb.do_quitcCs|�d�d|_|��dS)z=EOF
        Handles the receipt of EOF as a command.
        r6Tr)rVr"r#r�rrr�do_EOFes
z
Pdb.do_EOFcCs�|jj}|j}|j|j}|jtj@r.|d}|jtj@rB|d}t	|�D]>}|j
|}||krx|�d|||f�qJ|�d|f�qJdS)zHa(rgs)
        Print the argument list of the current function.
        rz%s = %rz%s = *** undefined ***N)r^rard�co_argcount�co_kwonlyargcount�co_flagsr"Z
CO_VARARGSZCO_VARKEYWORDS�range�co_varnamesrV)r2r��co�dictr�r-�namerrr�do_argsns
zPdb.do_argscCs.d|jkr |�t|jd��n
|�d�dS)zQretval
        Print the return value for the last return of a function.
        rzzNot yet returned!N)rdrVr�r�r�rrr�	do_retvals
z
Pdb.do_retvalcCsPzt||jj|j�WSt��dd�}|�tj|�d�	���YnXdS)Nr�r|)
r�r^r#rdr<r�r�r~rrk)r2r�r�rrr�_getval�szPdb._getvalcCsrz2|dkrt||jj|j�WSt||j|j�WSWn:t��dd�}tj|�d�	�}t
d|�YSXdS)Nr�r|z** raised %s **)r�r^r#rdr$r<r�r~rrkr/)r2r�rXr�r�rrrr��szPdb._getval_exceptcCs*z|�t|�|���WnYnXdS)z@p expression
        Print the value of the expression.
        N)rVr�r0r�rrr�do_p�szPdb.do_pcCs,z|�t�|�|���WnYnXdS)zHpp expression
        Pretty-print the value of the expression.
        N)rV�pprintZpformatr0r�rrr�do_pp�sz	Pdb.do_ppcCsfd|_d}|r�|dkr�z^d|krX|�d�\}}t|���}t|���}||krr||}nt|���}td|d�}Wq�tk
r�|�d|�YdSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|�|�}zZt
�||jj�}|�||d|�|||j�t|t|��|_t|�|k�rH|�d	�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�r�
z[EOF])rwr�r�rkrr�r�rr^rrrarq�get_file_breaksr��getlinesr#�_print_linesrr�rVrU)r2r�Zlast�firstr�	breaklistr&rrr�do_list�s@




�zPdb.do_listc
Csp|jjj}|�|�}zt|j�\}}Wn2tk
rX}z|�|�WY�dSd}~XYnX|�||||j�dS)z\longlist | ll
        List the whole source code for the current function or frame.
        N)r^rarqr6r'rr�r8)r2r�rr:r&rr�rrr�do_longlist�s


zPdb.do_longlistc
Csvz|�|�}WnYdSXzt|�\}}Wn6ttfk
rd}z|�|�WY�dSd}~XYnX|�||�dS)z^source expression
        Try to get source code for the given object and display it.
        N)r0r'r�	TypeErrorr�r8)r2r�r%r&rr�rrr�	do_source�s
z
Pdb.do_sourcerc
Cs�|r|j}|j�|d�}nd}}t||�D]|\}}t|��d�}	t|	�dkrV|	d7}	||krh|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|�|	d|���q,d	S)
zPrint a range of lines.r|r��r��Bz->z>>�	N)	rrrCr�rr��rjustr�rVr�)
r2r&rr�rXZcurrent_linenoZ
exc_linenorr �srrrr8s 

zPdb._print_linescCs�z|�|�}WnYdSXd}z|jj}Wntk
rBYnX|r\|�d|j�dSz
|j}Wntk
rzYnX|r�|�d|j�dS|jtkr�|�d|j|j	f�dS|�t|��dS)z;whatis arg
        Print the type of the argument.
        Nz	Method %szFunction %szClass %s.%s)
r0r�r�r�rVr��	__class__�typerr)r2r��valuer,rrr�	do_whatiss.

z
Pdb.do_whatiscCsl|s8|�d�|j�|ji���D]}|�d|�q"n0|�|�}||j�|ji�|<|�d||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)rVr@r�r^r�r��
setdefault)r2r�r��valrrr�
do_display<s

zPdb.do_displaycCsT|r@z|j�|ji�|=WqPtk
r<|�d|�YqPXn|j�|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�r^r�r�rjr�rrr�do_undisplayOszPdb.do_undisplaycs�fdd�|j�|ji�D�S)Ncsg|]}|���r|�qSrr�)r�rr�rrr�_s
�z*Pdb.complete_undisplay.<locals>.<listcomp>)r@r�r^r�rr�r�complete_undisplay^szPdb.complete_undisplaycCs |jj|j�}tjd|d�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)r^r#rdr,�interact)r2r�r�rrr�do_interactbszPdb.do_interactcCs�|��}t|�dkrHt|j���}|D]}|�d||j|f�q&dS|d|jkr�t|�dkr�|�d|d|j|df�nd�|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��sortedr?r�rVr�)r2r�r�r�r�rrr�do_aliasks"zPdb.do_aliascCs6|��}t|�dkrdS|d|jkr2|j|d=dS)z9unalias name
        Delete the specified alias.
        rN)r�r�r?)r2r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|���r|�qSrr�)r��ar�rrr��s
z(Pdb.complete_unalias.<locals>.<listcomp>)r?r�rr�r�complete_unalias�szPdb.complete_unaliasrrrrr$rcCs4z|jD]}|�|�qWntk
r.YnXdSr0)r\rxrU)r2�frame_linenorrrr	�s

zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|�||�||��dS)Nz> z  )r^rVZformat_stack_entry)r2rTZ
prompt_prefixrXrr�rrrrx�s

�zPdb.print_stack_entrycCs�|stj�||�Sz@zt|d|�}|�WWStk
rNt|d|�}YnXWn"tk
rt|�d|�Yn0Xtjjdkr�|�d|�dS|�	|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)r:r;�do_helprvr�r�r<�flags�optimizerVrr�)r2r�ZtopicZcommandrrrrU�s 
�zPdb.do_helpcCs|�|jjpd���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)
        r6N)rV�	help_execrrkr1rrrrX�s
z
Pdb.help_execcCs
t�dSr0)rr1rrr�help_pdb�szPdb.help_pdbcCs�tj�|�rtj�|�r|Stj�tjd|�}tj�|�rP|�|�|jkrP|Stj�|�\}}|dkrp|d}tj�|�r�|StjD]>}tj�	|�r�t�
|�}q�tj�||�}tj�|�r�|Sq�dS)z�Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        rr6r�N)rIrJ�isabs�existsr�r<rprA�splitext�islink�readlink)r2rrf�rootZext�dirname�fullnamerrrr��s"

zPdb.lookupmodulec	Csrd|_d|_ddl}|�|�\}}}|�|j�|_ddl}|j�	�|j�
d|j|j|j|t
d��|�|�dS)NTFr�__main__)r�__file__�__package__�
__loader__�__spec__�__builtins__)rBr"�runpyZ_get_module_detailsrprqrArb�__dict__r_�update�parent�loaderrgr	)r2Zmodule_namerhZmod_nameZmod_specr,rbrrr�
_runmodule�s 
�zPdb._runmodulec	Cstddl}|j��|j�d|td��d|_|�|�|_d|_t	�
|��}d|��|jf}W5QRX|�|�dS)Nrrb)rrcrgTFzexec(compile(%r, %r, 'exec')))
rbrir_rjrgrBrprAr"�io�	open_code�readr	)r2rrbr�	statementrrr�
_runscript
s
�
�zPdb._runscript)r4NNNFT)r)N)rN)wrrrr�r9rYrZr[rhrerortrsr{r�ryr�rnr�r�r�rlr�rVr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disablerZcomplete_conditionrZcomplete_ignorerZdo_clZcomplete_clearZcomplete_clr
Zdo_wZdo_btrrZdo_urZdo_drZdo_untrZdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contrZdo_jr!Zcomplete_debugr$Zdo_qZdo_exitr%r.Zdo_ar/Zdo_rvr0r�r1r3Zcomplete_printZ
complete_pZcomplete_ppr;Zdo_lr<Zdo_llr>Zcomplete_sourcer8rGZcomplete_whatisrJZcomplete_displayrKrLrNrPrQrSr�r	�line_prefixrxrUZdo_hrXrYr�rmrrrrrrr�s��
/	


M
]!!.	
		1
!	#	��whereZdownZup�breakZtbreakr_r�r�rZ	conditionrM�stepr�ZuntilZjump�returnZretval�continuer)Zlonglistr�r ZppZwhatis�sourceZdisplayZ	undisplayrMr�Zunalias�debug�quitr�z

cCst��|||�dSr0)rr	�rqr�r�rrrr	<scCst��|||�Sr0)rr)Z
expressionr�r�rrrr?scCst|||�dSr0)r	r|rrrr
BscOst�j||�Sr0)rr)r��kwdsrrrrFs)�headercCs,t�}|dk	r|�|�|�t��j�dSr0)rrVrr<�	_getframe�f_back)r~�pdbrrrrIs
cCsB|dkrt��d}|dkr$td��t�}|��|�d|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r<r�r�rrZrn)�tr rrrrQscCsttj�dSr0)rr<�last_tracebackrrrrr
_szimport x; x.main()cCstt�dSr0)r	�TESTCMDrrrr�testgsr�cCsddl}|�t�dSr()�pydocZpagerr)r�rrrrksausage: pdb.py [-c command] ... [-m module | pyfile] [arg] ...

Debug the Python program given by pyfile. Alternatively,
an executable module or package to debug can be specified using
the -m switch.

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

Csddl}|�tjdd�dddg�\}}|s>tt�t�d�g}d}|D]B\}}|dkrltt�t��qJ|d	kr�|�|�qJ|d
krJd}qJ|d}|s�tj�	|�s�td|d
�t�d�|tjdd�<|s�tj�
|�}tj�|�tjd<t�}|j
�|�z6|�r|�|�n
|�|�|j�r*W�qtd�Wq�tk
�rrtd|d�tdd�tjdd���Yq�tk
�r�tddd�tt��d�Yq�tk
�r�t��t�d�Yq�t��td�td�t��d}	|�d|	�td|d�Yq�Xq�dS)Nrrzmhc:rzcommand=r�F)z-hz--help)z-cz	--command)z-mTzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:rAr�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)�getoptr<rr��_usage�exitr�rIrJr[�realpathr`rrHrLrmrrr"rr��
SystemExitr��SyntaxErrorr~�	print_excrn)
r�Zoptsr�rMZ
run_as_module�optZoptargrAr�r�rrr�main~sd 



 �r�rb)NN)NN)N)/rrIrnrr<r:r7r*r,r�r2r�r"rr~r�r�r�__all__r!r'r.r�r/rsr8r;rZ_help_orderZ_commandrvrkrXr	rr
rrrr
r�r�rr�r�rr�rrrr�<module>s�C�
		*
� 


D


Zerion Mini Shell 1.0