
    F\h,c                       S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSKJr  SSKJr   " S S\5      r/ SQrS	 rS
 rS r  " S S\!5      r" " S S5      r# " S S\#5      r$ " S S\#5      r% " S S\#5      r& " S S\RN                  5      r(Sr) " S S\RT                  \RV                  5      r,\ bR  / SQr-\- H-  r.\ \/" \,S\.-   5      R                   Ra                  5       S-   -  r M/     \ \,Rb                  R                   -  r C-C.S-S jr2S-S jr3S  r4S! r5SS".S# jr6S.S$ jr7S% r8S& r9S'r:S( r;S) r<S*r=S+ r>\?S,:X  a  SSK@r@\@R|                  " 5         gg)/a	  
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
=================

    N)contextmanager)	Completer)CodeTypec                       \ rS rSrSrSrg)Restarta   zBCauses a debugger to be restarted for the debugged python program. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r	       /usr/lib/python3.13/pdb.pyr   r   a   s    Lr   r   )	runpmPdbrunevalrunctxruncall	set_tracepost_mortemhelpc                     Sn[         R                  " U 5       HU  nUbM  UR                  S:X  a=  UR                  R                  b  UR                  R                  s  $ U R
                  s  $ UnMW     U R
                  $ )zTry to find the first executable line of the code object.

Equivalently, find the line number of the instruction that's
after RESUME

