QfdZddlZddlZddlZddlZddlZddlmZgdZ d9dZ dZ d:dZ d9dZ d9d Zd Zd ZGd d ZeZdZeedddfdZeeddfdZefdZdZefdZd;dZdz@Extract, format and print information about Python stack traces.N)suppress) extract_stack extract_tbformat_exceptionformat_exception_only format_list format_stack format_tb print_exc format_excprint_exception print_last print_stackprint_tb clear_frames FrameSummary StackSummaryTracebackException walk_stackwalk_tbc|tj}tj|j D]}t ||dy)zyPrint the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.Nfileend)sysstderrr from_listformatprint)extracted_listritems 0/opt/alt/python312/lib64/python3.12/traceback.py print_listr$s= |zz&&~6==? d2&@cHtj|jS)aFormat a list of tuples or FrameSummary objects for printing. Given a list of tuples or FrameSummary objects as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; the strings may contain internal newlines as well, for those items whose source text line is not None. )rrr)r!s r#rrs  ! !. 1 8 8 ::r%c4tt|||y)aPrint up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. limitrN)r$r)tbr)rs r#rr/sz"E*6r%c8t||jS)z5A shorthand for 'format_list(extract_tb(tb, limit))'.r()rrr+r)s r#r r 9s b & - - //r%cBtjt||S)a# Return a StackSummary object representing a list of pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a FrameSummary object containing attributes filename, lineno, name, and line representing the information that is usually printed for a stack trace. The line is a string with leading and trailing whitespace stripped; if the source is not available it is None. r()r _extract_from_extended_frame_gen_walk_tb_with_full_positionsr-s r#rr=s&  8 8$R( 9 77r%zG The above exception was the direct cause of the following exception: zF During handling of the above exception, another exception occurred: ceZdZdZy) _Sentinelcy)Nz selfs r#__repr__z_Sentinel.__repr__[sr%N)__name__ __module__ __qualname__r7r4r%r#r2r2Zsr%r2c|tu|tuk7r td||cxurturIn||fS|@t|tr||jfSt dt |jdy||fS)Nz-Both or neither of value and tb must be givenzException expected for value, z foundNN) _sentinel ValueError isinstance BaseException __traceback__ TypeErrortyper8)excvaluer+s r#_parse_value_tbrF`s i0HII i "9 ?#}-C----<#Cy112&:; ; "9r%Tc|t|||\}}tt||||d}|j||y)aPrint exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if type is SyntaxError and value has the appropriate format, it prints the line where the syntax error occurred with a caret on the next line indicating the approximate position of the error. Tr)compactrchainN)rFrrCr )rDrEr+r)rrKtes r#r r os< UB/IE2 DK% NBHH$eH$r%ct|||\}}tt||||d}t|j |S)azFormat a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does print_exception(). TrHrK)rFrrClistr)rDrEr+r)rKrLs r#rrsB UB/IE2 DK% NB   & ''r%cx|tur|}tt||dd}t|j S)aFormat the exception part of a traceback. The return value is a list of strings, each ending in a newline. The list contains the exception's message, which is normally a single string; however, for :exc:`SyntaxError` exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. Following the message, the list contains the exception's ``__notes__``. NT)rI)r=rrCrOr)rDrErLs r#rrs9  DKd CB ((* ++r%cDt|d}||sd|z}|S|d|d}|S)N exceptionz%s z:  ) _safe_string)etyperEvaluestrlines r#_format_final_exc_linerXs6E;/H }H~ K#H- Kr%cH ||S#d|d|jdcYSxYw)N< z () failed>)r8)rEwhatfuncs r#rTrTs14E{44&$-- 33s !cFttj|||y)zEShorthand for 'print_exception(sys.exception(), limit, file, chain)'.r)rrKN)r rrRr_s r#r r sCMMO5t5Ir%c`djttj||S)z%Like print_exc() but return a string.rr)rK)joinrrrRras r#r r s! 77#CMMO5N OOr%c(ttdsttds tdttdrttj|||yttj tj tj|||y)zLThis is a shorthand for 'print_exception(sys.last_exc, limit, file, chain)'.last_exc last_typezno last exceptionN)hasattrrr>r rdre last_valuelast_tracebackr_s r#rrs` 3 #GC,E,--sJ eT59 s~~s7I7ItU ,r%ct|tjj}tt |||y)zPrint a stack trace from its invocation point. The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception(). Nr(r*)r _getframef_backr$r)fr)rs r#rrs+ y MMO " "}Qe,48r%cn|tjj}tt ||S)z5Shorthand for 'format_list(extract_stack(f, limit))'.r()rrjrkrr)rlr)s r#r r s*y MMO " " }Qe4 55r%c|tjj}tj t ||}|j |S)asExtract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line number, function name, text), and the entries are in order from oldest to newest stack frame. r()rrjrkrextractrreverse)rlr)stacks r#rrsA y MMO " "  Ae Information about a single frame from a traceback. - :attr:`filename` The filename for the frame. - :attr:`lineno` The line within filename for the frame that was active when the frame was captured. - :attr:`name` The name of the function or method that was executing when the frame was captured. - :attr:`line` The text from the linecache module for the of code that was running when the frame was captured. - :attr:`locals` Either None if locals were not supplied, or a dict mapping the name to the repr() of the variable. )filenamelineno end_linenocolno end_colnoname_linelocalsTN) lookup_linerrWr{r|r}c ||_||_||_||_|r |j|r4|j D cic]\} } | t | dtc} } nd|_||_ ||_ | |_ ycc} } w)aConstruct a FrameSummary. :param lookup_line: If True, `linecache` is consulted for the source code line. Otherwise, the line will be looked up when first needed. :param locals: If supplied the frame locals, which will be captured as object representations. :param line: If provided, use this instead of looking up the line in the linecache. localr]N) ryrzr~rrWitemsrTreprrr{r|r}) r6ryrzr~rrrWr{r|r}kvs r#__init__zFrameSummary.__init__ s!     II+1 (&1,q'==&(7; $ " (sA>ct|trj|j|jk(xrO|j|jk(xr4|j|jk(xr|j |j k(St|t r1|j|j|j|jf|k(StSN) r?rryrzr~rtuplerWNotImplementedr6others r#__eq__zFrameSummary.__eq__!s e\ *MMU^^30KK5<</0II+0KK5<</ 1 eU #MM4;; 499EN Nr%cd|j|j|j|jf|Sr)ryrzr~rW)r6poss r# __getitem__zFrameSummary.__getitem__+s& t{{DIItyyA#FFr%cpt|j|j|j|jgSr)iterryrzr~rWr5s r#__iter__zFrameSummary.__iter__.s&T]]DKKDIIFGGr%cfdj|j|j|jS)Nz7)ryrzr~)rryrzr~r5s r#r7zFrameSummary.__repr__1s0HOO]]4;;TYYPH Hr%cy)Nr4r5s r#__len__zFrameSummary.__len__5sr%c2|j|jSr)rWrr5s r#_original_linezFrameSummary._original_line8s zzr%c|j<|jytj|j|j|_|jj Sr)rrz linecachegetlinerystripr5s r#rWzFrameSummary.line>sH :: {{""**4==$++FDJzz!!r%)r8r9r:__doc__ __slots__rrrrr7rpropertyrrWr4r%r#rrsi ,I?Cd44#0GHH ""r%rc#K|.extended_frame_gens)& 6&$d333'sr)r/)klassrr)rrrs ` r#rozStackSummary.extractys/ 455  L)6+ +r%c \|ttdd}||dkrd}|4|dk\rtj||}nt j || }|}t }|D]\}\}} } } |j} | j} | j}|j| tj| |j|r |j}nd}|jt!| ||d|| | | |D]} tj"| |r|D]}|j$|S)Ntracebacklimitr)maxlenF)rrr{r|r})getattrrrr collectionsdequesetr co_filenameco_nameaddr lazycache f_globalsf_localsappendr checkcacherW)rrr)rrresultfnamesrlrzr{r|r}coryr~rs r#r/z-StackSummary._extract_from_extended_frame_gens+ =C!148E UQY  z%,,Y> '--iG 9B 5A5 E9B~~H::D JJx   !++ 6:: MM,&$E(%UiI J:CH   *  r%c t}|D]I}t|tr|j|%|\}}}}|jt||||K|S)z Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples. rW)rr?rr)ra_listrframeryrzr~rWs r#rzStackSummary.from_listsWE%. e$/4,&$ l8VTMN   r%c(g}|jdj|j|j|j|j rM|j j }|jdj||j}t|}t|j j}||z }|j|jt||j}t||j} ||| } d} |j|jk(r$tt5t!| } dddnt|j#} | |z t|ks | r| j$| j&z dkDrt)||dz} t)|| dz} |jd|jd| |z z| rt)| | j&}t)| | j$}|j| j*|z|j| j,||z z|j| j*| | z |z zn|jd| | z z|jd |j.rMt1|j.j3D]'\}}|jd j|| )d j5|S#1swYxYw) zFormat the lines for a single FrameSummary. Returns a string representing one frame involved in the stack. This gets called for every frame to be printed in the stack summary. z File "{}", line {}, in {}  {} Nrrz r[^rSz {name} = {value} )r~rEr)rrryrzr~rWrrlenlstripr|r} _byte_offset_to_character_offsetr{r Exception(_extract_caret_anchors_from_line_segmentrstripright_start_offsetleft_end_offset_display_width primary_charsecondary_charrsortedrrb)r6 frame_summaryrow stripped_linerW orig_line_lenframe_line_lenstripped_characters start_offset end_offset code_segmentanchorsdp_start_offset dp_end_offsetdp_left_end_offsetdp_right_start_offsetr~rEs r#format_frame_summaryz!StackSummary.format_frame_summarys  299  " "M$8$8-:L:LN O   )..446M JJz((7 8 //DIM !3!3!:!:!<=N"/."@ ##/!++7?--- / =-113 #L<  ''=+C+CC!),"J<"X-, "%T[[]!3J ,s=/AAG$>$>AXAX$X[\$\'5T<&H1&LO$24$Dq$HMJJv&JJso8K&KLM-;L'JaJa-b*0>|WMgMg0h- 7#7#7:L#LM 7#9#9=RUg=g#hi 7#7#7=?;Z]r;r#st 3-/*I#JKJJt$   %m&:&:&@&@&BC e 3::E:RS Dwws|E-,s > LLcg}d}d}d}d}|D]}|j|}||1||jk7s"| ||jk7s|||jk7rW|tkDr(|tz}|j d|d|dkDrdndd|j}|j}|j}d}|dz }|tkDr|j ||tkDr(|tz}|j d|d|dkDrdndd|S) aFormat the stack ready for printing. Returns a list of strings ready for printing. Each string in the resulting list corresponds to a single frame from the stack. Each string ends in a newline; the strings may contain internal newlines as well, for those items with source text lines. For long sequences of the same frame and line, the first few repetitions are shown, followed by a summary line stating the exact number of further repetitions. Nrz [Previous line repeated z more timersrz] )rryrzr~_RECURSIVE_CUTOFFr)r6r last_file last_line last_namecountrformatted_frames r#rzStackSummary.format sM   !M"77 FO&!Y-2H2H%H!Y-2F2F%F!Y-2D2D%D,,..EMM4UG<&+aisR8=*22 )00 )..  QJE(( MM/ *)", $ $ & &E MM,UG4#aisR05  r%) r8r9r:r classmethodror/rrrr4r%r#rrvs[I+/d ++*DHe''R$?B-r%rcb|jd}t|d|jddS)Nzutf-8replace)errors)encoderdecode)stroffsetas_utf8s r#rr=s2jj!G ww&&wy&A BBr%_Anchors)rrrr~r)defaultsctddl} |j}t|jdk7ryfd}|jd}||j dxS\}|x|j dx!\||jj}||jj}||}t|t|jz } |jj| z} | dz} | dzt|kr|| dzjs| dz } | tkrL| x} js| dvr3| dz } | dz } | tkr| x} jr.| dvr3t|| || S|jdx \||jj} ||j jdz} | tkrI| x} js| dk7r/| dz } | tkr| x} jr)| dk7r/| tkrI| x} js| dk7r/| dz } | tkr| x} jr)| dk7r/| tkr| dz } t| | Syy#t$rYywxYw)Nrrct|Sr)r)rsegments r#z:_extract_caret_anchors_from_line_segment..Xs ?Pr%r4z)#[])astparse SyntaxErrorrbodyExprBinOpleftend_col_offsetright col_offsetrisspacer SubscriptrEslice) r rtree normalize statementexproperator_start operator_end operator_stroperator_offset left_anchor right_anchorchs ` r#rrMsyy! 499~PI ! I  XX^ SYY[%.tyy/G/G%HN#,TZZ-B-B#CL#*>,#GL&),&7#l>Q>Q>S:T&TO"&))":":_"LK#.?L'!+c,.?? ,_q-@ A I I K$) %G 4AU;U2:^:^:`dfjndn#q( $) &G 4AU;U2:^:^:`dfjndn$Ik$:Il>% ?> Q sJ++ J76J7WFc^|jr|Sddltfd|d|DS)zCalculate the extra amount of width space the given source code segment might take if it were to be displayed on a fixed width output device. Supports wide unicode characters and emojis.rNc3TK|]}j|tvrdnd!yw)rrN)east_asian_width_WIDE_CHAR_SPECIFIERS).0char unicodedatas r# z!_display_width..s1!D ) )$ /3H HaO!s%()isasciir/sum)rWrr/s @r#rr~s6  ||~  &M r%c eZdZdZdZddZy)_ExceptionPrintContextc>t|_d|_d|_y)NrF)rseenexception_group_depth need_closer5s r#rz_ExceptionPrintContext.__init__sE %&"r%c&dd|jzzS)Nr[r)r7r5s r#indentz_ExceptionPrintContext.indentsa$44455r%Nc#K|d}|j}|jr||dzz }t|trt j||dy|D]}t j||dyw)N|r[cyNTr4rs r#r z-_ExceptionPrintContext.emit..Tr%cyr>r4rs r#r z-_ExceptionPrintContext.emit..r?r%)r:r7r?rtextwrap)r6text_gen margin_char indent_strtexts r#emitz_ExceptionPrintContext.emitsp  K[[]  % % ++ +J h $//(J8IJ J oodJ8IJJ!sA6A8r)r8r9r:rr:rFr4r%r#r4r4s 6 Kr%r4creZdZdZdddddddddZed Zd Zd Zd Z d Z dZ ddddZ ddddZ y)raAn exception ready for rendering. The traceback module captures enough attributes from the original exception to this intermediary form to ensure that no references are held, while still being able to fully print or format it. max_group_width and max_group_depth control the formatting of exception groups. The depth refers to the nesting level of the group, and the width refers to the size of a single exception group's exceptions array. The formatted output is truncated when either limit is exceeded. Use `from_exception` to create TracebackException instances from exception objects, or the constructor to create TracebackException instances from individual components. - :attr:`__cause__` A TracebackException of the original *__cause__*. - :attr:`__context__` A TracebackException of the original *__context__*. - :attr:`exceptions` For exception groups - a list of TracebackException instances for the nested *exceptions*. ``None`` for other exceptions. - :attr:`__suppress_context__` The *__suppress_context__* value from the original exception. - :attr:`stack` A `StackSummary` representing the traceback. - :attr:`exc_type` The class of the original traceback. - :attr:`filename` For syntax errors - the filename where the error occurred. - :attr:`lineno` For syntax errors - the linenumber where the error occurred. - :attr:`end_lineno` For syntax errors - the end linenumber where the error occurred. Can be `None` if not present. - :attr:`text` For syntax errors - the text where the error occurred. - :attr:`offset` For syntax errors - the offset into the text where the error occurred. - :attr:`end_offset` For syntax errors - the end offset into the text where the error occurred. Can be `None` if not present. - :attr:`msg` For syntax errors - the compiler error message. NTF )r)rrrImax_group_widthmax_group_depth_seenc p | du} | t} | jt|||_| |_t j t|||||_||_ t|d|_ t|dd|_ |rt!|t"r|j$|_|j&} | t)| nd|_|j*}| t)|nd|_|j,|_|j.|_|j0|_|j2|_n|rSt!|t4rCt|dd6t|dd}t7|||}|r|xjd|dz c_ n|rt!|t8t:frt|ddt|dd}t7|||}|r|xjd|dz c_ t!|t8rVt|dd}|G|t<j>vr5|r|xjd |d z c_ n|xjd |d z c_ |r|jA| |jBnd |_!| s||fg}|r |jE\}} | ri| jF]t| jF| vrFtItK| jF| jF| jFjL||||| | }nd}|r|duxr| duxr | jB }nd}| rk| jN_|r]t| jN| vrFtItK| jN| jN| jNjL||||| | }nd}| r\tQ| tRrLg}| jTD]:}tItK|||jL||||| | }|jW|<nd}||_#||_'||_*|r'|jW|jF| jFf|r'|jW|jN| jNf|r/|jYt[|jT| jT|r yyy#t$r%} dt| dtg|_ Yd} ~ %d} ~ wwxYw)NrrR __notes__z!Ignored error getting __notes__: name_fromz. Did you mean: 'z'?r~z Or did you forget to import ''z. Did you forget to import 'F)r)rrrJrKrLT).rridrJrKrr/r0rqexc_typerT_strrrNrr issubclassrryrzrr{rErrmsg ImportError_compute_suggestion_error NameErrorAttributeErrorrstdlib_module_names _load_lines__suppress_context__pop __cause__rrCrA __context__r?BaseExceptionGroup exceptionsrextendzip)r6rR exc_value exc_tracebackr)rrrIrJrKrLis_recursive_callelnoend_lno wrong_name suggestionqueuerLcause need_contextcontextrarDtexcs r#rzTracebackException.__init__so"- =EE "Y- ..!BB ( 7l)C+ ! !K8  Z$Y TBDN  8[9%..DM""C&)o#c(4DK**G.5.Ac'ltDO!DI#**DK'22DO }}DH *X{; ;5A K>J29mZXJ 0 B?? *X >/JK 640< FD9J29mZXJ 0 B?? (I.$Y= )jC(>$>!$(L!--3$AMM):%)G0Q]]+  33#%1'5(7(7# %G#GA'9:!#J ||1 I--"')5+9,;,;"' )#))$/ ,"&J$ !( * LL",, !<=LL"..!--!@ALLR]]ALL!AB!S Z3LKQU4V3WXZDNN Zs9R R5R00R5cD|t|||jg|i|S)z.Create a TracebackException from an exception.)rCrA)clsrDargskwargss r#from_exceptionz!TracebackException.from_exceptionSs'49c3#4#4FtFvFFr%c>|jD]}|jy)z7Private API. force all lines in the stack to be loaded.N)rqrW)r6rs r#r[zTracebackException._load_linesXsZZE JJ r%c`t|tr|j|jk(StSr)r?r__dict__rrs r#rzTracebackException.__eq__]s& e/ 0==ENN2 2r%c|jSr)rSr5s r#__str__zTracebackException.__str__bs yyr%c#4K|jtd|jy|jj}|jj}|dvrt |t sd}|dz|z}t|jtst||jn|j|Ed{t |jtjjrht |jt tfsH|jD]8}t|d}|j!dDcgc]}|dz c}Ed{:y|j.dj#t|jdt$ yy7cc}w7Iw) aFormat the exception part of the traceback. The return value is a generator of strings, each ending in a newline. Generator yields the exception message. For :exc:`SyntaxError` exceptions, it also yields (before the exception message) several lines that (when printed) display detailed information about where the syntax error occurred. Following the message, generator also yields all the exception's ``__notes__``. N)__main__builtinsz .noterSz{} rNr)rRrXrSr:r9r?rrTr_format_syntax_errorrNrabcSequencebytesrTsplitrr)r6stypesmodrls r#rz(TracebackException.format_exception_onlyesE == (tyy9 9  **}}'' / /dC("3J&E$--5( : :007 7 7 t~~{'?'? @t~~U|<#D&1.2jj.>?.>AH.>???'^^ '-- T^^[t TU U( 8@?s2B7F9F:BF: FF F AFFc#Kd}|j-dj|jxsd|jn'|jdj|j}|j}||j d}|j d}t |t |z }dj||j|j}|jd vr |jn|}||k(s|d k(r|d z}|d z |z } |d z |z } | d k\r8d |d| D} djdj| d| | z zdz|jxsd} dj|| |yw)z0Format SyntaxError exceptions (internal helper).rNz File "{}", line {} zz ({})rSz r>Nrrrc3DK|]}|jr|ndyw)r[N)r)r-cs r#r0z:TracebackException._format_syntax_error..s!U}! 1#<}s z {}{}rzz {}: {}{} ) rzrryrErrrrrrbrU) r6rfilename_suffixrErtextltextspacesrrr|r} caretspacerUs r#rz'TracebackException._format_syntax_errorsp ;; "*11 +T[[: : ]] &%nnT]];Oyy  KK%ELL)EZ#e*,F##E* *{{&04y0PT__V\ Z':+;!'!J V+&NV3 A:!UuVe}!UJ$++BGGJ,?#UZIZB[^bBbddhh11!!%o>>sE3E5rK_ctxc #K| t}g}|}|ri|rz|jt}|j}n/|j|jst }|j}nd}d}|j ||f|}|rfn|j d|ft|D]\}}||j|Ed{|j~|jrJ|jdEd{|j|jjEd{|j|jEd{|j|jkDr(|jd|jdEd{|jdk(}|r|xjdz c_ |jrP|jd|rdnd Ed{|j|jjEd{|j|jEd{t|j} | |j kr| } n|j dz} d |_t%| D]} | | dz k(} | rd |_|j | |j k\} nd } | s| dznd }|j'| dk(rd ndzd|dz|xjdz c_ | s)|j| j||Ed{n8| |j z }|dkDrdnd}|jd|d|dEd{| r(|j"r|j'dzd |_|xjdzc_ |sd|_ y7777j7,77777ow)aFormat the exception. If chain is not *True*, *__cause__* and *__context__* will not be formatted. The return value is a generator of strings, each ending in a newline and some containing internal newlines. `print_exception` is a wrapper around this method which just prints the lines to a file. The message indicating which exception occurred is always the last string in the output. Nz#Traceback (most recent call last): z... (max_group_depth is z) rrz3Exception Group Traceback (most recent call last): +)rCFTz...z+-z z+---------------- z ---------------- rrrzand z more exceptionrSz&+------------------------------------ )r4r^_cause_messager_r\_context_messagerreversedrFrarqrrr7rKrrJr8ranger:)r6rKroutputrD chained_msg chained_excrU is_toplevelnum_excsnird truncatedtitle remainingplurals r#rzTracebackException.formats <)+D ==,"0K"%--Koo222"2K"%//K"&K"&K {C01! MM4+ & (HC99S>))~~%99#yy)OPPP#yy)9)9);<<<99S%>%>%@AAA++d.B.BB99.t/C/C.DCHJJJ $99Q> ..!3.99#yyN-8cd ) DDD $yy)9)9);<<<99S%>%>%@AAAs~~.t333 A,,q0A"'qA !QqSH*.++7%&$*>*>%> $) ,5qse5E;;=$%qDDd4/w6IJKL..!3.$#&>>!#4#;#;%d#;#SSS$,t/C/C$C (1A 2#'99"9+_VHBG$III DOO#{{}H IJ*/..!3.7":12D.}))Q<AJD=A.TIsA:N?=>&)DtZ(zl++ 1v$$_N(("MJ J & M*^;a?:MQRR <):; 0]LY l * - =&J,M i     s# F F% F"!F"% F10F1c  ||k(ryd}||dr+||dr&||||k(r|dz }||dr||dr ||||k(r||d}||d}d}|d|xsdrC|d|xsdr:||dz ||dz k(r)|dz}|d|xsdr|d|xsdr||dz ||dz k(r)|d|xsd}|d|xsd}|r|stt|t|zzSt|tkDst|tkDr|dzSt|t|kr||}}t|t|z tz|kDr|dzStt ttt|dzzt}d}t t|D]}||}|tzx} }t j } t t|D]E} | t||| z} || } t|| tz} t| | }||| <|| ksD|} G| |kDs|dzcS|Sr) rrrrOrrmaxsizerr)abmax_costprepostrrbindexbchardistanceminimumindex substitute insert_deletes r#rrise Av C CD'ag!C&AcF"2 q CD'ag!C&AcF"2 #$A #$A D MT\T q$,$/Ad1fI464J   MT\T q$,$/Ad1fI464J -4<4A -4<4A ASVc!f_-- 1v  CF-=$=!| 1vA!1 AQ:%0!| uZs1vz!:JG HC FA-& "Z//6++3q6]E!$6uah$GGJ5zH 1J>M 3F CJ # X a< ) * Mr%rr<)NNTr>)NNN)8rcollections.abcrrrrrA contextlibr__all__r$rrr rrrr2r=rFr rrrXrrTr r rrr rrrrrr0rrrOrr namedtuplerrr,rr4rrrrrrrWrr4r%r#rsF  $' ;$707*& &  K  #, T%"$-$ ()2,&$'4JP , 96  L"L"^  OD4DNC "; ! ! 3Z -^$KK.s+s+l    ;|:r%