xh͋#ddlZddlZddlZddlZddlmZmZddlmZddl m Z ddl m Z m Z ddlmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZmZmZm Z m!Z!m"Z"dd lm#Z$dd lm%Z%dd l&m'Z'd d l(m)Z)d dl*m+Z+m,Z,d dl-m.Z.d dl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5d dl6m7Z7d dl8m9Z9m:Z:d dl;mZ>d dl?m@Z@d dlAmBZBmCZCd d lDm#Z#d dlEmFZFejGdkZHdZIdZJdeCdeCdeeeKeKeKffdZLddd d!dd"d"eIeJd#dd#d$dd%d&ee0d'eeKd(eeKd)eKd*eeMd+eNd,eNd-eKd.eKd/eNd0eeNd1eNd2eeeMe fd3eKdeeeOeOee geffd4ZPeGd5d6ZQeGd7d8ZReGd9d:ZSeGd;d<ZTGd=d>e9ZUGd?d@ZVeWdAkr0ePd#BddlZdCeddfdDZXdCeddfdEZYdGdFZZeZdSdS)HN) dataclassfield)islice)walk_tb) ModuleType TracebackType) AnyCallableDictIterableListOptionalSequenceSetTupleTypeUnion)guess_lexer_for_filename)CommentKeywordNameNumberOperatorString)Text)Token) ClassNotFound)pretty)loop_first_last loop_last)Columns)ConsoleConsoleOptionsConsoleRenderableGroup RenderResultgroup) Constrain)RegexHighlighterReprHighlighter)Panel) render_scope)Style)SyntaxSyntaxPosition)Themewin32 Pstartendreturnc#K|\}}|\}}||kr |||fVdStt||dzD]!\}}}|r||dfV|r|d|fV|ddfV"dS)zYield start and end positions per line. Args: start: Start position. end: End position. Returns: Iterable of (LINE, COLUMN1, COLUMN2). rrN)r range) r5r6line1column1line2column2firstlastline_nos ^/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/rich/traceback.py_iter_syntax_linesrC7sNE7NE7 ~~Wg%%%%%%$3E%4K4K$L$L % % E4 %w***** %q')))))q"n$$$$  % %dXFT)consolewidth code_width extra_linestheme word_wrap show_localslocals_max_lengthlocals_max_stringlocals_hide_dunderlocals_hide_sunder indent_guidessuppress max_framesrIrJrKrLrMrNrOrPrQrRrSrTrUrVc |tdn|jr dn dttdtdtt ddf   fd d t ddffd } t}||tj S#t$rtj }t_ |cYSwxYw) aInstall a rich traceback handler. Once installed, any tracebacks will be printed with syntax highlighting and rich formatting. Args: console (Optional[Console], optional): Console to write exception to. Default uses internal Console instance. width (Optional[int], optional): Width (in characters) of traceback. Defaults to 100. code_width (Optional[int], optional): Code width (in characters) of traceback. Defaults to 88. extra_lines (int, optional): Extra lines of code. Defaults to 3. theme (Optional[str], optional): Pygments theme to use in traceback. Defaults to ``None`` which will pick a theme appropriate for the platform. word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False. locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation. Defaults to 10. locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80. locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True. locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False. indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True. suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback. Returns: Callable: The previous exception handler that was replaced. NT)stderrtype_value tracebackr7ct||| t }|dS)N rJrKrLrMrNrOrPrQrRrSrTrUrV) Tracebackfrom_exceptionboolprint)rYrZr[exception_tracebackrKrLrTrRrSrPrQrVrOrUrMtraceback_consolerJrNs rB excepthookzinstall..excepthooksv (66   !##//1#$677'!!7  $  344444rDipc ijdtdtddffd }dddtdtdtddffd_|_fd _dS) Nargskwargsr7c||i|dS)zEwrap the default ip.showtraceback to store info for ip._showtracebackNrH)rgrhdefault_showtracebacktb_datas rBipy_show_tracebackzCinstall..ipy_excepthook_closure..ipy_show_tracebacks&G ! !4 26 2 2 2 2 2rDF) is_syntaxrmc }|rdn|d} dd} d}||rdnd}t|D] }|n|j}|d|d|i dS)z2Internally called traceback from ip._showtracebackNrunning_compiled_codeF tb_offsetrr) _get_exc_infogetr:tb_next) rmrgrh exc_tupletbcompiledrq_rdrerks rBipy_display_tracebackzFinstall..ipy_excepthook_closure..ipy_display_tracebacks ((**I3<*M$$1B{{#:EBBH K00I !)0AAq 9%%  :EZ Jy|Yq\2 6 6 6GGGrDc|ddi|S)NrmTrH)rgrhrys rBz9install..ipy_excepthook_closure..s(5J5J 6 !6 %+6 6 rD) showtracebackr r`_showtracebackshowsyntaxerror)rerlrjryrkrds` @@@rBipy_excepthook_closurez'install..ipy_excepthook_closures " 0 3c 3S 3T 3 3 3 3 3 3 3+0    #' ;>          42-    rD) r# is_jupyterr BaseExceptionrrr get_ipythonsysrd Exception)rIrJrKrLrMrNrOrPrQrRrSrTrUrVrreold_excepthookrdrcs ````````````` @@rBinstallrSsfV18t,,,,W  ( -?-G   5M"55M*5  55555555555555555552) 3) 4) ) ) ) ) ) V  ]]r"""~ # s$B&&$C  C ceZdZUeed<eed<eed<dZeed<dZee ee j fed<dZ ee e eefe eeffed<dS) FramefilenamelinenonamelineNlocalslast_instruction)__name__ __module__ __qualname__str__annotations__intrrrr rNoderrrHrDrBrrsMMM KKK IIID#NNN/3FHT#v{*+ ,333JNhuU38_eCHo%EFGNNNNNrDrcpeZdZUeed<eed<eed<eed<eed<eeZe eed<dS) _SyntaxErroroffsetrrrmsgdefault_factorynotesN) rrrrrrrlistrr rHrDrBrrs` KKKMMM III KKK HHHuT222E4922222rDrceZdZUeed<eed<dZeeed<dZe ed<e e Z e eed<e e Ze eed <dZe ed <e e Ze d ed <dS) Stackexc_type exc_valueN syntax_errorFis_causerframesris_groupTrace exceptions)rrrrrrrrrr`rrrr rrrrrHrDrBrrsMMMNNN+/L(<(///Hd%555FDK555uT222E49222Hd %d ; ; ;JW ;;;;;rDrc&eZdZUeeed<dS)rstacksN)rrrr rrrHrDrBrrs" KrDrceZdZdgZdS)PathHighlighterz(?P.*/)(?P.+)N)rrr highlightsrHrDrBrrs-.JJJrDrc$eZdZdZddddddZ d0dd d dd d eed d d d dd deedee dee de dee de de de de de de de de e e efde fdZedd d dd d eed d d d dd deeded eedee dee de dee de de de de de de de de e e efde d!df"d"Zed eed d dd#deeded eede de de de de d$eeed!efd%Zd&ed'ed!efd(Zed)ed!efd*Zed+e d,e d!e fd-Zed.e d!efd/Z!dS)1r^aA Console renderable that renders a traceback. Args: trace (Trace, optional): A `Trace` object produced from `extract`. Defaults to None, which uses the last exception. width (Optional[int], optional): Number of characters used to traceback. Defaults to 100. code_width (Optional[int], optional): Number of code characters used to traceback. Defaults to 88. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optional): Override pygments theme used in traceback. word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False. indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True. locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation. Defaults to 10. locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80. locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True. locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False. suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback. max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100. textpythoncythonpyrex)rz.pyz.pxdz.pyxz.pxiNrErFrGFTrHr]tracerJrKrLrMrNrOrPrQrRrSrTrUrVc |Etj\}}}|||td|||||}||_||_||_||_tj |pd|_ ||_ ||_ | |_ ||_| |_| |_| |_g|_| D]}t'|t(s9|j J|dt,j|j}n|}t,jt,j|}|j||dkrt9d|nd|_dS)Nz9Value for 'trace' required if not called in except: blockrO ansi_darkz+ must be a module with '__file__' attributer)rexc_info ValueErrorextractrrJrKrLr/ get_themerMrNrOrTrPrQrRrSrU isinstancer__file__ospathdirnamenormpathabspathappendmaxrV)selfrrJrKrLrMrNrOrPrQrRrSrTrUrVrrr[suppress_entityrs rB__init__zTraceback.__init__s$ =-0\^^ *Hi9#4 8I OLL)YK!E  $&%e&:{;; "&*!2!2"4"4') ' ' 'Oos33 '#,88%TTT988w'?@@&7##BGOOD$9$9::D M  & & & &0:Q#a,,,ArDrrr[r7c n||||| | | | | }|||||||| || | | | ||S)aCreate a traceback from exception info Args: exc_type (Type[BaseException]): Exception type. exc_value (BaseException): Exception value. traceback (TracebackType): Python Traceback object. width (Optional[int], optional): Number of characters used to traceback. Defaults to 100. code_width (Optional[int], optional): Number of code characters used to traceback. Defaults to 88. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optional): Override pygments theme used in traceback. word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False. indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True. locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation. Defaults to 10. locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80. locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True. locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False. suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback. max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100. Returns: Traceback: A Traceback instance that may be printed. )rOrPrQrRrS) rJrKrLrMrNrOrTrPrQrRrSrUrV)r)clsrrr[rJrKrLrMrNrOrPrQrRrSrTrUrVrich_tracebacks rBr_zTraceback.from_exceptionSszZ   #//11%   s !##'//11!    rD)rOrPrQrRrS_visited_exceptionsrc g} d} ddlm} t|ddpg} | tn| }dtdt fd} t ||j||| | }tj d krt|ttfrwd |_ |jD]h}||vr|||jt"t'|||j|| it|t*r;t-|jpd|jpd |jpd|jpd|j| |_| ||jj}dt<t>t t@fdt<t>t t@fffd }tC|D]p\}}|j"j#}d}tj d krY|j$dz}tKtM|j"'||dz}|\}}}}|| | |||f||ff}|rT|(ds?tRj*+|s tRj*,| |}|j-.ddrt_|pd ||j"j0|r/fd||j-1Dnd|}|||j-.ddr |jdd=r|sYt|dd}|||ur|j2}|}|j}d } <|j3}|%t|dds|j2}|}|j}d} j ti| } | S)aExtract traceback information. Args: exc_type (Type[BaseException]): Exception type. exc_value (BaseException): Exception value. traceback (TracebackType): Python Traceback object. show_locals (bool, optional): Enable display of local variables. Defaults to False. locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation. Defaults to 10. locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80. locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True. locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False. Returns: Trace: A Trace instance which you can use to construct a `Traceback`. Fr) _IMPORT_CWD __notes__N_objectr7cD t|S#t$rYdSwxYw)z1Don't allow exceptions from __str__ to propagate.z)rr)rs rBsafe_strz#Traceback.extract..safe_strs7 27||# 2 2 2111 2s  T)rrrr)rG )rOrPrRrSr?r)rrrrrr iter_localsc3Ks s |Ed{VdS|D];\}}r|drr|dr5||fV.get_localss+.@********F"-%%JC)!cnnT.B.B! )!cnnS.A.A! u*$$$$ %%rDror<_rich_traceback_omitci|]E\}}tj|tj|-|tj|FS)) max_length max_string)inspect isfunctionisclassrtraverse).0rrZrPrQs rB z%Traceback.extract...ss !+U$+$6u$=$=BIQVAWAW %+<+<"""rD)rrrrr_rich_traceback_guard __cause____suppress_context__)r)5richrgetattrsetr rrrr version_inforBaseExceptionGroupExceptionGrouprraddrr^rtype __traceback__ SyntaxErrorrrrrrrrrr robjectrf_code co_filenamef_lastinextr co_positionsrrrisabsjoinf_localsrsrco_nameitems __class__ __context__r)!rrrr[rOrPrQrRrSrrrrrgrouped_exceptionsrstack exceptionrr frame_summaryrArrinstruction_indexinstruction_position start_lineend_line start_column end_columnframecausers! ```` rBrzTraceback.extracts>!$$$$$$"9k4@@FB)0CEEE6I  2c 2c 2 2 2 2H !("344"(9--! E7**i*.render_stackzs| +6;&&u--S*!3" 777 $--=tz#J#J &&77++****+++++++++++++++!-&&77  # 55e6HII"2)H#'$*"&*                      m***,@AK 2 677 Qm***,@AK00 m%8:N$OPPPPP  V Vm$A;;tCTCTUUUUUU~ 1:5;KQ1O1O  -Ho68&3<_=S3T3TYY/ K*11,,{J2W2WXXXXHHH#!#56">H">">)A   >*e*d   s%A..A25A2AC))C-0C-)rMget_background_styleget_style_for_tokenr1 TextTokenrrrFunctionrrr.rConstant Delimiterrr+r(rr`r'r!reversedrr) rrIr rM token_styler@rr'r(r)r*s `` @@@@rB__rich_console__zTraceback.__rich_console__[s  5577/  ++i00 U!3!3 ";;v#6#6 $[[%?%?   ";;v#6#6   {{733eoooE  KK// kk)44u$7G7G7GG {{622 !++g.>"?"? ";;w/?#@#@ [[)9::  F,< = =  H 5 5 [[..  $[[%?%?%D///%Q! $'   ,&'' A A TA lA A A A A A A A A A  A F%Xdj.?%@%@AA , ,KD%,ud++ + + + + , ,rDrc#<Kt}t}|jdkrgtj|jrCt jd|jdfdt|j dfd}||V||j }d|_ t|jd z t|}|d |||t jd d|zzd zdz }|VdS) Nz r:rrrrTrzbold underline u[traceback.offset]▲[/])r+rrrrexistsrrrrrrstripno_wrapminrlenstylizer )rrr(path_highlighterrsyntax_error_textrs rBrzTraceback._render_syntax_errorsJ%'' *,,  I - -w~~l344 -}0.002CD*,--/@A)  '&t,,,,,'K (9(@(@(B(BCC$(!\(1,c2C.D.DEE!!"2FFCCCT- 3< "< <!     rDrcodecztj|d}|sT|d}|dkr |d|n|}|drd|vrdS |j|pt||j S#t$rYdSwxYw)Nr9r9z#!rr) rrsplitextindexrlowerLEXERSrsrrr)rrrBextnew_line_index first_lines rB _guess_lexerzTraceback._guess_lexersgx((, "ZZ--N2@B2F2Fo~o..DJ$$T** x:;K;K;M;M/M/Mx :>>#&&W*B8T*R*R*W W   66 s=.B,, B:9B:rc #XKt}j}dtdttffd }d}jdkr5t jdzt|jjdzz }d}t|jD]\}}|r||vrd}|r+|Jtdt|d d d Vd}|dk} |j tfd j D} tj|j rStj|t|j ddt%|jdfd|jdfd} n4tjd|jdfdt%|jdfd} |j ds| sdV| V|j dr||Ed{Ve| s t-j|j } d| } | s|j | }t5| ||d|jjz |jjzf|jhjjjd }dV|j|j\}}tA||D]\}}} |dkr<| |dz }t|t|!z }|dkrt| |dz }n#tD$rYtwxYw|#d||f||f|j$rtK|g||dn|V#tL$r&}tjd|d fVYd}~d}~wwxYwdS)Nr r7c3rK|jr,t|jdjjjVdSdS)Nr)rrTrr)rr-rTrPrQ)r rs rB render_localsz.Traceback._render_stack..render_localss`| "L""&"4#5#5   rDrroFTz ... z frames hidden ...centerztraceback.error)justifyrc3BK|]}|VdSNr)rrframe_filenames rB z*Traceback._render_stack..s1WW^66t<<WWWWWWrDrr8r6rz in rrzin rr)rM line_numbers line_rangehighlight_linesrNrKrTdedentrr9ztraceback.error_range)rr5r6)rr9)'rrMrr r%rVr:r>rrrranyrUrrr:rrrrr linecachegetlinesrrKr/rLrNrKrTrrClstrip IndexError stylize_rangerr"r)rrr@rMrNexclude_framesexcluded frame_indexr r? suppressedr code_linesrB lexer_namesyntaxr5r6r;r<r>rerrorrSs` @rBrzTraceback._render_stacks*,,   84E+F      +/ ?a  "1$EL!!DOq$88N "+EL"9"9g g  K +"?"? !%111DS00DDD$+ !1$E"^NWWWWWWWWWJw~~en-- }$$T%.@Q%R%R%RSS*&&(9:Z!45) }Z!45*&&(9:) >,,S11 % JJJ~((-- (=/////////> =!*!3EN!C!CJ77:..D!!!%!2!25>4!H!HJ#"#%)!L4+;;!L4+;;$*/"&.#'?&*&8$FHHH -9%*%; s8J%QT7U7U3E7G )#*a<<+5eai+@D.1$ii#dkkmm:L:L.LG#*b==.1*UQY2G.H.HG#-)))!)) #00&=',g&6%*G$41!<$ &!.u!5!5%& $    7!-%e'893> Sg g s2:0M5,A)M5=A L L+*L+5 N%?N  N%rR)"rrr__doc__rGLOCALS_MAX_LENGTHLOCALS_MAX_STRINGrrrrr`r rrr classmethodrr rrr_rrr#r$r'r3r(rrrKrrrHrDrBr^r^s.  F"&3F #$&#!!2!2#'#("57!3F3F3F3F} 3F SM 3F  3F}3F3F3F3F3F!3F!3F3F5j123F !3F3F3F3Fj #$&#!!2!2#'#("57%F F F s)F !F M* F } F SMF F }F F F F F !F !F !F "5j12#F $%F & 'F F F [F P"!2!2#'#(<@|||}%|!|M* |  |||!|!|&c-&89| |||[||d,d,)7d, d,d,d,d,L UWW  ,    W , C s s   [  UWW}5}\}}} W}}}rDr^__main__rac.d}t||z dS)Nr)ra)rlones rBbarroms cAgrDc6d}hddd}t|dS)NT> Duncan Idaho Thufir Hawat Paul AtreidesVladimir Harkonnen)NFT) characters atomic_types)ro)rlrzeds rBfoorxss9 $ 0   ArDc$tddS)Nr)rxrHrDrBrfrfs ArD)r7N)[rrZrr dataclassesrr itertoolsrr[rtypesrrtypingr r r r r rrrrrrpygments.lexersrpygments.tokenrrrrrrrr-r pygments.utilrrr_loopr r!columnsr"rIr#r$r%r&r'r( constrainr)r(r*r+panelr,scoper-rr.rer/r0rrMr1platformWINDOWSrhrirrCrr`rrrrrrrr^rrorxrfrHrDrBrs ((((((((++++++++                          544444KKKKKKKKKKKKKKKK,,,,,, ''''''--------! ::::::::******** ,' !% % .% eCcM"#%%%%<"& "..#)-13@@@ g @ C=@ @  @ C= @@@@@@!@@uS*_-.@@ tM"M8M3JKSPQ!@@@@F OOOOOOO O 3333333 3 <<<<<<< <  /////&///g g g g g g g g T z GJJJ   s t     EGGGGG5rD