
    'g4                       d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z
d dlmZ ddlmZ ddlmZ dZd	Zed
z   ez   dz   Zedz   ez   ZdZdZ	 dd dd	 	 	 	 	 	 	 	 	 ddZ G d d      Z G d dej2                        ZddZy)    )annotationsN)escape   )cached_property   )Consoleaa  <!doctype html>
<html lang=en>
  <head>
    <title>%(title)s // Werkzeug Debugger</title>
    <link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css">
    <link rel="shortcut icon"
        href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
    <script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
    <script>
      var CONSOLE_MODE = %(console)s,
          EVALEX = %(evalex)s,
          EVALEX_TRUSTED = %(evalex_trusted)s,
          SECRET = "%(secret)s";
    </script>
  </head>
  <body style="background-color: #fff">
    <div class="debugger">
a        <div class="footer">
        Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
        friendly Werkzeug powered traceback interpreter.
      </div>
    </div>

    <div class="pin-prompt">
      <div class="inner">
        <h3>Console Locked</h3>
        <p>
          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.
        <form>
          <p>PIN:
            <input type=text name=pin size=14>
            <input type=submit name=btn value="Confirm Pin">
        </form>
      </div>
    </div>
  </body>
</html>
a  <h1>%(exception_type)s</h1>
<div class="detail">
  <p class="errormsg">%(exception)s</p>
</div>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
%(summary)s
<div class="plain">
    <p>
      This is the Copy/Paste friendly version of the traceback.
    </p>
    <textarea cols="50" rows="10" name="code" readonly>%(plaintext)s</textarea>
</div>
<div class="explanation">
  The debugger caught an exception in your WSGI application.  You can now
  look at the traceback which led to the error.  <span class="nojavascript">
  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.</span>
</div>
z
<!--

%(plaintext_cs)s

-->
a+  <h1>Interactive Console</h1>
<div class="explanation">
In this console you can execute Python expressions in the context of the
application.  The initial namespace was created by the debugger automatically.
</div>
<div class="console"><div class="inner">The Console requires JavaScript.</div></div>
zU<div class="%(classes)s">
  %(title)s
  <ul>%(frames)s</ul>
  %(description)s
</div>
a  <div class="frame" id="frame-%(id)d">
  <h4>File <cite class="filename">"%(filename)s"</cite>,
      line <em class="line">%(lineno)s</em>,
      in <code class="function">%(function_name)s</code></h4>
  <div class="source %(library)s">%(lines)s</div>
</div>
Tskiphidec                  |!t         j                  j                  | d      }t        j                  | j                        }t        t        dd       }||dk  rd}t        j                  ||      }|r&t        j                  ||d       }|j                  d |= g }d}t        ||j                        D ]  \  \  }}	}
|rG|j                  j                  dd      }|dv r
g }d}|dk(  r5|dv rd}|d	k(  rA|d
v rd}|dk(  rM|s|rR|
j                  |
j                  |
j                  |j                  |j                   d}t        j"                  dk\  r|
j$                  |d<   |
j&                  |d<   |j)                  t+        di |        |rK|d   j,                  j                  d      }||d   j.                  j                  d      }|dk(  r|d= nn|rK||j                  d d  |j0                  rAt3        j4                  t6        | j0                        }t9        ||j0                  |      |_        |j:                  rAt3        j4                  t6        | j:                        }t9        ||j:                  |      |_        |S )NF)lookup_linestracebacklimitr   __traceback_hide__>   beforebefore_and_thisr   >   resetreset_and_thisr   >   afterafter_and_thisTr   )filenamelinenonamelocalsglobals)      colno	end_colno__name__codeop)r    )	tracebackTracebackExceptionfrom_exceptionwalk_tb__traceback__getattrsys	itertoolsislicestackzipf_localsgetr   r   r   	f_globalsversion_infor   r   appendDebugFrameSummary	global_nslocal_ns__context__tcastBaseException_process_traceback	__cause__)excter
   r   	frame_genlimit	new_stackhiddenf_fs
hide_value
frame_argsmodulecontext_exc	cause_excs                   N/var/www/html/knws/venv/lib/python3.12/site-packages/werkzeug/debug/tbtools.pyr9   r9   ~   sn    
z))8858Q !!#"3"34IC)40E19E$$Y6	$$Yd;	HHUdUO)+IF
 )RXX. #:
