%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/__pycache__/bdb.cpython-38.pyc

U

na8}@sdZddlZddlZddlZddlmZmZmZdddgZeeBeBZ	Gddde
ZGdddZd	d
Z
GdddZdd
ZddZGdddeZddZddZddZdS)zDebugger basicsN)CO_GENERATORCO_COROUTINECO_ASYNC_GENERATORBdbQuitBdb
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)__name__
__module____qualname____doc__rr/usr/local/lib/python3.8/bdb.pyr
sc@sveZdZdZd[ddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZddZ
ddZddZddZddZdd Zd!d"Zd#d$Zd\d&d'Zd]d(d)Zd*d+Zd,d-Zd.d/Zd^d0d1Zd2d3Zd4d5Zd_d7d8Zd9d:Zd;d<Zd=d>Z d?d@Z!dAdBZ"dCdDZ#dEdFZ$dGdHZ%dIdJZ&dKdLZ'dMdNZ(d`dPdQZ)dadRdSZ*dbdTdUZ+dVdWZ,dXdYZ-dZe-_.dS)craGeneric Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.

    The optional skip argument must be an iterable of glob-style
    module name patterns.  The debugger will not step into frames
    that originate in a module that matches one of these patterns.
    Whether a frame is considered to originate in a certain module
    is determined by the __name__ in the frame globals.
    NcCs(|rt|nd|_i|_i|_d|_dS)N)setskipbreaksfncacheframe_returning)selfrrrr
__init__szBdb.__init__cCsR|d|dddkr|S|j|}|sNtj|}tj|}||j|<|S)a%Return canonical form of filename.

        For real filenames, the canonical form is a case-normalized (on
        case insensitive filesystems) absolute path.  'Filenames' with
        angle brackets, such as "<stdin>", generated in interactive
        mode, are returned unchanged.
        <>)rgetospathabspathnormcase)rfilenamecanonicrrr
r%s
zBdb.canoniccCs&ddl}|d|_|dddS)z5Set values of attributes as ready to start debugging.rN)	linecache
checkcachebotframe
_set_stopinfo)rr rrr
reset6sz	Bdb.resetcCs|jr
dS|dkr||S|dkr0|||S|dkrD|||S|dkrX|||S|dkrf|jS|dkrt|jS|dkr|jStd	t||jS)
aODispatch a trace function for debugged frames based on the event.

        This function is installed as the trace function for debugged
        frames. Its return value is the new trace function, which is
        usually itself. The default implementation decides how to
        dispatch a frame, depending on the type of event (passed in as a
        string) that is about to be executed.

        The event can be one of the following:
            line: A new line of code is going to be executed.
            call: A function is about to be called or another code block
                  is entered.
            return: A function or other code block is about to return.
            exception: An exception has occurred.
            c_call: A C function is about to be called.
            c_return: A C function has returned.
            c_exception: A C function has raised an exception.

        For the Python events, specialized functions (see the dispatch_*()
        methods) are called.  For the C events, no action is taken.

        The arg parameter depends on the previous event.
        Nlinecallreturn	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)quitting
dispatch_line
dispatch_calldispatch_returndispatch_exceptiontrace_dispatchprintrepr)rframeeventargrrr
r.=s$
zBdb.trace_dispatchcCs.||s||r(|||jr(t|jS)a	Invoke user function and return trace function for line event.

        If the debugger stops on the current line, invoke
        self.user_line(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        )	stop_here
break_here	user_liner)rr.rr1rrr
r*hs

zBdb.dispatch_linecCsd|jdkr|j|_|jS||s0||s0dS|jrH|jjt@rH|jS|	|||j
r^t|jS)aInvoke user function and return trace function for call event.

        If the debugger stops on this function call, invoke
        self.user_call(). Raise BbdQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        N)r"f_backr.r4break_anywhere	stopframef_codeco_flagsGENERATOR_AND_COROUTINE_FLAGS	user_callr)rrr1r3rrr
r+ts
zBdb.dispatch_callcCs|||s||jkrv|jr,|jjt@r,|jSz||_|||W5d|_X|j	rVt
|j|krv|jdkrv|dd|jS)aInvoke user function and return trace function for return event.

        If the debugger stops on this function return, invoke
        self.user_return(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        Nr)
r4returnframer:r;r<r=r.ruser_returnr)r
stoplinenor#r?rrr
r,szBdb.dispatch_returncCs||rF|jjt@r.|dtkr.|ddks||||jrtnD|jr||jk	r|jjjt@r|dtt	fkr||||jrt|j
S)aInvoke user function and return trace function for exception event.

        If the debugger stops on this exception, invoke
        self.user_exception(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        rN)r4r;r<r=
StopIterationuser_exceptionr)rr:
GeneratorExitr.r?rrr
r-s$


