U aJ@sXddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl mZddl mZddlmZddlmZdd lmZd d lmZed Zed ejZedZdZdZededZedeZ dZ!dZ"dZ#d'e$e%e$dddZ&d(e%e%e'ddddZ(Gd d!d!Z)Gd"ddZ*Gd#d$d$Z+Gd%d&d&Z,dS))N)escape) TokenError)CodeType) TracebackType)_to_str)get_filesystem_encoding)cached_property)Consolescoding[:=]\s*([-\w.]+)s^(.*?)$z+^(\s*def\s)|(.*(? %(title)s // Werkzeug Debugger
a

Console Locked

The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.

PIN:

a

%(exception_type)s

%(exception)s

Traceback (most recent call last)

%(summary)s

This is the Copy/Paste friendly version of the traceback.

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. If you enable JavaScript you can also use additional features such as code execution (if the evalex feature is enabled), automatic pasting of the exceptions and much more.
z a+

Interactive Console

In this console you can execute Python expressions in the context of the application. The initial namespace was created by the debugger automatically.
The Console requires JavaScript.
zU
%(title)s %(description)s
a

File "%(filename)s", line %(lineno)s, in %(function_name)s

%(lines)s
zV %(lineno)s %(code)s T)secretevalex_trustedreturncCstd|r dnddd|ddS)Ntruefalser )evalexr consoletitler traceback_id) CONSOLE_HTML)r r rWC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-1tps7o9u\werkzeug\debug\tbtools.pyrender_console_htmls rF Traceback)ignore_system_exceptionsshow_hidden_framesskiprcCs~ttjtjtttft}|\}}}|r@|tt t hkr@t |D]}|j dkrZqb|j }qHt |||}|sz||S)a Get the current exception info as `Traceback` object. Per default calling this method will reraise system exceptions such as generator exit, system exit or others. This behavior can be disabled by passing `False` to the function as first parameter. N)tcastTupleType BaseExceptionrsysexc_info SystemExitKeyboardInterrupt GeneratorExitrangetb_nextrfilter_hidden_frames)rrrinfoexc_type exc_valuetb_rrrget_current_tracebacks&     r0c@sLeZdZdZdZeeddddZee j eddd Z edd d Z dS) LinezHelper for the source renderer.linenocodein_framecurrentN)r3r4rcCs||_||_d|_d|_dS)NFr2)selfr3r4rrr__init__sz Line.__init__rcCs*dg}|jr|d|jr&|d|S)Nlinezin-framer6)r5appendr6)r7rvrrrclassess   z Line.classescCs td|j|jt|jdS)N )r=r3r4)SOURCE_LINE_HTMLjoinr=r3rr4r7rrrrenders  z Line.render) __name__ __module__ __qualname____doc__ __slots__intstrr8propertyrListr=rBrrrrr1s r1c@seZdZdZejeeeddddZddddZ e e dd d Z e e dd d Zdejejdd ddZde e dddZde eje e e dddZee dddZe edddZdS)rzWraps a traceback.Nr,r-r.rcCs||_||_||_|j}|jdkr2|jd|}||_g|_t}|jt |||| t ||j pp|j }|dkst ||krqt|}|j}qD|jdd|jD|_dS)N> exceptionsbuiltins __builtin__.cSsg|]}|jD]}|qqSrframes.0groupframerrr sz&Traceback.__init__..)r,r-r.rCrDexception_typegroupssetr;Groupaddid __cause__ __context__type __traceback__reverserR)r7r,r-r.rXmemorrrr8s$   zTraceback.__init__r9cCs2|jD] }|qdd|jD|jdd<dS)z.Remove the frames according to the paste spec.cSsg|]}|jD]}|qqSrrQrSrrrrWsz2Traceback.filter_hidden_frames..N)rYr*rR)r7rUrrrr*s  zTraceback.filter_hidden_framescCs t|jtS)zIs it a syntax error?) isinstancer- SyntaxErrorrArrris_syntax_errorszTraceback.is_syntax_errorcCs |jdjS)z-String representation of the final exception.r)rY exceptionrArrrrgszTraceback.exception)logfilercCs,|dkrtj}|jd}||dS)z+Log the ASCII traceback into a file object.N )r#stderr plaintextrstripwrite)r7rhr.rrrlogsz Traceback.logT) include_titlercsd}dg}|js |dg}nFtdd|jD}d|koLt|jknfdd|jD}|rz|jrvd }nd }|jrd t|jd }nd t|jd}td |d|r|nddd ||dS)z1Render the traceback for the interactive console. tracebackznoframe-tracebackcss|] }|jVqdSN) is_library)rTrVrrr sz+Traceback.render_summary..rcsg|]}|jdqS)mark_lib)rBrTrUrurrrWsz,Traceback.render_summary..z Syntax Errorz+Traceback (most recent call last):z