A(<eDJ::	!22::!11::!11v iiGGjj{{(

 w&"$((Jw&(llJ{#*8Z89G#:N 1''++J7>q\**..z:FX!  BHHQK	~~ff]COO<+KdS	||FF=#--8	))R\\MI    c                      e Zd ZdZ	 dddd	 	 	 	 	 	 	 	 	 ddZddZe	 	 dd       Zedd	       Zdd
Z	dddZ
	 	 	 	 	 	 	 	 ddZy)DebugTraceback)_te_cache_all_tracebacks_cache_all_framesNr   Tr	   c               ,    t        ||||      | _        y )Nr	   )r9   rM   )selfr;   r<   r
   r   s        rI   __init__zDebugTraceback.__init__   s     &c2DtDrJ   c                N    dt        |       j                   d| j                   dS )N< >)typer   rM   rQ   s    rI   __str__zDebugTraceback.__str__   s&    4:&&'q
!44rJ   c                    g }| j                   }|^|j                  d}|j                  }n+|j                  |j                  sd}|j                  }nd }d }|j	                  ||f       |}|^|S )NzCThe above exception was the direct cause of the following exceptionzBDuring handling of the above exception, another exception occurred)rM   r:   r5   __suppress_context__r1   )rQ   outcurrentchained_msgchained_excs        rI   all_tracebackszDebugTraceback.all_tracebacks   s     ((!  ,+  &//$$09U9U*  &11""JJW-.!G% !( 
rJ   c                t    | j                   D cg c]  \  }}|j                  D ]  }|  c}}}S c c}}}w N)r`   r+   )rQ   rB   r<   rA   s       rI   
all_frameszDebugTraceback.all_frames	  sL     ,,
 
2XX
  

 	
 
s   3c                T    dj                  | j                  j                               S )N )joinrM   formatrX   s    rI   render_traceback_textz$DebugTraceback.render_traceback_text  s    wwtxx())rJ   c           
        | j                   D cg c]  }|j                   }}dt        |      cxk  xr t        |      k  nc }g }|sd}nd}t	        | j
                        D ]  \  }}g }	||	j                  d| d       |j                  D ]i  }
t        j                  t        |
      }
|
j                  rdt        |
j                         dnd}|	j                  d	| d
|
j                  |              k |j                  dj                  |	              t        j                   dk  r!| j"                  j$                  j&                  }n| j"                  j(                  }|dk(  }|r|rd}nd}nd}t        dj                  | j"                  j+                                     }|rd| d}nd| d}t,        |d| ddj                  |      |dz  S c c}w )Nr   ztraceback noframe-tracebackr"   z<li><div class="exc-divider">z:</div>z title=""re   z<lirV   
r      SyntaxErrorzSyntax Errorz+Traceback <em>(most recent call last)</em>:z<pre class=syntaxerror></pre>z<blockquote>z</blockquote>z<h3>z</h3>)classestitleframesdescription)rc   
is_librarysumlenreversedr`   r1   r+   r6   r7   r2   infor   render_htmlrf   r(   r0   rM   exc_typer   exc_type_strformat_exception_onlySUMMARY_HTML)rQ   include_titlerA   library_framesmark_libraryrowsrp   msgr]   	row_partsframerx   r{   is_syntax_errorrq   exc_fullrs   s                    rI   render_traceback_htmlz$DebugTraceback.render_traceback_html  s   04@1!,,@@3~.D^1DD3G!G ()<)< = 2W	?$$'DSE%QR$]] UEFF#4e<E?DzzXfUZZ&8%9;rD$$s4&%2C2CL2Q1R%STU
 DIIi012 g%88,,55L8800L&-7&EE"''$(("@"@"BCD3H:VDK(
-@KE7%(iio&	
 
 	
Y As   Gc                   t        | j                  j                               }dj                  | j                  j	                               }t
        j                  dk  r!| j                  j                  j                  }n| j                  j                  }t        |rdnd|rdnddt        |d         t        dj                  |            t        |      | j                  d      t        |      t        j                  dd	|      |d

z  S )Nre   rl   truefalser   F)r~   z-{2,}-)
evalexevalex_trustedconsolerq   	exceptionexception_typesummary	plaintextplaintext_cssecret)listrM   r|   rf   rg   r(   r0   rz   r   r{   	PAGE_HTMLr   r   resub)rQ   r   r   r   	exc_linesr   r{   s          rI   render_debugger_htmlz#DebugTraceback.render_debugger_htmlH  s     779:	GGDHHOO-.	g%88,,55L8800L &fG(6fGIaL)	 23$\2111F	*FF7C;
 
 	
rJ   rb   )
r;   r8   r<   #traceback.TracebackException | Noner
   intr   boolreturnNone)r   str)r   z5list[tuple[str | None, traceback.TracebackException]])r   zlist[DebugFrameSummary])T)r~   r   r   r   )r   r   r   r   r   r   r   r   )r   