zBdb.dispatch_exceptioncCs.|dkrdS|jD]}t||rdSqdS)z4Return True if module_name matches any skip pattern.NFT)rfnmatch)rmodule_namepatternrrr
is_skipped_modules
zBdb.is_skipped_modulecCsN|jr||jdrdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)z>Return True if frame is below the starting frame in the stack.rFrT)rrJ	f_globalsrr:rBf_linenor7rrr
r4s

z
Bdb.stop_herecCs||jj}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||\}}|r|j|_|r|j	r|
t|jdSdSdS)zReturn True if there is an effective breakpoint for this line.

        Check for line or function breakpoint and if in effect.
        Delete temporary breakpoints if effective() says to.
        FTN)rr;co_filenamerrLco_firstlineno	effectivenumberZ	currentbp	temporarydo_clearstr)rr1rlinenobpflagrrr
r5s

zBdb.break_herecCstddS)zlRemove temporary breakpoint.

        Must implement in derived classes or get NotImplementedError.
        z)subclass of bdb must implement do_clear()N)NotImplementedError)rr3rrr
rRszBdb.do_clearcCs||jj|jkS)zEReturn True if there is any breakpoint for frame's filename.
        )rr;rMrr7rrr
r9szBdb.break_anywherecCsdS)z&Called if we might stop in a function.Nr)rr1Z
argument_listrrr
r>sz
Bdb.user_callcCsdS)z'Called when we stop or break at a line.Nrr7rrr
r6sz
Bdb.user_linecCsdS)z&Called when a return trap is set here.Nr)rr1Zreturn_valuerrr
rA	szBdb.user_returncCsdS)z$Called when we stop on an exception.Nr)rr1exc_inforrr
rE
szBdb.user_exceptionrcCs||_||_d|_||_dS)zSet the attributes for stopping.

        If stoplineno is greater than or equal to 0, then stop at line
        greater than or equal to the stopline.  If stoplineno is -1, then
        don't stop at all.
        FN)r:r@r)rB)rr:r@rBrrr
r#szBdb._set_stopinfocCs$|dkr|jd}||||dS)zxStop when the line with the lineno greater than the current one is
        reached or when returning from current frame.Nr)rLr#)rr1rTrrr
	set_until"s
z
Bdb.set_untilcCs0|jr |jj}|r |js |j|_|dddS)zStop after one line of code.N)rr8f_tracer.r#)rZcaller_framerrr
set_step*s

zBdb.set_stepcCs||ddS)z2Stop on the next line in or below the given frame.N)r#r7rrr
set_next6szBdb.set_nextcCs.|jjt@r||ddn||j|dS)z)Stop when returning from the given frame.Nr)r;r<r=r#r8r7rrr

set_return:szBdb.set_returncCsL|dkrtj}||r4|j|_||_|j}q|t|jdS)znStart debugging from frame.

        If frame is not specified, debugging starts from caller's frame.
        N)	sys	_getframer8r$r.rZr"r[settracer7rrr
	set_traceAs
z
Bdb.set_tracecCsH||jdd|jsDtdtj}|rD||jk	rD|`|j}q*dS)zStop only at breakpoints or when finished.

        If there are no breakpoints, set the system trace function to None.
        Nr)r#r"rr^r`r_r8rZr7rrr
set_continuePs

zBdb.set_continuecCs"|j|_d|_d|_tddS)zuSet quitting attribute to True.

        Raises BdbQuit exception in the next call to a dispatch_*() method.
        NT)r"r:r@r)r^r`rrrr
set_quit_szBdb.set_quitFc
Csb||}ddl}|||}|s.d||fS|j|g}||krN||t|||||}	dS)zSet a new breakpoint for filename:lineno.

        If lineno doesn't exist for the filename, return an error message.
        The filename should be in canonical form.
        rNzLine %s:%d does not exist)rr getliner
setdefaultappendr)
rrrTrQcondfuncnamer r%listrUrrr
	set_breakps

z
Bdb.set_breakcCs4||ftjkr|j|||j|s0|j|=dS)aPrune breakpoints for filename:lineno.

        A list of breakpoints is maintained in the Bdb instance and in
        the Breakpoint class.  If a breakpoint in the Bdb instance no
        longer exists in the Breakpoint class, then it's removed from the
        Bdb instance.
        N)rbplistrremoverrrTrrr

_prune_breakss
zBdb._prune_breakscCsj||}||jkrd|S||j|kr6d||fStj||fddD]}|qL|||dS)znDelete breakpoints for filename:lineno.

        If no breakpoints were set, return an error message.
        There are no breakpoints in %szThere is no breakpoint at %s:%dN)rrrrldeleteMero)rrrTrUrrr