z
z
r>z

z

ri)r=rrR description) rRr;sumlenrYrfrrg SUMMARY_HTMLr@)r7rorr=rRZlibrary_framesryrrurrender_summary s* zTraceback.render_summaryF)rr r rcCs\t|j}t|rdnd|rdndd||t|j|jddt|jtdd|j|j|d S)z2Render the Full HTML page with the traceback info.rrF)roz-{2,}-) rr rrrgrXsummaryrkZ plaintext_csrr ) rrg PAGE_HTMLrXr}rkresubr])r7rr r excrrr render_full+s    zTraceback.render_fullcCsddd|jDS)NricSsg|] }|qSr) render_textrwrrrrWCsz'Traceback.plaintext..)r@rYrArrrrkAszTraceback.plaintextcCst|Srrr]rArrrr]Esz Traceback.id)N)T)FNT)rCrDrErFrr!r"rr8r*rJboolrfrIrgOptionalTextIOrnr}rr rkrHr]rrrrrs4   c@sjeZdZdZejeeeddddZddddZ e e dd d Z de e d d dZe dddZdS)r[zA group of frames for an exception in a traceback. If the exception has a ``__cause__`` or ``__context__``, there are multiple exception groups. NrLcCsb||_||_d|_|jdk r$d|_n|jdk r4d|_g|_|dk r^|jt||||j}q:dS)NzCThe above exception was the direct cause of the following exceptionzBDuring handling of the above exception, another exception occurred) r,r-r+r^r_rRr;Framer))r7r,r-r.rrrr8Ps  zGroup.__init__r9cCsg}d}|jD]j}|j}|dkr4g}d}|dkrnqn:|dkrLd}|dkrnqn"|dkrdd}|dkrnqn |s|rnq||qt|d kr|jd jd kr|jdd=n|jd |kr||jdd<dS) NF)beforebefore_and_thisr)resetreset_and_thisr)afterafter_and_thisTrr rZcodeopr)rRhider;r{module)r7Z new_frameshiddenrVrrrrr*gs0  zGroup.filter_hidden_framescCs*t|j|j}d|}t|ddS)z'String representation of the exception.rputf-8replace)rqformat_exception_onlyr,r-r@stripr)r7bufr<rrrrgszGroup.exceptionTrvrc Csrg}|jdk r"|d|jd|jD]>}|jrDdt|jdnd}|d|d|j|dq(d |S) Nz
  • z:
    z title=""rpzruri)r+r;rRrrBr@)r7rvoutrVrrrrrBs   z Group.rendercCs\g}|jdk r"|d|jd|d|jD]}||q2||jd|S)Nriz: z"Traceback (most recent call last):)r+r;rRrrgr@)r7rrVrrrrs    zGroup.render_text)T)rCrDrErFrr!r"rr8r*rJrIrgrrBrrrrrr[Js   r[c@seZdZdZejeeeddddZd#e e ddd Z e e d d d Z e d d dZe d ddZejed ddZd$eje efe ejdddZe eje d ddZd%eejeje e eje fdddZee d ddZe ed dd Zeed d!d"ZdS)&rzA single frame in a traceback.NrLcCs|j|_|jjj|_|jj|_|jj|_ t |p:t |}|dddkrX|dd}t j|rpt j|}t|t|_|j d|jd|_|j d|jd|_|jj|_|jdd|_|jd}|dk rt|d d }||_dS) N)z.pyoz.pycrrC __loader__Z__traceback_hide__FZ__traceback_info__rr) tb_linenor3tb_framef_codeco_name function_namef_localslocals f_globalsglobalsinspect getsourcefilegetfileospathisfilerealpathrrfilenamegetrloaderr4rr+)r7r,r-r.fnr+rrrr8s$         zFrame.__init__TrcCs8t|jt|j|jt|j||r.|jr.dnddS)z%Render a single frame in a traceback.libraryrp)r]rr3rlinesr) FRAME_HTMLr]rrr3rrender_line_contextrs)r7rvrrrrBsz Frame.renderr9cstfddtDS)Nc3s"|]}jtj|VqdSrr)r startswithrrr)rTrrArrrtsz#Frame.is_library..)any sysconfig get_pathsvaluesrArrArrss  zFrame.is_libraryc Cs(d|jd|jd|jd|jS)Nz File "z", line z, in z )rr3r current_linerrArrrrs&zFrame.render_textcsd|\}}}gttddfdd }|D]}||dq,||d|D]}||dqJdS)N)r:clsrc sV|}|}t|t|}d|dd|d|rFt|ndddS)Nz
    r>zrx)
    expandtabsrlrr{r;r)r:rZ
    stripped_lineprefixr<rrrender_lines&z.Frame.render_line_context..render_linerr6rri)get_context_linesrIr@)r7rr6rrr:rrrrs	
    zFrame.render_line_contextcCsddt|jD}t|jdr|jjd}|dkrPt||jrFqP|d8}q,z$tt	dd||dD}Wnt
    k
    rd}YnX||||D]
    }d|_qzd||jd_
    Wntk
    rYnX|S)	z:Helper function that returns lines with extra information.cSsg|]\}}t|d|qS)r
    )r1)rTidxxrrrrWsz-Frame.get_annotated_lines..co_firstlinenor
    rcSsg|]}|jdqS)ri)r4)rTrrrrrWsNT)	enumeratesourcelineshasattrr4r_funcdef_rematchr{rgetblockrr5r3r6
    IndexError)r7rr3offsetr:rrrget_annotated_liness$
    $
    zFrame.get_annotated_linessingle)r4modercCs&t|trt|d|}t||j|jS)z*Evaluate code in the context of the frame.z
    )rdrIcompileevalrr)r7r4rrrrr	s
    z
    Frame.evalc	Csld}|jdk	r^z:t|jdr,|j|j}nt|jdrF|j|j}Wntk
    r\YnX|dkrz&t|jdd}|	}W5QRXWnt
    k
    rgYSXt|tr|
    Sd}|tjr|dd}nTtt|D]D\}}t|}|dk	r|dd}q*|dkrq*qt|}zt|Wntk
    rZd}YnX||d	
    S)
    z.The sourcecode of the file as list of strings.N
    get_sourceget_source_by_coderb)rrr
    r)rrrrrr4	ExceptionopenrreadOSErrorrdrI
    splitlinesrcodecsBOM_UTF8r_line_refinditer
    _coding_researchrUdecoderlookupLookupError)r7sourcefcharsetrrZcoding_matchrrrrsB
    
    
    
    
    zFrame.sourcelines)contextrcCs@|j|j|d|jd}|j|j|j|}||j|fS)Nr
    )rr3r)r7rrZpastrrrr?szFrame.get_context_linescCs.z|j|jdWStk
    r(YdSXdS)Nr
    rp)rr3rrArrrrFszFrame.current_linecCst|j|jSrr)rrrrArrrrMsz
    Frame.consolecCst|SrrrrArrrr]QszFrame.id)T)r)r) rCrDrErFrr!r"rr8rrIrBr	rsrrrKr1rUnionrAnyrrrHr rrJrrrr]rrrrrs4 0r)T)FFr)-rrrrr#rrqtypingrhtmlrtokenizertypesrr	_internalr
    filesystemrutilsr	rrrr	MULTILINErrHEADERZFOOTERrrr|rr?rIrrrHr0r1rr[rrrrrsf
    
    "	
    	tX