Return code.co_firstlineno if no executable line is found.
NRESUME)disget_instructionsopname	positionslinenoco_firstlineno)codeprevinstrs      r   find_first_executable_liner&   i   sn     D%%d+x 7%%1---&&& , r   c                   ^  [         R                  " S[         R                  " T 5      -  5      n [        R                  " U5      nSnS nU   [        USS9 H|  u  pxUR                  U5      (       a  XxpVOU(       a  XX-  nU(       d  M2   [        XQS5      n	[        U 4S jU	R                   5       5      n
[!        U
5      nT XU-   S-
  4s  sS S S 5        $    S S S 5        g ! [
         aG    [        R                  " U5      nU(       d   g [        R                  " SR                  U5      5      n Nf = f! [         a     M  f = f! , (       d  f       g = f)Nzdef\s+%s(\s*\[.+\])?\s*[(]    )startexecc              3   z   >#    U  H0  n[        U[        5      (       d  M  UR                  T:X  d  M,  Uv   M2     g 7fN)
isinstancer   co_name).0cfuncnames     r   	<genexpr> find_function.<locals>.<genexpr>   s4       S>a *1h 7 !"<=II<Q !">s   ;;	;)recompileescapetokenizeopenOSError	linecachegetlinesioStringIOjoin	enumeratematchSyntaxErrornext	co_constsr&   )r2   filenamecrefplinesfuncdef	funcstartr!   liner#   funccodelineno_offsets   `           r   find_functionrN   z   s1   
**2RYYx5HH
IC)]]8$ GI	%b2LFyy%+7w"7f=D    S4>>  S S :8 D}+Dq+HHH! 
2 
" 3  )""8,[[(	)$ #  
" sM   C  9E
D45EE 'D1	%D10D14
E>EEE
Ec                     [        [        R                  " U 5      5      nUR                  5         U H  u  p4X:  d  M  Us  $    gNr   )listr   findlinestartsreverse)r#   lasti
linestartsir!   s        r   lasti2linenorW      s>    c((./J	:M   r   c                       \ rS rSrSrS rSrg)_rstr   z#String that doesn't quote its repr.c                     U $ r-   r	   selfs    r   __repr___rstr.__repr__   s    r   r	   N)r
   r   r   r   r   r^   r   r	   r   r   rY   rY      s
    -r   rY   c                   :    \ rS rSr% \\S'   \\-  \S'   \\S'   Srg)_ExecutableTarget   rE   r#   	namespacer	   N)	r
   r   r   r   str__annotations__r   dictr   r	   r   r   ra   ra      s    M
S.Or   ra   c                   P    \ rS rSrS rS r\S 5       r\S 5       r\S 5       r	Sr
g)	_ScriptTarget   c                 L   [         R                  R                  U5      U l        [         R                  R	                  U R                  5      (       d%  [        SU S35        [        R                  " S5        [         R                  R                  U R                  5      (       a%  [        SU S35        [        R                  " S5        [        R                  R                  (       d;  [         R                  R                  U R                  5      [        R                  S'   g g )NzError: z does not existr)   z is a directoryr   )ospathrealpath_targetexistsprintsysexitisdirflags	safe_pathdirname)r]   targets     r   __init___ScriptTarget.__init__   s    ww''/ww~~dll++GF8?34HHQK77==&&GF8?34HHQK yy""''//$,,7CHHQK #r   c                     U R                   $ r-   rn   r\   s    r   r^   _ScriptTarget.__repr__       ||r   c                     U R                   $ r-   r{   r\   s    r   rE   _ScriptTarget.filename   s    ||r   c                     [         R                  " U R                  5       nSUR                  5       < SU R                  < S3sS S S 5        $ ! , (       d  f       g = f)Nzexec(compile(z, z
, 'exec')))r=   	open_codern   read)r]   rG   s     r   r#   _ScriptTarget.code   s?     \\$,,'2"2779-r$,,1AL (''s   #A
Ac                 6    [        SU R                  [        S S9$ )N__main__)r
   __file____builtins____spec__)rf   rn   r   r\   s    r   rc   _ScriptTarget.namespace   s    \\%	
 	
r   r{   Nr
   r   r   r   rx   r^   propertyrE   r#   rc   r   r	   r   r   rh   rh      sJ    8   M M
 
 
r   rh   c                   P    \ rS rSrS rS r\S 5       r\S 5       r\S 5       r	Sr
g)	_ModuleTarget   c                 L   Xl         SS Kn UR                  U R                   5      u  o0l        U l        g ! [
         a.  n[        SU 35        [        R                  " S5         S nAg S nAf[         a.    [        R                  " 5         [        R                  " S5         g f = fNr   zImportError: r)   )rn   runpy_get_module_details_spec_codeImportErrorrp   rq   rr   	Exception	traceback	print_excr]   rw   r   _es        r   rx   _ModuleTarget.__init__   sw    	(-(A(A$,,(O%Az4: 	M!%&HHQKK 	!HHQK	s   (5 
B#$A((8B#"B#c                     U R                   $ r-   r{   r\   s    r   r^   _ModuleTarget.__repr__   r}   r   c                 .    U R                   R                  $ r-   r   co_filenamer\   s    r   rE   _ModuleTarget.filename       zz%%%r   c                     U R                   $ r-   r   r\   s    r   r#   _ModuleTarget.code       zzr   c           	         [        S[        R                  R                  [        R                  R	                  U R
                  5      5      U R                  R                  U R                  R                  U R                  [        S9$ Nr   )r
   r   __package__
__loader__r   r   
rf   rk   rl   normcaseabspathrE   r   parentloaderr   r\   s    r   rc   _ModuleTarget.namespace   Y    WW%%bggoodmm&DE

))zz((ZZ%
 	
r   r   r   rn   Nr   r	   r   r   r   r      sH     & &   
 
r   r   c                   P    \ rS rSrS rS r\S 5       r\S 5       r\S 5       r	Sr
g)	
_ZipTarget   c                    SS K n[        R                  R                  U5      U l        [
        R                  R                  SU R                  5         UR                  5       u  o0l        U l	        g ! [         a.  n[        SU 35        [
        R                  " S5         S nAg S nAf[         a.    [        R                  " 5         [
        R                  " S5         g f = fr   )r   rk   rl   rm   rn   rq   insert_get_main_module_detailsr   r   r   rp   rr   r   r   r   r   s        r   rx   _ZipTarget.__init__   s    ww''/4<<(	(-(F(F(H%Az4: 	M!%&HHQKK 	!HHQK	s   A2 2
C <$B%%8C C c                     U R                   $ r-   r{   r\   s    r   r^   _ZipTarget.__repr__	  r}   r   c                 .    U R                   R                  $ r-   r   r\   s    r   rE   _ZipTarget.filename  r   r   c                     U R                   $ r-   r   r\   s    r   r#   _ZipTarget.code  r   r   c           	         [        S[        R                  R                  [        R                  R	                  U R
                  5      5      U R                  R                  U R                  R                  U R                  [        S9$ r   r   r\   s    r   rc   _ZipTarget.namespace  r   r   r   Nr   r	   r   r   r   r      sH     & &   
 
r   r   c                   .   ^  \ rS rSrU 4S jrS rSrU =r$ )_PdbInteractiveConsolei   c                 .   > X l         [        TU ]	  USS9  g )NT)locals
local_exit)_messagesuperrx   )r]   nsmessage	__class__s      r   rx   _PdbInteractiveConsole.__init__!  s    t4r   c                 $    U R                  USS9  g )Nr(   endr   )r]   datas     r   write_PdbInteractiveConsole.write%  s    d#r   r   )r
   r   r   r   rx   r   r   __classcell__r   s   @r   r   r      s    5$ $r   r   z
-> c                   @  ^  \ rS rSrSrSr0 r  SdS jrS rS r	S r
S rS	 rS
 r\rS rS rS rS rS rS rS r\S 5       rS rS r\S 5       rS rS rS rS rS rS r SeS jr!S r"S r#U 4S jr$S  r%S! r&S" r'S# r(S$ r)S% r*\&r+SfS& jr,S' r-\,r.\%r/\%r0S( r1\%r2S) r3S* r4S+ r5\&r6S, r7\&r8S- r9\&r:S. r;\&r<S/ r=\=r>\%r?\%r@S0 rA\ArB\ArCS1 rDS2 rES3 rF\FrGS4 rH\HrIS5 rJ\JrKS6 rL\LrMS7 rN\NrOS8 rP\PrQS9 rR\RrSS: rT\T=rUrVS; rW\WrXS< rY\'rZS= r[\[r\\[r]S> r^S? r_\_r`S@ ra\arbSA rcSgSB jrdSC reSD rfSE rgSF rhSG ri\'rj\'rk\'rlSH rm\mrnSI ro\orpSJ rq\'rrShSK jrsSL rt\'ruSM rv\'rwSN rxSO rySP rzSQ r{SR r|SS r}/ STQr~SU r\4SV jrSW r\rSX rSY rSZ rS[\4S\ jrS]\4S^ jrS_ rS` rSiSa jrSb rScrU =r$ )jr   i2  Ni  c                    [         R                  R                  XS9  [        R                  R                  XX#5        [
        R                  " S5        U(       a  SU l        SU l        0 U l	        0 U l
        SU l        SU l        0 U l         SS KnUR                  S5        SU l        XPl        [        R                  R&                  S-   U l        / U l        U(       a{   [+        [,        R.                  R1                  S	5      S
S9 nU R(                  R3                  U5        S S S 5         [+        SS
S9 nU R(                  R3                  U5        S S S 5        0 U l        0 U l        0 U l        SU l        S U l        [A        5       U l!        SU l"        g ! [          a     Nf = f! , (       d  f       N= f! [4         a     Nf = f! , (       d  f       Ny= f! [4         a     Nf = f)N)skipzpdb.Pdbr   z(Pdb) r(   Fz 	
`@#%^&*()=+[{]}\|;:'",<>?z=.[](),"'+-*/%@&|<>~^z~/.pdbrczutf-8)encodingz.pdbrc)#bdbBdbrx   cmdCmdrq   audituse_rawinputpromptaliases
displaying
mainpyfile_wait_for_mainpyfile	tb_linenoreadlineset_completer_delimsr   allow_kbdintnosigint
identcharsrcLinesr9   rk   rl   
expanduserextendr:   commandscommands_dopromptcommands_silentcommands_definingcommands_bnumtuple_chained_exceptions_chained_exception_index)	r]   completekeystdinstdoutr   r   readrcr   rcFiles	            r   rx   Pdb.__init__;  s   )E:		) !D$)!	))*LM "  '',,/GG "'',,Z87KvLL''/ L(W5LL''/ 6
 !#!!&! $)7 ()%C  		 LK  65 sr   F  'F5 F$#F5 ,
G 6GG 
F! F!$
F2.F5 2F5 5
GG
GG G 
G#"G#c                     U R                   (       a  [        eU R                  S5        U R                  5         U R	                  U5        g )Nz-
Program interrupted. (Use 'cont' to resume).)r   KeyboardInterruptr   set_stepr   )r]   signumframes      r   sigint_handlerPdb.sigint_handlerp  s3    ##EFur   c                 b    [         R                  R                  U 5        U R                  5         g r-   )r   r   resetforgetr\   s    r   r  	Pdb.resetw  s    dr   c                    S U l         / U l        SU l        [        U S5      (       a7  U R                  (       a&  U R                  R
                  R                  SS 5        S U l        0 U l        U R                  R                  5         g )Nr   curframe__pdb_convenience_variables)
r!   stackcurindexhasattrr	  	f_globalspopcurframe_localsr   clearr\   s    r   r  
Pdb.forget{  sd    
4$$MM##''(EtL!r   c                 f   U R                  5         U R                  X5      u  U l        U l        U(       aW  [	        UR
                  R                  UR                  5      nX0R                  UR
                  '   UR                  nU(       a  MW  U R                  U R                     S   U l
        U R                  R                  U l        U R                  U R                  SU R                  5        U R                  (       a4  U R                  U R                  SU R                  U R                     5        U R                   (       ag  U R                    Vs/ s HB  nUR#                  5       (       d  M  UR#                  5       R%                  S5      (       a  M@  UPMD     snU l        / U l        g g s  snf )Nr   _frame
_exception#)r  	get_stackr  r  rW   tb_framef_codetb_lastir   tb_nextr	  f_localsr  set_convenience_variabler   r   r   strip
startswithcmdqueue)r]   ftbr!   rK   s        r   setup	Pdb.setup  s?   $(NN1$9!
DM ""++"4"4bkkBF*0NN2;;'B b 

4==1!4  $}}55%%dmmXt}}M##))(()F)FG <<!%!-::< (,

(?(?(D DM DL s   F.1"F.F.c                     U R                   (       a  gU R                  U5      (       a$  U R                  S5        U R                  US5        gg)zfThis method is called when there is the remote possibility
that we ever need to stop in this function.Nz--Call--)r   	stop_herer   interaction)r]   r  argument_lists      r   	user_callPdb.user_call  s@     $$>>%  LL$UD) !r   c                 L   U R                   (       a;  U R                  U R                  UR                  R                  5      :w  a  gSU l         U R
                  (       a  UR                  c  U R                  5         gU R                  U5      (       a  U R                  US5        gg)z;This function is called when we stop or break at this line.NF)
r   r   canonicr  r   trace_opcodesf_linenoset_stepinstrbp_commandsr'  )r]   r  s     r   	user_linePdb.user_line  s    $$4<<0H0H#II(-D% ~~%""$E""UD) #r   c                    [        U SS5      (       a  U R                  U R                  ;   a  U R                  nSU l        U R                  nU R	                  US5        U R                  U    H  nU R                  U5        M     X0l        U R                  U   (       d(  U R                  U R                  U R                     5        U R                  U   (       a  U R                  5         U R                  5         gg)zCall 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.	currentbpFr   Nr)   )getattrr4  r   lastcmdr#  onecmdr   print_stack_entryr  r  r   _cmdloopr  )r]   r  r4  lastcmd_backrK   s        r   r0  Pdb.bp_commands  s     4e,,~~.IDN<<LJJud#i0D! 1'L''	2&&tzz$--'@A%%i0KKMr   c                     U R                   (       a  gX!R                  S'   U R                  USU5        U R                  S5        U R	                  US5        g)z7This function is called when a return trap is set here.N
__return___retvalz
--Return--)r   r  r  r   r'  )r]   r  return_values      r   user_returnPdb.user_return  sH    $$'3|$%%eYE\"%r   c                    U R                   (       a  gUu  p4nX44UR                  S'   U R                  USU5        U(       d  U[        L a  SOSnU R	                  U< U R                  U5      < 35        U R                  X5        g)zgThis function is called if an exception occurs,
but only if we are to stop at or just below this level.N__exception__r  z	Internal r(   )r   r  r  StopIterationr   _format_excr'  )r]   r  exc_infoexc_type	exc_valueexc_tracebackprefixs          r   user_exceptionPdb.user_exception  s     $$-5*]*2*='%%e\9E &3(0M(A HJ 	vt'7'7	'BCD.r   c                       SU l         U R                  5         SU l         g ! [         a    U R                  S5         Of = fMC  )NTFz--KeyboardInterrupt--)r   cmdloopr   r   r\   s    r   r9  Pdb._cmdloop  sI    6 %)!$)!$ 6456 s   " A A c                 ,    U R                   R                  R                  n[        R                  R                  U5      nXR                  ;   a'  X R                  U   :w  a  U R                  SU S35        X R                  U'   g! [         a     gf = f)zuCheck if the source file of the current frame has been modified since
the last time we saw it. If so, give a warning.Nz*** WARNING: file 'z;' was edited, running stale code until the program is rerun)	r	  r  r   rk   rl   getmtimer   _file_mtime_tabler   )r]   rE   mtimes      r   _validate_file_mtimePdb._validate_file_mtime  s    	}}++77HGG$$X.E ...++H55LL.xj 9I I J+0x(  		s   ?B 
BBc                 L   U R                   R                  U R                  5      nU(       ax  UR                  5        Hc  u  p#U R	                  U5      nXCLd  M  XC:w  d  M#  XAU'   U R                  SU< SU R                  XB5      < SU R                  X25      < S35        Me     g g )Ndisplay : z  [old: ])r   getr	  items_getval_exceptr   
_safe_repr)r]   r   exproldvaluenewvalues        r   _show_displayPdb._show_display  s    __((7
","2"2"4..t4 +0D'/t$LL"&(G"&//("A"C D #5 r   c                    / n[        U[        5      (       a  UR                  UpCUb  XB;   a  OUR                  U5        UR                  b  UR                  nO*UR
                  b  UR                  (       d  UR
                  n[        U5      U R                  :  a   U R                  SU R                   S35        OUb  M  OUn[        [        U5      5      U4$ )a  
Given a tracecack or an exception, return a tuple of chained exceptions
and current traceback to inspect.

This will deal with selecting the right ``__cause__`` or ``__context__``
as well as handling cycles, and return a flattened list of exceptions we
can jump to with do_exceptions.

z
More than zQ chained exceptions found, not all exceptionswill be browsable with `exceptions`.)r.   BaseException__traceback__append	__cause____context____suppress_context__lenMAX_CHAINED_EXCEPTION_DEPTHr   r   reversed)r]   	tb_or_exc_exceptionsr   currents        r   _get_tb_and_exceptionsPdb._get_tb_and_exceptions#  s     i//!*!8!8)w%)""7+$$0%//G''3G<X<X%11G{#t'G'GGLL$T%E%E$F??
 # %& "IXk*+Y66r   c              #      #     Xl         [        U5      S-
  U l        Sv   [        5       U l         SU l        g! [        5       U l         SU l        f = f7f)a  
Context manager to ensure proper cleaning of exceptions references

When given a chained exception instead of a traceback,
pdb may hold references to many objects which may leak memory.

We use this context manager to make sure everything is properly cleaned

r)   Nr   )r   rj  r   r   )r]   
exceptionss     r   _hold_exceptionsPdb._hold_exceptionsG  sM     	.'1$,/
Oa,?D) (-wD$,-D) (-wD$,-D)s   A8 AAAc                    [         R                  (       a?   [        R                  " [        R                  [         R                  5        S [         l        U R                  U5      u  p4[        U[        5      (       a
  Uc   S5       eU R                  U5         U R                  X5        U R                  R                  S5        U R                  5         U R                  (       a-  U R                  S   S:X  a  U R                  R                  5         U R                  5         S S S 5        g ! [         a     Nf = f! , (       d  f       g = f)Nz$main exception must have a traceback_pdbcmd_print_frame_status)r   _previous_sigint_handlersignalSIGINT
ValueErrorrp  r.   rd  rt  r#  r   rf  r9  r  r  )r]   r  rm  r   r"  s        r   r'  Pdb.interaction\  s    ''4fmmS-I-IJ 04,"&"="=i"Hi//>I#II>""#67JJu! MM  !=>MMO}}r!26R!R!!#KKM 87   87s   3D, BD<,
D98D9<
E
c                 @    Ub  U R                  [        U5      5        gg)zkCustom displayhook for the exec in default(), which prevents
assignment of the _ variable in the builtins.
N)r   repr)r]   objs     r   displayhookPdb.displayhookw  s    
 ?LLc# r   c              #   r   #    U R                   n U R                  U l         S v   Xl         g ! Xl         f = f7fr-   )completenamescompletedefault)r]   r  s     r   _disable_command_completionPdb._disable_command_completion  s8     **	/!%!5!5D!. "/s   7, 747c                 *  ^
 [        USS5      n[        S UR                   5       5      (       d  g[        U5      m
S0 S.T
S'    [        USS5        S	U-   nS
[
        R                  " US5      -   S-   S-   S-   nSSR                  S T
 5       5      -   S-   S-   SR                  S T
 5       5      -   S-   [
        R                  " US5      -   S-   S-   n0 n [        U0 U5        US   " 5       n[        U
4S jUR                   5       5      n [        XBT
US9  T
S   nUS   R                  S5        UR                  US   5        US   n	U	b  [        [        U	5      5        g! [         a     GNf = f! [         a     gf = f! [         a     gf = f)zRun source code in closure so code object created within source
can find variables in locals correctly

returns True if the source is executed, False otherwise
<string>r+   c              3   B   #    U  H  n[        U[        5      v   M     g 7fr-   )r.   r   )r0   consts     r   r3   'Pdb._exec_in_closure.<locals>.<genexpr>  s     KN5:eX..Ns   FN)result
write_back__pdb_eval__evalz__pdb_eval__['result'] = ztry:
  
z	finally:
z'  __pdb_eval__['write_back'] = locals()zdef __pdb_outer():
c              3   .   #    U  H  nS U S3v   M     g7f)r  z = NoneNr	   r0   vars     r   r3   r    s     (Rks2cU'):ks   z  def __pdb_scope():
c              3   ,   #    U  H
  nS U 3v   M     g7f)z    nonlocal Nr	   r  s     r   r3   r    s     (V+3=)>+s   z    z  return __pdb_scope.__code____pdb_outerc              3   n   >#    U  H*  n[         R                  " TR                  U5      5      v   M,     g 7fr-   )typesCellTyperZ  )r0   r  locals_copys     r   r3   r    s(     WFVsenn[__S%9::FVs   25)closurer  r  T)r6   anyrD   rf   rB   textwrapindentr?   r+   r   r   co_freevarsr  updaterp   r  )r]   sourceglobalsr   r#   source_with_closurer   cellspdb_evaleval_resultr  s             @r   _exec_in_closurePdb._exec_in_closure  s    vz62KDNNKKK 6l '
N#	:FJ/ 169F //&$/0267 <<  6#yy(Rk(RR SUY Z7 8  $yy(V+(VV W Z^ ^  (vv>	 ? BF	 F
  ? ? 	$b"- - "WdFVFVWW	U;
 ~. 	"">2 	h|,-x("${#$o  		@  		  		s6   E$ E5 F $
E21E25
FF
FFc                    US S S:X  a  USS  R                  5       nU R                  nU R                  R                  n Un[        R
                  " US-   SS5      =nGc7  U R                  5          UnSn[        R
                  " USS5      =nc  U R                  (       a   [        U5      nOU R                  R                  U5        U R                  R                  5         U R                   R#                  5       n[%        U5      (       dF  SU l        U R                  R                  S5        U R                  R                  5          S S S 5        g UR'                  S5      nUSU-   -  n[        R
                  " USS5      =nc  M  X@l        S S S 5        [(        R                  n[(        R                   n[(        R*                  n	 U R                   [(        l        U R                  [(        l        U R*                  [(        l        U R-                  XCU5      (       d  [/        XSU5        U[(        l        U[(        l        U	[(        l        g ! [        [        4 a    SU l        [        S5         S S S 5        g f = f! , (       d  f       N= f! U[(        l        U[(        l        U	[(        l        f = f!   U R1                  5          g = f)	Nr)   !r  <stdin>singlez...   r(   z
)r  r  r	  r  codeopcompile_commandr  r   inputEOFErrorr   r6  rp   r   r   flushr   r   rj  rstriprq   r  r  r+   
_error_exc)
r]   rK   r   r  bufferr#   continue_promptsave_stdout
save_stdinsave_displayhooks
             r   defaultPdb.default  s=   8s?48>>#3D%%--))*	F..td{IxPPY557!F&.O#)#9#9&)X#VV4_,,'',_'= !KK--o> KK--/#'::#6#6#8D#&t99/1 $ 1 1$ 7 $ 1 1 3 &' 87* (,{{6':$+-' $*#9#9&)X#VV4_( $*L/ 80 **KJ"	3 JJ	![[
"&"2"2,,VfEE/(
&	"2; %-.?#@ '/1 %d & 87' 87D )
&	"2	OOsz    1J4 11I=#I.BI=J4 4I=
I=8J4 	A"J +!J4 "I:/I=0J4 9I::I==
JJ4 #J11J4 4Kc                 4   SU;  a  U$ S=p#/ n [         R                  " [        R                  " U5      R                  5       H^  nUu  pgpn
U[
        R                  :X  a
  US:X  a  Xp2M'  X:X  d  M.  U[
        R                  :X  d  MD  UR                  US   U	S   U45        M`     U(       d  U$ Sn/ nU H"  u  pnUR                  XU SU S3-   5        U	nM$     UR                  XS 5        SR                  U5      $ ! [         R                   a    Us $ f = f)	zReplace the convenience variables in 'line' with their values.
e.g. $foo is replaced by __pdb_convenience_variables["foo"].
Note: such pattern in string literals will be skipped$rx  r)   r   z__pdb_convenience_variables["z"]Nr(   )r8   generate_tokensr=   r>   r   tokenOPNAMErf  
TokenErrorr?   )r]   rK   dollar_start
dollar_endreplace_variablest
token_typetoken_stringr*   r   r   last_endline_piecesnames                 r   _replace_convenience_variables"Pdb._replace_convenience_variables  s&   
 d?K$&&		--bkk$.?.H.HI:;7
%a)lc.A/4*(Z5::-E%,,l1os1v|-TU J !K 1EtU38UVZU[[]6^^_H !2 	4	?+ww{## "" 	K	s   AC> 1C> C> >DDc                 8   UR                  5       (       d  U$ UR                  5       nUS   U R                  ;   a  U R                  US      n[        SS5       H  nSU 3U;   aB  U[	        U5      :  a  U R                  SUS    S35          gUR                  SU 3X#   5      nMN  SU;  d  MV  U[	        U5      :  a  U R                  S	US    S35          g  O   UR                  SS
R                  USS 5      5      nUR                  5       nUS   U R                  ;   a  M  US   S:w  a[  UR                  S5      nUS:  aD  XS-   S R                  5       nU R                  R                  SU5        USU R                  5       nU R                  U5      nU$ )z*Handle alias expansion and ';;' separator.r   r)   
   %z Not enough arguments for alias ''r  %*zToo many arguments for alias ' Naliasz;;   )r  splitr   rangerj  errorreplacer?   findlstripr   r   r  r  )r]   rK   argsidxmarkerrC   s         r   precmd
Pdb.precmd.  s   zz||Kzz|1g%<<Q(DQ|se9$c$i'

%Ed1gYa#PQ"<<!C5	49=D%SY

%CDG9A#NO" $ <<chhtABx&89D::<D# 1g%( 7gYYt_F{1HI--/$$Q-GV}++- 2248r   c                 :   U R                   (       dz  U R                  5         UR                  S5      (       a5  U R                  U5      u  p#n[	        X5      (       a  [        X5      " U5      $ [        R                  R                  X5      $ U R                  U5      $ )zInterpret 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.
_pdbcmd)
r   rT  r  	parseliner  r5  r   r   r7  handle_command_def)r]   rK   commandargs       r   r7  
Pdb.onecmdT  sz     %%%%'y))%)^^D%9"d4))"41#6677>>$--**400r   c                    U R                  U5      u  p#nU(       d  gUS:X  a  SU R                  U R                  '   gUS:X  a  gU R                  U R                     nU(       a  UR	                  US-   U-   5        OUR	                  U5         [        U SU-   5      nUR                  U R                  ;   a  SU R                  U R                  '   gg! [         a    U R                  n NMf = f)z8Handles one command line during command list definition.FsilentTr   r  do_)r  r   r   r   rf  r5  AttributeErrorr  r
   commands_resumingr   )r]   rK   r   r  cmdlistfuncs         r   r  Pdb.handle_command_defe  s    -$(?7;D  !3!34E\-- 2 23NN3s73;'NN3	 4-D ==D2229>D""4#5#56  	 <<D	 s   C C+*C+c                 ,    [        XU R                  S9  g )N)r   filerp   r   )r]   msgr   s      r   r   Pdb.message  s    c-r   c                 ,    [        SXR                  S9  g )Nz***)r  r  )r]   r  s     r   r  	Pdb.error  s    eS{{+r   c                 d    SUR                   ;  a  0 UR                   S'   X1R                   S   U'   g )Nr
  )r  )r]   r  r  values       r   r  Pdb.set_convenience_variable  s/    (?=?EOO9:?D56t<r   c                   > [         TU ]  XX45      nU R                   H,  nUR                  U5      (       d  M  UR	                  U5        M.     U(       a  U$ U R                  XX45      nU(       a  U$ U R                  XX45      $ r-   )r   r  r   r  rf  _complete_expressionr  )	r]   textrK   begidxendidxr   r  expressionsr   s	           r   r  Pdb.completenames  sy     7(VD\\E%%& " O33DOK""''FCCr   c                 <   UR                  5       R                  S5      (       a  / $  U R                  XX45      n[        R                  " [        R
                  " U5      S-   5      nU H  n[        R                  R                  U5      (       a  UR                  US-   5        M=  [        R                  R                  U5      (       d  Mc  UR                  5       R                  S5      (       d  M  UR                  US-   5        M     U$ ! [         a    / n Nf = f)N):,*/).pyz.pywr  )r  endswithr  r   globr7   rk   rl   rs   rf  isfilelower)r]   r  rK   r  r  retglobsfns           r   _complete_locationPdb._complete_location  s    ::<  ,,I	++DGC 		$++d+c12Bww}}R  

28$##
(;(;O(L(L

28$	 
 
  	C	s   D DDc                     [        [        R                  R                  5       VVs/ s H6  u  pVUc  M
  [	        U5      R                  U5      (       d  M+  [	        U5      PM8     snn$ s  snnf r-   )r@   r   
Breakpoint
bpbynumberrd   r  )r]   r  rK   r  r  rV   bps          r   _complete_bpnumberPdb._complete_bpnumber  sZ     %.cnn.G.G$H ?$H51 &)!f&7&7&= A$H ? 	? ?s   	A(A(A(c                    U R                   (       d  / $ 0 U R                   R                  EU R                  EnUR                  S5      (       aV  U R                   R                  R	                  S0 5      nU Vs/ s H"  owR                  USS  5      (       d  M  SU 3PM$     sn$ SU;   a  UR                  S5      n XXS      n	USS  H  n
[        X5      n	M     SR                  US S 5      S-   n[        U	5       Vs/ s H!  oR                  US   5      (       d  M  X-   PM#     sn$ UR                  5        Vs/ s H  oR                  U5      (       d  M  UPM     sn$ s  snf ! [        [        4 a    / s $ f = fs  snf s  snf )Nr  r
  r)   .r   rx  )r	  r  r  r  rZ  r  r5  KeyErrorr  r?   dirkeys)r]   r  rK   r  r  r   	conv_varsr  dottedr  partrJ  ns                r   r  Pdb._complete_expression  s`   }}I A''@4+?+?@??3//334QSUVI+4R94QR8QJavJ9RR$; ZZ_Fm"1RLD!#,C ) XXfSbk*S0F(+CM1LL4LJFJMM  "wwy?y!LL,>Ay??! S n- 	 N @s6   8E!	E!<E& >E>E>;FF&E;:E;c                    UR                  S5      (       aV  U R                  R                  R                  S0 5      nU Vs/ s H"  ofR                  USS  5      (       d  M  SU 3PM$     sn$ Sn/ n[	        U R                  R                  U R
                  -  5      n	U	R                  X5      =n
b,  UR                  U
5        US-  nU	R                  X5      =n
b  M,  U$ s  snf )Nr  r
  r)   r   )r  r	  r  rZ  r   r  completerf  )r]   r  rK   r  r  r  r  statematches	completerrA   s              r   r  Pdb.completedefault  s    ??3//334QSUVI+4R94QR8QJavJ9RR dmm558L8LLM	!**477uDNN5!QJE "**477uD  Ss   C!	Cc                 t    U R                  U R                  U R                     5        U R                  5         g r-   )r8  r  r  ra  r]   r  s     r   rw  Pdb._pdbcmd_print_frame_status  s)    tzz$--89r   c                    U(       d'  [        [        R                  R                  5      S-
  nO [	        U5      n U R                  U5        X l	        X R                  ;   a-  U R                  U   U R                  U   U R                  U   4nOSn/ U R                  U'   SU R                  U'   SU R                  U'   U R                  nSU l        SU l         U R                  5         SU l        XPl        g!   U R                  U5         g= f! [         a  nU R                  SU-  5         SnAgSnAff = f! [          ay    U(       a7  US   U R                  U'   US   U R                  U'   US   U R                  U'   O'U R                  U	 U R                  U	 U R                  U	 U R                  S	5         Nf = f! SU l        XPl        f = f)
aR  (Pdb) commands [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.
r)   Nzcannot set commands: %sTFz(com) r   r  z1command definition aborted, old commands restored)rj  r   r  r  int_print_invalid_argget_bpbynumberr|  r  r   r   r   r   r   r   rN  r   )r]   r  bnumerrold_command_defsprompt_backs         r   do_commandsPdb.do_commands  s   J s~~001A5D3x	%
 "==  $d 3 $ 6 6t < $ 4 4T : <  $ d'+t$%*T"kk!%	&LLN &+D"%KO'',  	JJ0367	* ! 
	L&6q&9d#/?/B&&t,-=a-@$$T*MM$'**40((.JJJK
	L &+D"%KsG   C7 D D: 7D
D7D22D7:B F=:G  <F==G   Gc                 8   U(       dl  U R                   (       aZ  U R                  S5        [        R                  R                   H+  nU(       d  M  U R                  UR                  5       5        M-     gSnSnSnUR                  S5      nUS:  aZ  XS-   S R                  5       nU R                  U5      =n(       a  U R                  SU< SU< 35        gUSU R                  5       nUR                  S5      n	Sn
U	S:  ad  USU	 R                  5       nU R                  U5      nU(       d  U R                  S	U-  5        gUnXS-   S R                  5       n [        U5      nO [        U5      nU(       d  U R5                  5       nU R7                  XE5      nU(       ax  U R9                  UUX&U
5      nU(       a  U R                  U5        gU R;                  UU5      S   nU R                  SUR<                  UR>                  UR@                  4-  5        gg! [         a    U R                  S
U-  5         gf = f! [         a     [        UU R                   R"                  U R$                  5      nO	!   Un O= f ['        US5      (       a  UR(                  nUR*                  nUR,                  n
[/        U5      nUR0                  n GN\!   U R3                  U5      u  pnU(       d  U R                  SU-  5          gUn
[        U5      n  GN= ff = f)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  r   r)   Invalid condition rX  r  z%r not found from sys.pathzBad lineno: %s__func__zJThe specified object %r is not a function or was not found along sys.path.rx  zBreakpoint %d at %s:%d)!breaksr   r   r  r  bpformatr  r  _compile_error_messager  r  rfindlookupmoduler*  r|  r  r	  r  r  r  r5  __code__r/   r&   r   lineinfodefaultFile	checkline	set_break
get_breaksnumberr  rK   )r]   r  	temporaryr  rE   r!   condcommar.  colonr2   r!  r  r#   oklnrK   s                    r   do_breakPdb.do_breakE  s     {{@A..33BrR[[]3 4  19Qwx='')D11$77s7

sCDfu+$$&C		#A:6E{))+H!!(+A

7(BCAgh-&&(CS%S4 '')H~~h/..4(KC

3__Xt4R85 ii"'':; < I  

+c12  % $ 7 7 $ 4 46DD%tZ00#}}==D  $||H7=F#//H%)-s);&R2

 $FHK$L M!H WF1%s[   H )I  H=<H= 
L+I76L7I=;LAK1LLLLLc                     U R                   R                  R                  nUS:X  a  U R                  (       a  U R                  nU$ )zProduce a reasonable default.r  )r	  r  r   r   )r]   rE   s     r   r=  Pdb.defaultFile  s3    ==''33z!dooHr   c                 (    U R                  US5        g)ztbreak [ ([filename:]lineno | function) [, condition] ]

Same arguments as break, but sets a temporary breakpoint: it
is automatically deleted when first hit.
r)   N)rH  r'  s     r   	do_tbreakPdb.do_tbreak  s     	c1r   c                    SnUR                  S5      n[        U5      S:X  a  US   R                  5       nO%[        U5      S:X  a  US   R                  5       nOU$ US:X  a  U$ UR                  S5      nUS   S:X  a  US	 [        U5      S:X  a  U$ U R                  5       n[        U5      S:X  a  US   nO"U R	                  US   5      nU(       a  UnUS   n[        XpR                  U5      5      n	U	=(       d    U$ )	N)NNNr  r)   r      r(   r  r]   )r  rj  r  r=  r:  rN   r,  )
r]   
identifierfailedidstringidpartsfnameitemr!  answers
             r   r<  Pdb.lineinfo  s    ###C(x=A!""$B]a!""$BM8F]8va5zQ  "u:?8D !!%(+A8Dt\\%%89r   c                 2   [        U SS5      nU(       a  UR                  OSn[        R                  " XU5      nU(       d  U R	                  S5        gUR                  5       nU(       a  US   S:X  d  USS S:X  d	  USS S:X  a  U R                  S	5        gU$ )
zCheck 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	  NzEnd of filer   r  rP  z"""z'''zBlank or comment)r5  r  r;   getliner   r  r  )r]   rE   r!   r  r  rK   s         r   r>  Pdb.checkline  s     j$/#(d  59LL'zz|aC2Ah%D!H$5JJ)*r   c                     UR                  5       nU H9  n U R                  U5      nUR                  5         U R                  SU-  5        M;     g! [         a  nU R                  U5         SnAM_  SnAff = f)zoenable bpnumber [bpnumber ...]

Enables the breakpoints given as a space separated list of
breakpoint numbers.
z
Enabled %sN)r  r,  enabler   r|  r  r]   r  r  rV   r  r.  s         r   	do_enablePdb.do_enable  si     yy{A0((+ 		\B./    

3    A
A7A22A7c                     UR                  5       nU H9  n U R                  U5      nUR                  5         U R                  SU-  5        M;     g! [         a  nU R                  U5         SnAM_  SnAff = f)a  disable 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.
zDisabled %sN)r  r,  disabler   r|  r  r_  s         r   
do_disablePdb.do_disable  si     yy{A1((+ 

]R/0    

3 rb  c                     UR                  SS5      n US   nU R                  U5      =n(       a  U R                  SU< SU< 35        g  U R	                  US   R                  5       5      nX5l        U(       d  U R                  SUR                  -  5        gU R                  SUR                  -  5        g! [         a    Sn N|f = f! [         a    U R                  S	5         g[         a  nU R                  U5         SnAgSnAff = f)
zcondition 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  r)   r4  rX  Nr   z#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.Breakpoint number expected)
r  r8  r  
IndexErrorr,  r  rC  r   rA  r|  )r]   r  r  rC  r.  r  s         r   do_conditionPdb.do_condition  s     yya 	7D11$77s7

sCD 8
	Q$$T!W]]_5B GBRYYNOCbiiOP  	D	  	5JJ34 	JJsOO	s/   6B: "C :C	C	D)	D2DDc                 d   UR                  5       nU(       d  U R                  S5        g[        U5      S:X  a  SnO1[        U5      S:X  a   [        US   5      nOU R                  U5        g U R                  US   R                  5       5      nX4l        US:  a.  US:  a  SU-  nOSnU R                  SXTR                  4-  5        gU R                  S	UR                  -  5        g! [         a    U R                  U5         gf = f! [         a  nU R                  U5         SnAgSnAff = f)
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.
rh  Nr)   r   r  z%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)r  r  rj  r*  r|  r+  r,  r  ignorer   rA  )r]   r  r  countr  countstrr.  s          r   	do_ignorePdb.do_ignore9  s     yy{JJ34t9>EY!^DG
 ##C(	*$$T!W]]_5B Iqy19-5H+HD&		23 4 L!yy) *)  '',  	JJsOO	s*   C) ."D
 )DD

D/D**D/c                    U(       d   [        S5      nUR                  5       R                  5       nUS;   a_  [        R
                  R                   Vs/ s H  o3(       d  M  UPM     nnU R                  5         U H  nU R                  SU-  5        M     gSU;   a  UR                  S5      nUSU nXS-   S n [        U5      nU R                  Xg5      SS nU R                  Xg5      nU(       a  U R                  U5        gW H  nU R                  SU-  5        M     gUR                  5       n	U	 H:  n U R!                  U5      nU R#                  U5        U R                  SU-  5        M<     g! [         a    Sn GNof = fs  snf ! [         a    SU-  n Nf = f! [         a  nU R                  U5         SnAM  SnAff = f)	a  cl(ear) [filename:lineno | 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.
zClear all breaks? no)yyesz
Deleted %sNr  r)   zInvalid line number (%s))r  r  r  r
  r   r  r  clear_all_breaksr   r9  r*  r@  clear_breakr|  r  r  r,  clear_bpbynumber)
r]   r  replyr  bplistrV   rE   r!   r.  
numberlists
             r   do_clearPdb.do_cleare  s    23 KKM'')E$'*~~'@'@G'@B"'@G%%' BLL!23 !#:		#A2AwHcd)C9S :1=&&x8

3  !BLL!23 !YY[
A0((+ %%a(\B./ 9   H  70367   

3 sG   E4 
F"F<F 9F!4FFFF!
G+GGc                 V    U(       a  U R                  U5        gU R                  5         g)zw(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)r+  print_stack_tracer'  s     r   do_wherePdb.do_where  s$     ##C( r   c                 ~   SUs=::  a  [        U R                  5      :  d   e   eXl        U R                  U R                     S   U l        U R                  R                  U l        U R                  U R                  SU R                  5        U R                  U R                  U R                     5        S U l        g )Nr   r  )	rj  r  r  r	  r  r  r  r8  r!   )r]   rA  s     r   _select_framePdb._select_frame  s    F,S_,,,,,

4==1!4#}}55%%dmmXt}}Mtzz$--89r   c                 <   U R                   (       d  U R                  S5        gU(       d  [        U R                   5       Hs  u  p#X R                  :X  a  SOSn[	        U5      n[        U5      S:  a  USS S-   nU R                   U   R                  c  SOUS	 nU R                  U SU SU 35        Mu     g [        U5      nSUs=::  a  [        U R                   5      :  a  O  OU R                   U   R                  c  U R                  S5        gXpl        U R                  SU R                   U   R                  5        U R                  U R                  U R                     5        gU R                  S5        g! [         a    U R                  S
5         gf = f)a2  exceptions [number]

List or change current exception in an exception chain.

Without arguments, list all the current exception in the exception
chain. Exceptions will be numbered, with the current exception indicated
with an arrow.

If given an integer as argument, switch to the exception at that index.
zDid not find chained exceptions. To move between exceptions, pdb/post_mortem must be given an exception object rather than a traceback.N>r  P   M   z...z  -z>3zArgument must be an integerr   z;This exception does not have a traceback, cannot jump to itzNo exception with that number)r   r   r@   r   r  rj  re  r*  r|  r  r#  r8  r  r  )r]   r  ixexcr   rep	indicatorrA  s           r   do_exceptionsPdb.do_exceptions  sy    ''LL3
 $T%=%=> "&C&C C3is8b=cr(U*C //3AAI r7 
 xq1SE:; ?S F:S!9!9::++F3AAIJJ\]06-

4!9!9&!A!O!OP&&tzz$--'@A

:;  

89s   9E= =FFc                     U R                   S:X  a  U R                  S5        g [        U=(       d    S5      nUS:  a  SnO[	        SU R                   U-
  5      nU R                  U5        g! [         a    U R                  SU-  5         gf = f)zku(p) [count]

Move the current frame count (default one) levels up in the
stack trace (to an older frame).
r   zOldest frameNr)   Invalid frame count (%s))r  r  r*  r|  maxr  r]   r  rn  newframes       r   do_up	Pdb.do_up  s     ==AJJ~&	qME 19H1dmme34H8$  	JJ1C78	s   A, ,BBc                    U R                   S-   [        U R                  5      :X  a  U R                  S5        g [	        U=(       d    S5      nUS:  a  [        U R                  5      S-
  nO/[        [        U R                  5      S-
  U R                   U-   5      nU R                  U5        g! [
         a    U R                  SU-  5         gf = f)znd(own) [count]

Move the current frame count (default one) levels down in the
stack trace (to a newer frame).
r)   zNewest frameNr  r   )r  rj  r  r  r*  r|  minr  r  s       r   do_downPdb.do_down  s     ==1DJJ/JJ~&	qME 194::*H3tzz?Q.0EFH8$  	JJ1C78	s   B. .CCc                    U(       a8   [        U5      nX R                  R                  ::  a  U R                  S5        gOSnU R                  U R                  U5        g! [         a    U R                  SU-  5         gf = f)a  unt(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	  r.  	set_until)r]   r  r!   s      r   do_untilPdb.do_until	  s     S ///

 ) * 0
 Ft}}f-  

2S89s   A B ?B c                 V    U(       a  U R                  U5        gU R                  5         g)zs(tep)

Execute the current line, stop at the first possible occasion
(either in a function that is called or in the current
function).
Nr)   )r+  r   r'  s     r   do_stepPdb.do_step"  s$     ##C(r   c                 l    U(       a  U R                  U5        gU R                  U R                  5        g)zan(ext)

Continue execution until the next line in the current function
is reached or it returns.
Nr)   )r+  set_nextr	  r'  s     r   do_nextPdb.do_next0  s+     ##C(dmm$r   c                    U(       aE  SSK n[        R                  SS n UR                  U5      [        l        U[        R                  SS& [        e! [         a#  nU R                  SU< SU< 35         SnAgSnAff = f)zrun [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".
r   Nr)   zCannot run rX  )shlexrq   argvr  r|  r  r   )r]   r  r  argv0r   s        r   do_run
Pdb.do_run=  sj     HHQqME ;;s+ !CHHRaL  

#q9:s   A 
B A;;B c                 l    U(       a  U R                  U5        gU R                  U R                  5        g)zAr(eturn)

Continue execution until the current function returns.
Nr)   )r+  
set_returnr	  r'  s     r   	do_returnPdb.do_returnS  s+    
 ##C(&r   c                 
   U(       a  U R                  U5        gU R                  (       d9   [        R                  " [        R                  U R                  5      [
        l        U R                  5         g! [         a     Nf = f)zNc(ont(inue))

Continue execution, only stop when a breakpoint is encountered.
Nr)   )	r+  r   rz  r{  r  r   ry  r|  set_continuer'  s     r   do_continuePdb.do_continue_  sk    
 ##C(}}MM&--1D1DE , 	  
 s   8A5 5
BBc                     U R                   S-   [        U R                  5      :w  a  U R                  S5        g [	        U5      n XR
                  l        U R                  U R                      S   U4U R                  U R                   '   U R                  U R                  U R                      5        g! [         a  nU R                  SU-  5         SnAgSnAff = f! [         a    U R                  S5         gf = f)ad  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.
r)   z)You can only jump within the bottom frameNr   zJump failed: %sz)The 'jump' command requires a line number)	r  rj  r  r  r*  r	  r.  r8  r|  )r]   r  r   s      r   do_jumpPdb.do_jumpu  s     ==1DJJ/JJBC	2c(C2 *-&,0JJt}},Ea,H#,M

4==)&&tzz$--'@A 2

,q0112  	DJJBC	Ds*   C A-B4 4
C>CCC=<C=c                 <   [         R                  " S5        U R                  R                  nU R                  n[        U R                  U R                  U R                  5      nSU R                  R                  5       -  Ul	        U R                  S5         [         R                  " UR                  XU45        U R                  S5        [         R                  " U R                   5        UR"                  U l        g! [         a    U R                  5          N_f = f)zdebug 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) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)rq   settracer	  r  r  r   r   r   r   r   r  r   call_tracingr   r   r  trace_dispatchr6  )r]   r  r  r   ps        r   do_debugPdb.do_debug  s     	T--))%%  $**dkk:T[[..0023	QUUS6$:; 	12T(()yy	  	OO	s   #C> >DDc                 2    SU l         U R                  5         g)zNq(uit) | exit

Quit from the debugger. The program being executed is aborted.
Tr)   )_user_requested_quitset_quitr'  s     r   do_quitPdb.do_quit  s    
 %)!r   c                 T    U R                  S5        SU l        U R                  5         g)z.EOF

Handles the receipt of EOF as a command.
r(   Tr)   )r   r  r  r'  s     r   do_EOF
Pdb.do_EOF  s$    
 	R$(!r   c           	         U(       a  U R                  U5        gU R                  R                  nU R                  nUR                  UR
                  -   nUR                  [        R                  -  (       a  US-   nUR                  [        R                  -  (       a  US-   n[        U5       HX  nUR                  U   nXc;   a,  U R                  U< SU R                  X6   U5      < 35        MC  U R                  U< S35        MZ     g)z9a(rgs)

Print the argument list of the current function.
Nr)    = z = *** undefined ***)r+  r	  r  r  co_argcountco_kwonlyargcountco_flagsinspect
CO_VARARGSCO_VARKEYWORDSr  co_varnamesr   r]  )r]   r  corf   r  rV   r  s          r   do_argsPdb.do_args  s    
 ##C(]]!!##NNR111;;+++1Q;;///QqSqA>>!$D|$
D0QRS?@ r   c                     U(       a  U R                  U5        gSU R                  ;   a/  U R                  U R                  U R                  S   S5      5        gU R	                  S5        g)zBretval

Print the return value for the last return of a function.
Nr=  retvalzNot yet returned!)r+  r  r   r]  r  r'  s     r   	do_retvalPdb.do_retval  sU    
 ##C(4///LL)=)=l)KXVWJJ*+r   c                      [        XR                  R                  U R                  5      $ !   U R	                  5         e = fr-   )r  r	  r  r  r  r'  s     r   _getvalPdb._getval  s8    	]]44d6J6JKK	OOs   ), ?c                     Uc*  [        XR                  R                  U R                  5      $ [        XR                  UR                  5      $ ! [
         a'  n[        SU R                  U5      -  5      s S nA$ S nAff = f)Nz** raised %s **)r  r	  r  r  r  rd  rY   rE  )r]   r  r  r  s       r   r\  Pdb._getval_except  sm    	D}C!8!8$:N:NOOC%..AA 	D*T-=-=c-BBCC	Ds"   ,A A 
B A;5B ;B c                 n    [         R                  " 5       nU R                  U R                  U5      5        g r-   )rq   	exceptionr  rE  r]   r  s     r   r  Pdb._error_exc  s$    mmo

4##C()r   c                      U R                  U5      n U R                  U" U5      5        g !    g = f!   U R                  5          g = fr-   )r  r   r  )r]   r  r  vals       r   _msg_val_funcPdb._msg_val_func  sD    	,,s#C	LLc#		OOs   , 3 0Ac           	           [        U5      $ ! [         a+  n[        SU SU R                  U5       S35      s S nA$ S nAff = f)Nz	*** repr(z
) failed: z ***)r  r   rY   rE  )r]   r  r^  r   s       r   r]  Pdb._safe_repr  sJ    	P9 	P9TF*T5E5Ea5H4INOO	Ps   
 
A =AAc                 0    U R                  U[        5        g)z1p expression

Print the value of the expression.
N)r  r  r'  s     r   do_pPdb.do_p  s    
 	3%r   c                 D    U R                  U[        R                  5        g)z9pp expression

Pretty-print the value of the expression.
N)r  pprintpformatr'  s     r   do_pp	Pdb.do_pp  s    
 	3/r   c                 H   SU l         SnU(       a  US:w  a   SU;   aO  UR                  S5      u  p2[        UR                  5       5      n[        UR                  5       5      nX#:  a  X2-   nOo[        UR                  5       5      n[	        SUS-
  5      nOFU R                  b  US:X  a$  [	        SU R                  R                  S-
  5      nOU R                  S-   nUc  US-   nU R                  R                  R                  nUR                  S	5      (       a<  U R                  R                  R                  S
5      n[        U[         5      (       a  UnU R#                  U5      n [$        R&                  " X@R                  R                  5      nU R)                  XsS-
  U X6U R                  5        [+        U[-        U5      5      U l        [-        U5      U:  a  U R/                  S5        gg! [
         a    U R                  SU-  5         gf = f! [0         a     gf = f)aX  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.
rQ   Nr  r  r)      r  r  z<frozenr   z[EOF])r6  r  r*  r  r  r|  r  r!   r	  r.  r  r   r  r  rZ  r.   rd   get_file_breaksr;   r<   _print_linesr  rj  r   r   )r]   r  lastfirstrE   tmp	breaklistrH   s           r   do_listPdb.do_list  s    3#:#:"%))C.KE.Etzz|,D|$|		,E519-E [[ C3J4==11A56EKK!OE<2:D==''33 y))--))--j9C#s##((2		&&x1H1HIEe!GD15"mm-dCJ/DK5zD W% !-  

2S890 ! 		s+   AG0 -(G0 (BH 0HH
H! H!c                 \   U(       a  U R                  U5        gU R                  R                  R                  nU R	                  U5      n U R                  U R                  5      u  pEU R                  XEX0R                  5        g! [         a  nU R                  U5         SnAgSnAff = f)zMll | longlist

List the whole source code for the current function or frame.
N)	r+  r	  r  r   r  _getsourcelinesr:   r  r  )r]   r  rE   r  rH   r!   r.  s          r   do_longlistPdb.do_longlistR  s    
 ##C(==''33((2		 00?ME 	%MMB  	JJsO	s   B 
B+B&&B+c                      U R                  U5      n U R                  U5      u  p4U R                  X45        g!    g= f! [        [        4 a  nU R	                  U5         SnAgSnAff = f)zOsource expression

Try to get source code for the given object and display it.
N)r  r  r:   	TypeErrorr  r  )r]   r  r  rH   r!   r.  s         r   	do_sourcePdb.do_sourced  sj    
	,,s#C	 005ME 	%(	 # 	JJsO	s   9 A  = A+A&&A+c                    U(       a)  UR                   nU R                  R                  US5      nOS=pV[        X5       H}  u  px[	        U5      R                  S5      n	[        U	5      S:  a  U	S-  n	Xs;   a  U	S-  n	OU	S-  n	Xu:X  a  U	S-  n	O
Xv:X  a  U	S-  n	U R                  U	S-   UR                  5       -   5        M     g	)
zPrint a range of lines.rx  rP     r  Bz->z>>	N)	r.  r   rZ  r@   rd   rjustrj  r   r  )
r]   rH   r*   r6  r  current_lineno
exc_linenor!   rK   ss
             r   r  Pdb._print_linesv  s    "^^N++E26J*,,N%e3LFF!!!$A1vzSSS'T	%T	LLTDKKM12 4r   c                     U R                  U5      nSn UR                  R                  nU(       a  U R	                  SUR
                  -  5        g UR                  nU(       a  U R	                  SUR
                  -  5        gUR                  [        L a.  U R	                  SUR                  < SUR                  < 35        gU R	                  [        U5      5        g!    g= f! [         a     Nf = f! [         a     Nf = f)z3whatis expression

Print the type of the argument.
Nz	Method %szFunction %szClass r  )
r  r5  r;  r   r   r/   r   typer   r   )r]   r  r  r#   s       r   	do_whatisPdb.do_whatis  s    
	LL%E 	>>**D LLt||34	>>D LL56??d"LL%*:*:E<N<NOPT%[!3	
  		  		s.   C! C( C8 !C%(
C54C58
DDc           	      j   U(       d  U R                   (       av  U R                  S5        U R                   R                  U R                  0 5      R	                  5        H,  u  p#U R                  U< SU R                  X25      < 35        M.     gU R                  S5        gU R                  U5      =n(       a  U R                  SU< SU< 35        gU R                  U5      nX0R                   R                  U R                  0 5      U'   U R                  SU< SU R                  X15      < 35        g)zdisplay [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.
zCurrently displaying:rX  z No expression is being displayedzUnable to display rW  N)
r   r   rZ  r	  r[  r]  r8  r  r\  
setdefault)r]   r  keyr  r.  s        r   
do_displayPdb.do_display  s     45 $ 3 3DMM2 F L L NHCLLS$//#2K!LM !O ?@11#66s6

cBC))#.EH**4=="=cBdooc6OPQr   c                     U(       a)   U R                   R                  U R                  0 5      U	 gU R                   R                  U R                  S5        g! [         a    U R	                  SU-  5         gf = f)zundisplay [expression]

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

Without expression, clear all display expressions for the current frame.
znot displaying %sN)r   rZ  r	  r  r  r  r'  s     r   do_undisplayPdb.do_undisplay  sf     6OO''r:3? OOt4  6

.456s   'A A98A9c                     U R                   R                  U R                  0 5       Vs/ s H  nUR                  U5      (       d  M  UPM     sn$ s  snf r-   )r   rZ  r	  r  )r]   r  rK   r  r  r   s         r   complete_undisplayPdb.complete_undisplay  sH    ??..t}}bA 'Aa<<% A ' 	' 's   AAc                     0 U R                   R                  EU R                  En[        X R                  S9nUR                  SSS9  g)zinteract

Start an interactive interpreter whose global namespace
contains all the (global and local) names found in the current scope.
)r   z*pdb interact start*z *exit from pdb interact command*)bannerexitmsgN)r	  r  r  r   r   interact)r]   r  r   consoles       r   do_interactPdb.do_interact  sL     A''@4+?+?@(\\B 6!C 	 	Er   c                    UR                  5       n[        U5      S:X  aR  [        U R                  R	                  5       5      nU H(  nU R                  U< SU R                  U   < 35        M*     g[        U5      S:X  aX  US   U R                  ;   a,  U R                  US   < SU R                  US      < 35        gU R                  SUS    S35        gSR                  USS 5      nSU;  aE  S	n[        SS
5       H3  nSU 3U;  a  SnSU 3U;   d  M  U(       a  M"  U R                  S5          g   X@R                  US   '   g)a  alias [name [command]]

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
r   r  Nr)   zUnknown alias 'r  r  r  Tr  r  Fz*Replaceable parameters must be consecutive)	r  rj  sortedr   r  r   r  r?   r  )r]   r  r  r  r  consecutiver  s          r   do_aliasPdb.do_alias  s(   2 yy{t9>$,,++-.D%e1DEF t9>Aw$,,&$q'4<<Q3HIJ

_T!WIQ78 HHT!"X&E5 " B<C3%y-&+3%yE)++

#OP ( %*LLa!r   c                     UR                  5       n[        U5      S:X  a  U R                  U5        gUS   U R                  ;   a  U R                  US   	 gg)z*unalias name

Delete the specified alias.
r   N)r  rj  r+  r   )r]   r  r  s      r   
do_unaliasPdb.do_unalias  sP    
 yy{t9>##C(7dll"T!W% #r   c                 t    U R                    Vs/ s H  oUR                  U5      (       d  M  UPM     sn$ s  snf r-   )r   r  )r]   r  rK   r  r  as         r   complete_unaliasPdb.complete_unalias$  s'    <<><a<<+=<>>>s   55)r  r  r  r  r  r  c                 n     U R                    H  nU R                  U5        M     g ! [         a     g f = fr-   )r  r8  r   )r]   frame_linenos     r   r  Pdb.print_stack_trace3  s5    	 $

&&|4 !+  		s   $' 
44c                 x    Uu  p4X0R                   L a  SnOSnU R                  UU R                  X5      -   5        g )Nz> r  )r	  r   format_stack_entry)r]   r+  prompt_prefixr  r!   rJ  s         r   r8  Pdb.print_stack_entry:  s@    $MM!FFV,,\IJ 	Kr   c                    U(       d  [         R                  R                  X5      $   [        U SU-   5      nU" 5       $ ! [         a    [        U SU-   5      n Of = f [
        R                  R                  S:  a  U R                  SU-  5        gUR                  c  U R                  SU-  5        gU R                  U R                  UR                  5      5        g! [         a    U R                  SU-  5         gf = f)zh(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.
help_r  r  zJNo help for %r; please do not run Python with -OO if you need command helpNz&No help for %r; __doc__ string missingzNo help for %r)r   r   do_helpr5  r  rq   rt   optimizer  r   r   _help_message_from_doc)r]   r  topicr  s       r   r3  Pdb.do_helpE  s     77??4--	G5gm4w! 5!$45 yy!!Q&

 68;< =&

CcIJLL44W__EF  	/JJ'#-.	/s'   ? AC AC D ?D c                 |    U R                  U R                  R                  =(       d    SR                  5       5        g)ax  (!) 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, e.g.:
(Pdb) ! n=42
(Pdb)

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)
r(   N)r   	help_execr   r  r\   s    r   r9  Pdb.help_execc  s(     	dnn,,299;<r   c                     [        5         g r-   )r   r\   s    r   help_pdbPdb.help_pdbs  s    r   c                    UR                  S5      (       d#  UR                  S[        R                  5      S-   n[        R                  R                  U5      (       a'  [        R                  R                  U5      (       a  U$ g[        R                   H  n[        R                  R                  U5      (       a<  [        R                  " U5      n[        R                  R                  U5      (       a  M<  [        R                  R                  X!5      n[        R                  R                  U5      (       d  M  Us  $    g)a  Helper function for break/clear parsing -- may be overridden.

lookupmodule() translates (possibly incomplete) file or module name
into an absolute file name.

filename could be in format of:
    * an absolute path like '/path/to/file.py'
    * a relative path like 'file.py' or 'dir/file.py'
    * a module name like 'module' or 'package.module'

files and modules will be searched in sys.path.
r  r  N)r  r  rk   seprl   isabsro   rq   islinkreadlinkr?   )r]   rE   rv   fullnames       r   r:  Pdb.lookupmodulex  s       ''''RVV4u<H77==""ww~~h''xxG''..))++g. ''..))ww||G6Hww~~h''   r   rw   c                 P   SU l         SU l        U R                  UR                  5      U l        SS KnUR                  R                  5         UR                  R                  UR                  5        U R                  R                  5         U R                  UR                  5        g )NTFr   )r   r  r,  rE   r   r   __dict__r  r  rc   rR  r   r#   )r]   rw   r   s      r   _runPdb._run  s}     %)!$)!,,v7
 	!  !1!12 	$$&r   r  c                 P    [         R                  " U5      S   R                  5       $ )Nrx  )r   format_exception_onlyr  r  s     r   rE  Pdb._format_exc  s!    ..s3B7==??r   c                      [        USS5        g! [         a$  n[        U R                  U5      5      s SnA$ SnAff = f)z=Return the error message as string if compiling `expr` fails.r  r  Nr(   )r6   rB   rY   rE  )r]   r^  r  s      r   r8  Pdb._compile_error_message  s@    	0D)V,   	0))#.//	0s    
>9>>c                 P    [         R                  " U5      u  p#[        SU5      nX#4$ )Nr)   )r  getsourcelinesr  )r]   r  rH   r!   s       r   r  Pdb._getsourcelines  s)      ..s3Q}r   c                    UR                  5       R                  5        Vs/ s H  o3R                  5       PM     nnU(       d  gSU;   a  UR                  S5      nOSn/ nS[	        U R
                  5      -  n[        U5       H7  u  pUS:X  a  Sn	OX:  a  Sn	OU(       a    OSn	UR                  Xy-   U-   5        M9     SR                  U5      $ s  snf )	NzNo help message found.r(   r)   r  r   zUsage: z       r  )	r  
splitlinesr  indexrj  r   r@   rf  r?   )
r]   doc
usage_onlyrK   rH   	usage_end	formattedr  rV   rJ  s
             r   r5  Pdb._help_message_from_doc  s    *-**,*A*A*CD*C$*CD+;BII	s4;;'' 'GAAv""V_t34 ( yy##' Es   Cc                    U R                  SU 35        [        R                  " [        U [        R
                  " S5      R                  R                  5      5      nUb   U R                  U R                  USS95        gg)z'Return the usage string for a function.zInvalid argument: r)   NT)rU  )
r  r  getdocr5  rq   	_getframer  r/   r   r5  )r]   r  rT  s      r   r+  Pdb._print_invalid_arg  sj     	

'u-.
 nnWT3==+;+B+B+J+JKL?LL44ST4JK r   )r   r   r  r   r   r   r   r   r   r   r   r   r  r	  r  r  r4  r   r   r6  r!   r   r   r   r   r  r   r   )tabNNNFT)r  )r   r-   )r	   N)F)r
   r   r   r   ry  rk  rR  rx   r  r  r  r#  r)  r1  user_opcoder0  r@  rK  r9  rT  ra  rp  r   rt  r'  r  r  r  r  r  r  r7  r  r   r  r  r  r  r  r  r  rw  r1  complete_commandsrH  r=  do_bcomplete_break
complete_brM  complete_tbreakr<  r>  r`  complete_enablere  complete_disablerj  complete_conditionrp  complete_ignorer|  do_clcomplete_clearcomplete_clr  do_wdo_btr  r  r  do_ur  do_dr  do_untr  do_sr  do_nr  
do_restartr  do_rr  do_cdo_contr  do_jr  complete_debugr  do_qdo_exitr  r  do_ar  do_rvr  r\  r  r  r]  r  r  complete_print
complete_pcomplete_ppr  do_lr  do_llr  complete_sourcer  r
  complete_whatisr  complete_displayr  r  r  r!  r$  r(  r  r  line_prefixr8  r3  do_hr9  r<  r:  ra   rG  rd  rE  r8  r  r5  r+  r   r   r   s   @r   r   r   2  sP   # #&HL(,3*j H**  K0&/(
61 D"7H . .(6$  Rh.`$B$L1"8.,
ED&?@:"Q&f +^<B D'N#J )O B,0  )O1& *Q: ,(*T )O.0^ E'N$K
! DE-<^%& D%& D. F D
 D( J	 D( ! D728 D!* *N DGA& D, ED*P&0 *N%J&K6n DC  E)  +O3* "D +OR. ,5'	E0*d
&?/ =H KG8 D= 
<, 0@} @$,
L 
Lr   r   )"r   wheredownupbreaktbreakr  rd  r^  rm  	conditionr   steprC   untiljumpreturnr  r   continuerQ   longlistr  r  ppwhatisr  display	undisplayr  r  unaliasdebugquitr  z

c                 8    [        5       R                  XU5        g)a  Execute the *statement* (given as a string or a code object)
under debugger control.

The debugger prompt appears before any code is executed; you can set
breakpoints and type continue, or you can step through the statement
using step or next.

The optional *globals* and *locals* arguments specify the
environment in which the code is executed; by default the
dictionary of the module __main__ is used (see the explanation of
the built-in exec() or eval() functions.).
N)r   r   	statementr  r   s      r   r   r     s     EIIi&)r   c                 6    [        5       R                  XU5      $ )zEvaluate the *expression* (given as a string or a code object)
under debugger control.

When runeval() returns, it returns the value of the expression.
Otherwise this function is similar to run().
)r   r   )
expressionr  r   s      r   r   r   		  s     5==f55r   c                     [        XU5        g r-   )r   r  s      r   r   r   	  s    	F#r   c                  6    [        5       R                  " U 0 UD6$ )zCall the function (a function or method object, not a string)
with the given arguments.

When runcall() returns, it returns whatever the function call
returned. The debugger prompt appears as soon as the function is
entered.
)r   r   )r  kwdss     r   r   r   	  s     5==$'$''r   )headerc                     [        5       nU b  UR                  " U 5        UR                  " [        R                  " 5       R
                  5        g)a  Enter the debugger at the calling stack frame.

This is useful to hard-code a breakpoint at a given point in a
program, even if the code is not otherwise being debugged (e.g. when
an assertion fails). If given, *header* is printed to the console
just before debugging begins.
N)r   r   r   rq   r[  f_back)r  pdbs     r   r   r    	  s5     %CFMM#--/(()r   c                 *    [        U [        5       5      $ )al  Enter post-mortem debugging of the given *traceback*, or *exception*
object.

If no traceback is given, it uses the one of the exception that is
currently being handled (an exception must be being handled if the
default is to be used).

If `t` is an exception object, the `exceptions` command makes it possible to
list and inspect its chained exceptions (if any).
)_post_mortemr   )r  s    r   r   r   /	  s     35!!r   c                     U c$  [         R                  " 5       nUb  UR                  n U b"  [        U [        5      (       a  U R                  c  [        S5      eUR                  5         UR                  SU 5        g)zZ
Private version of post_mortem, which allow to pass a pdb instance
for testing purposes.
NzAA valid traceback must be passed if no exception is being handled)rq   r  re  r.   rd  r|  r  r'  )r  pdb_instancer  s      r   r  r  =	  sn     	ymmo?!!AyZ=11aoo6M 6 7 	7 T1%r   c                  6    [        [        R                  5        g)zCEnter post-mortem debugging of the traceback found in sys.last_exc.N)r   rq   last_excr	   r   r   r   r   P	  s    r   zimport x; x.main()c                  "    [        [        5        g r-   )r   TESTCMDr	   r   r   testr  Y	  s	    Lr   c                  6    SS K n U R                  [        5        g rP   )pydocpagerr   )r  s    r   r   r   ]	  s    	KKr   a  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            
         SS K n U R                  SS[        U R                  SS9nUR	                  SSS/ S	S
SS9  UR	                  SSSS9  [        [        R                  5      S:X  a&  UR                  5         [        R                  " S5        UR                  5       u  p#UR                  (       aD  [        R                  R                  S5      n[        R                  SU nUR                  U5        Oa[        [        R                   " S U5      5      nU(       a9  UR#                  SSR%                  U5       35        [        R                  " S5        UR                  (       a  UR                  n['        U5      nOVU(       d  UR#                  S5        UR)                  S5      nUR+                  S5      (       a  [-        U5      nO[/        U5      nU/U-   [        R                  S S & [1        5       n	U	R2                  R5                  UR6                  5          U	R8                  " U5        U	RL                  (       a  g [=        S5        M2  ! [:         a>    [=        SUS5        [=        SSR%                  [        R                  SS  5      -   5         Nf[>         a  n
[=        SSS9  [=        U
5         S n
A
NS n
A
f[@         a  n
[B        RD                  " U
[F        RH                  " 5       S9  [=        S5        [=        S5         U	RJ                  " S U
5         S n
A
N! [:         aD    [=        SUS5        [=        SSR%                  [        R                  SS  5      -   5          S n
A
GMN  f = fS n
A
ff = f) Nr   r  z:%(prog)s [-h] [-c command] (-m module | pyfile) [args ...]F)progusagedescriptionformatter_classallow_abbrevz-cz	--commandrf  r  r   z4pdb commands to execute as if given in a .pdbrc file)actionr  metavardestr   z-mmodule)r  r  r)   r  c                 $    U R                  S5      $ )N-)r  )r'  s    r   <lambda>main.<locals>.<lambda>	  s    !,,s:Kr   zunrecognized arguments: r  zno module or script to runz.pyz
Restartingzwith arguments:r  z/The program exited via sys.exit(). Exit status:r   )colorizez2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz*The program finished and will be restarted)'argparseArgumentParser_usageRawDescriptionHelpFormatteradd_argumentrj  rq   r  
print_helprr   parse_known_argsr  rS  
parse_argsrQ   	itertools	takewhiler  r?   r   r  r  r   rh   r   r   r   r   rG  r   rp   
SystemExitrd  r   print_exception	_colorizecan_colorizer'  r  )r  parseroptsr  r  args_to_pdbinvalid_argsr  rw   r  r   s              r   mainr  o	  s   $$%+g175=5Y5Y27	 % 9F k(BPY`jS  U
hX>
388} 	((*JD{{ hhnnT"hhqo+&
 I//0KTRSLL3CHH\4J3KLMHHQK{{{{t$LL56xx{==  %F"4(F&4-CHHQK %CKKt}}%
	HHV$ ##:;-   	1,(9:$#((12,//0 	CM!HH 		%%a)2H2H2JKFGEFa(( lF,=>dSXXchhqrl334		sJ   I AM3	M3J99M3>M.LAM+"M.*M++M..M3r   )NNr-   )Ar   rk   r=   r5   rq   r   r   r   r#   r  r  r  r  r  rz  r  r  r8   r  r   r;   r  
contextlibr   rlcompleterr   r   r   r   __all__r&   rN   rW   rd   rY   ra   rh   r   r   InteractiveConsoler   r  r   r   r   _help_order_commandr5  r  r9  r   r   r   r   r   r   r  r   r  r  r   r  r  r
   r  r	   r   r   <module>r     s  ?F 
 	 	 
 
 
 
               % ! 	i 	"">C  $
% $
N"
% "
J#
" #
L$T44 $ qL#''377 qLj= K  73 0199??AFJJ  s}}$$$GX
*6$(  *"&& 
U<r zHHJ r   