clear_breaks


zBdb.clear_breakc
CsZz||}Wn.tk
r<}zt|WYSd}~XYnX|||j|jdS)zxDelete a breakpoint by its index in Breakpoint.bpbynumber.

        If arg is invalid, return an error message.
        N)get_bpbynumber
ValueErrorrSrqrofiler%)rr3rUerrrrr
clear_bpbynumberszBdb.clear_bpbynumbercCsX||}||jkrd|S|j|D]$}tj||f}|D]}|q<q&|j|=dS)z`Delete all breakpoints in filename.

        If none were set, return an error message.
        rpN)rrrrlrq)rrr%ZblistrUrrr
clear_all_file_breakss

zBdb.clear_all_file_breakscCs,|js
dStjD]}|r|qi|_dS)z]Delete all existing breakpoints.

        If none were set, return an error message.
        zThere are no breakpointsN)rr
bpbynumberrq)rrUrrr
clear_all_breakss

zBdb.clear_all_breakscCs|stdzt|}Wn"tk
r:td|dYnXztj|}Wn"tk
rltd|dYnX|dkrtd||S)zReturn a breakpoint by its index in Breakpoint.bybpnumber.

        For invalid arg values or if the breakpoint doesn't exist,
        raise a ValueError.
        zBreakpoint number expectedz Non-numeric breakpoint number %sNz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rtintrry
IndexError)rr3rPrUrrr
rsszBdb.get_bpbynumbercCs"||}||jko ||j|kS)z9Return True if there is a breakpoint for filename:lineno.rrrnrrr
	get_breaks

z
Bdb.get_breakcCs4||}||jkr0||j|kr0tj||fp2gS)znReturn all breakpoints for filename:lineno.

        If no breakpoints are set, return an empty list.
        )rrrrlrnrrr

get_breakss

zBdb.get_breakscCs&||}||jkr|j|SgSdS)zrReturn all lines with breakpoints for filename.

        If no breakpoints are set, return an empty list.
        Nr})rrrrr
get_file_breakss


zBdb.get_file_breakscCs|jS)z$Return all breakpoints that are set.)rrcrrr
get_all_breaksszBdb.get_all_breakscCsg}|r|j|kr|j}|dk	rD|||jf||jkr<qD|j}q|tdt|d}|dk	r||j|j	f|j}q^|dkrtdt|d}||fS)zReturn a list of (frame, lineno) in a stack trace and a size.

        List starts with original calling frame, if there is one.
        Size may be number of frames above or below f.
        Nrr)
tb_frametb_nextrgrLr"r8reversemaxlen	tb_lineno)rftstackirrr
	get_stacks 
z
Bdb.get_stack: cCsddl}ddl}|\}}||jj}d||f}|jjrH||jj7}n|d7}|d7}d|jkr|jd}	|d7}|||	7}||||j	}
|
r|||

7}|S)a:Return a string with information about a stack entry.

        The stack entry frame_lineno is a (frame, lineno) tuple.  The
        return string contains the canonical filename, the function name
        or '<lambda>', the input arguments, the return value, and the
        line of code (if it exists).

        rNz%s(%r)z<lambda>z()Z
__return__z->)r reprlibrr;rMco_namef_localsr0rerKstrip)rZframe_linenoZlprefixr rr1rTrsrvr%rrr
format_stack_entrys 	

zBdb.format_stack_entryc	Cs|dkrddl}|j}|dkr"|}|t|tr@t|dd}t|jz*zt
|||Wntk
rrYnXW5d|_	tdXdS)zDebug a statement executed via the exec() function.

        globals defaults to __main__.dict; locals defaults to globals.
        Nrz<string>execT)__main____dict__r$
isinstancerScompiler^r`r.r)rr)rcmdglobalslocalsrrrr
run5s

zBdb.runc	Csz|dkrddl}|j}|dkr"|}|t|jz,zt|||WWStk
r^YnXW5d|_tdXdS)zDebug an expression executed via the eval() function.

        globals defaults to __main__.dict; locals defaults to globals.
        NrT)	rrr$r^r`r.r)evalr)rexprrrrrrr
runevalKs
zBdb.runevalcCs||||dS)z.For backwards-compatibility.  Defers to run().N)r)rrrrrrr
runctx_sz
Bdb.runctxc	Ost|dkr|^}}}nV|s&tdnHd|krZ|d}|^}}ddl}|jdtddntdt|d	|t|j	d}z(z|||}Wntk
rYnXW5d
|_
tdX|S)zWDebug a single function call.

        Return the result of the function call.
        rCz6descriptor 'runcall' of 'Bdb' object needs an argumentfuncrNz0Passing 'func' as keyword argument is deprecated)
stacklevelz7runcall expected at least 1 positional argument, got %drT)r	TypeErrorpopwarningswarnDeprecationWarningr$r^r`r.r)r)argskwdsrrrresrrr
runcallfs2