__module____qualname__	__slots__rR   rY   r   r`   rc   rh   r   r   r!   rJ   rI   rL   rL      s    EI
 37E
 EE 0E
 E E 
E5 	> 8 
 
*2
h

$'
9=
	
rJ   rL   c                  ~     e Zd ZdZdZ	 	 	 	 	 	 	 	 d	 fdZed
d       Zedd       Zedd       Z	ddZ
ddZ xZS )r2   z[A :class:`traceback.FrameSummary` that can evaluate code in the
    frame's namespace.
    )r4   r3   _cache_info_cache_is_library_cache_consolec               D    t        |   ddd i| || _        || _        y )Nr   r!   )superrR   r4   r3   )rQ   r   r   kwargs	__class__s       rI   rR   zDebugFrameSummary.__init__n  s(     	/// rJ   c                8    | j                   j                  d      S )N__traceback_info__)r4   r.   rX   s    rI   rx   zDebugFrameSummary.infoy  s    }}  !566rJ   c                l     t         fdt        j                         j                         D              S )Nc              3     K   | ]>  }j                   j                  |t        j                  j	                  |      f       @ y wrb   )r   
startswithospathrealpath).0r   rQ   s     rI   	<genexpr>z/DebugFrameSummary.is_library.<locals>.<genexpr>  s<      
 MM$$dBGG,<,<T,B%CD
s   AA)any	sysconfig	get_pathsvaluesrX   s   `rI   rt   zDebugFrameSummary.is_library}  s/     
!++-446
 
 	
rJ   c                B    t        | j                  | j                        S rb   )r   r3   r4   rX   s    rI   r   zDebugFrameSummary.console  s    t~~t}}55rJ   c                8    | j                   j                  |      S rb   )r   eval)rQ   codes     rI   r   zDebugFrameSummary.eval  s    ||  &&rJ   c                   	 d}t        j                   j                        } j                  dz
  }t	        d||z
        }t        t        |      ||z   dz         }g 	d	 fd}|r5||| D ]  } ||d         |||   d       ||dz   | D ]  } ||d        t        t               t         j                         j                  t         j                        dj                  	      |r j                  rd	dz  S d
dz  S )N   r   r   c           
     p   | j                         j                         } | j                         }t        |       t        |      z
  }t	        dd      }t	        dd      }|dk(  r|r|rdd|z   dd||z
  z   d||z
  z   }nd	}j                  d
| dd|z   d|rt        |      nd |r|nd	 d       y )Nr   r   r   r]   z
<span class="ws">rU   z</span>^re   z<pre class="line z"><span class="ws">ro   )
expandtabsrstripstriprv   r'   r1   r   )	lineclsstripped_lineprefixr   r   arrowrendered_linesrQ   s	          rI   render_linez2DebugFrameSummary.render_html.<locals>.render_line  s    ??$++-D JJLMY]!33FD'1-Ek15IiEi)#,wefn-.si%6G/H.IK 
 !!#C5(;C&L>,96-(sC!5r*&2rJ   r   r]   r   rk   libraryre   )idr   r   function_namelinesr   )r   r   r   r   r   r   )	linecachegetlinesr   r   maxminrv   
FRAME_HTMLr   r   r   rf   rt   )
rQ   r   contextr   line_idx	start_idxstop_idxr   r   r   s
   `        @rI   ry   zDebugFrameSummary.render_html  s   ""4==1;;?8g-.	s5z8g#5#9:	* i1 ,D(+, h3hlX6 +D'*+ T(t}}-kk#DII.YY~.$0T__y
 
 	
 KM
 
 	
rJ   )r   dict[str, t.Any]r   r   r   t.Anyr   r   )r   z
str | None)r   r   )r   r   )r   r   r   r   )r   r   r   r   )r   r   r   __doc__r   rR   r   rx   rt   r   r   ry   __classcell__)r   s   @rI   r2   r2   a  s    I	! !	! "		!
 	! 
	! 7 7 
 
 6 6'-
rJ   r2   c                (    t         d|rdnddd| dz  S )Nr   r   r   )r   r   r   rq   r   )CONSOLE_HTML)r   r   s     rI   render_console_htmlr     s'    $2&  rJ   rb   )
r;   r8   r<   r   r
   r   r   r   r   ztraceback.TracebackException)r   r   r   r   r   r   )
__future__r   r)   r   r   r   r(   r   r"   typingr6   
markupsafer   utilsr   r   r   HEADERFOOTERr   r   r}   r   r9   rL   FrameSummaryr2   r   r!   rJ   rI   <module>r      s    "   	 	 
     # 
(
4 , -./ 
D  	 
 /3[ [	[+[ 	[
 [ "[|B
 B
JW
	.. W
trJ   