zBdb.runcallz($self, func, /, *args, **kwds))N)r)N)N)FNN)r)NN)NN)/rr	r
rrrr$r.r*r+r,r-rJr4r5rRr9r>r6rArEr#rYr[r\r]rarbrdrkrorrrwrxrzrsr~rrrrrrrrr__text_signature__rrrr
rs\
+	










cCstdS)z<Start debugging with a Bdb instance from the caller's frame.N)rrarrrr
rasrac@sZeZdZdZdZiZdgZdddZddZd	d
Z	ddZ
dd
dZddZddZ
dS)raBreakpoint class.

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

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

    When creating a breakpoint, its associated filename should be
    in canonical form.  If funcname is defined, a breakpoint hit will be
    counted when the first line of that function is executed.  A
    conditional breakpoint always counts a hit.
    rNFcCs||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|j
|||f|jkr||j||f
|n|g|j||f<dS)NTrr)rifunc_first_executable_linerur%rQrhenabledignorehitsrnextrPryrgrl)rrur%rQrhrirrr
rszBreakpoint.__init__cCs>|j|jf}d|j|j<|j|||j|s:|j|=dS)zDelete the breakpoint from the list associated to a file:line.

        If it is the last breakpoint in that position, it also deletes
        the entry for the file:line.
        N)rur%ryrPrlrm)rindexrrr
rqs

zBreakpoint.deleteMecCs
d|_dS)zMark the breakpoint as enabled.TNrrcrrr
enableszBreakpoint.enablecCs
d|_dS)z Mark the breakpoint as disabled.FNrrcrrr
disableszBreakpoint.disablecCs"|dkrtj}t||ddS)zPrint the output of bpformat().

        The optional out argument directs where the output is sent
        and defaults to standard output.
        N)ru)r^stdoutr/bpformat)routrrr
bpprintszBreakpoint.bpprintcCs|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr|jdkrd	}nd
}|d|j|f7}|S)zReturn a string with information about the breakpoint.

        The information includes the breakpoint number, temporary
        status, file:line position, break condition, number of times to
        ignore, and number of times hit.

        zdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrrz"
	breakpoint already hit %d time%s)rQrrPrur%rhrr)rZdispretssrrr
rs(

zBreakpoint.bpformatcCsd|j|j|jfS)z1Return a condensed description of the breakpoint.zbreakpoint %s at %s:%s)rPrur%rcrrr
__str__szBreakpoint.__str__)FNN)N)rr	r
rrrlryrrqrrrrrrrrr
rs


cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)aVReturn True if break should happen here.

    Whether a break should happen depends on the way that b (the breakpoint)
    was set.  If it was set via line number, check if b.line is the same as
    the one in the frame.  If it was set via function name, check if this is
    the right function and if it is on the first executable line.
    FT)rir%rLr;rr)br1rrr

checkfuncnamesrcCstj||f}|D]}|jsqt||s*q|jd7_|jsh|jdkrZ|jd8_qq|dfSqzBt|j|j|j	}|r|jdkr|jd8_n|dfWSWq|dfYSXqdS)aEDetermine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a breakpoint at this location.  Return
    the breakpoint that was triggered and a boolean that indicates if it is
    ok to delete a temporary breakpoint.  Return (None, None) if there is no
    matching breakpoint.
    rrTF)NN)
rrlrrrrhrrrKr)rur%r1Z	possiblesrvalrrr
rO#s*


rOc@s,eZdZddZddZddZddZd	S)
TdbcCs |jj}|sd}td||dS)N???z+++ call)r;rr/)rr1rnamerrr
r>Tsz
Tdb.user_callcCsTddl}|jj}|sd}||jj}|||j|j}td||j|d|	dS)Nrrz+++:)
r r;rrrMrerLrKr/r)rr1r rfnr%rrr
r6Xsz
Tdb.user_linecCstd|dS)Nz
+++ returnr/)rr1Zretvalrrr
rA_szTdb.user_returncCstd||dS)Nz
+++ exception)r/rb)rr1Z	exc_stuffrrr
rEas
zTdb.user_exceptionN)rr	r
r>r6rArErrrr
rSsrcCs&td|dt|d}td|dS)Nzfoo()
zbar returned)r/bar)nxrrr
fooesrcCstd|d|dS)Nzbar(rrCr)arrr
rjsrcCst}|ddS)Nzimport bdb; bdb.foo(10))rr)rrrr
testnsr)rrGr^rinspectrrr__all__r=	ExceptionrrrarrrOrrrrrrrr
<module>s(
{t"0

Zerion Mini Shell 1.0