QflEl gdZddlmZddlmZddlmZeddZ dZ Gdd Z d#d Z d Z Gd d ZddlZej dj"fdZd$dZdZ d%dZdZ d%dZdZ d&dZdefdZddefdZdZdZdZdZGdde Z![d Z"d!Z#e$d"k(re#yy)') get_close_matchesndiffrestoreSequenceMatcherDifferIS_CHARACTER_JUNK IS_LINE_JUNK context_diff unified_diff diff_bytesHtmlDiffMatch)nlargest) namedtuple) GenericAliasr za b sizec|rd|z|z Sy)Ng@?)matcheslengths ./opt/alt/python312/lib64/python3.12/difflib.py_calculate_ratior's W}v%% cleZdZ ddZdZdZdZdZddZdZ d Z dd Z d Z d Z d ZeeZy)rNcb ||_dx|_|_||_|j ||yN)isjunkabautojunkset_seqs)selfrrrr s r__init__zSequenceMatcher.__init__xs4 t    arcJ |j||j|yr)set_seq1set_seq2)r"rrs rr!zSequenceMatcher.set_seqss!  a arcN ||jury||_dx|_|_yr)rmatching_blocksopcodes)r"rs rr%zSequenceMatcher.set_seq1s- ( ; .22t|rc| ||jury||_dx|_|_d|_|j yr)rr(r) fullbcount_SequenceMatcher__chain_b)r"rs rr&zSequenceMatcher.set_seq2s> ( ; .22t| rc<|j}ix|_}t|D](\}}|j|g}|j |*t x|_}|j}|r9|jD]}||s |j||D]}||=t x|_ }t|} |jrQ| dk\rK| dzdz} |jD]%\}} t| | kDs|j|'|D]}||=yyy)Nd)rb2j enumerate setdefaultappendsetbjunkrkeysaddbpopularlenr items) r"rr1ieltindicesjunkrpopularnntestidxss r __chain_bzSequenceMatcher.__chain_b s FF3lFAsnnS"-G NN1 #  E! T xxz#;HHSM"H#&%'  F ==Q#XHqLE YY[ Tt9u$KK$)H &=rc |j|j|j|jjf\}}}}| t |}| t |}||d} } } i} g} t ||D]e}| j}i}|j||| D];}||kr ||k\rn.||dz ddzx}||<|| kDs*||z dz||z dz|} } } =|} g| |kDr]| |kDrX||| dz sJ|| dz || dz k(r9| dz | dz | dz} } } | |kDr%| |kDr ||| dz s|| dz || dz k(r9| | z|kr\| | z|krT||| | zsF|| | z|| | zk(r5| dz } | | z|kr(| | z|kr ||| | zs|| | z|| | zk(r5| |kDr]| |kDrX||| dz rJ|| dz || dz k(r9| dz | dz | dz} } } | |kDr%| |kDr ||| dz r|| dz || dz k(r9| | z|kr\| | z|krT||| | zrF|| | z|| | zk(r5| dz} | | z|kr(| | z|kr ||| | zr|| | z|| | zk(r5t| | | SNrr0) rrr1r6 __contains__r:rangegetr )r"aloahiblobhirrr1isbjunkbestibestjbestsizej2lennothingr<j2lengetnewj2lenjks rfind_longest_matchz"SequenceMatcher.find_longest_match1s?+ r"VVTVVTXXtzz7N7NN1c7 ;a&C ;a&C!$c1husCAyyHHWWQqT7+s78"*1Q3"2Q"66HQKx<-.qSUAaCE1(5E,E!(ckeck!E!G*%ajAeAgJ&%*1WeAgxz(5Eckeck!E!G*%ajAeAgJ&Hns"uX~';!E(N+,h1U8^#44 MHHns"uX~';!E(N+,h1U8^#44ckeckaaj!ajAeAgJ&%*1WeAgxz(5Eckeckaaj!ajAeAgJ&Hns"uX~';ah'(h1U8^#44!|HHns"uX~';ah'(h1U8^#44UE8,,rc" |j |jSt|jt|j}}d|d|fg}g}|r|j \}}}}|j ||||x\} } } } | r[|j | || kr|| kr|j || || f| | z|kr#| | z|kr|j | | z|| | z|f|r|jdx} x}}g}|D]8\}}}| |z|k(r||z|k(r||z }|r|j | ||f|||}}} :|r|j | ||f|j ||dftttj||_|jSNr) r(r:rrpoprXr4sortlistmapr _make)r"lalbqueuer(rJrKrLrMr<rVrWxi1j1k1 non_adjacenti2j2k2s rget_matching_blocksz#SequenceMatcher.get_matching_blockss $    +'' 'TVVc$&&kBRB !& Cc311#sCE EGAq!a&&q)7sQwLL#q#q!12Q391sLL!A#sAaC!56  R" )JBBBw"}bBb  ''R 5RB*    R -b"a[*#C \$BC###rc6 |j |jSdx}}gx|_}|jD]_\}}}d}||kr||krd}n||krd}n||krd}|r|j|||||f||z||z}}|sJ|jd||||fa|S)Nrreplacedeleteinsertequal)r)rkr4)r"r<rVansweraibjsizetags r get_opcodeszSequenceMatcher.get_opcodess 8 << #<<  A "" v 446LBD C2v!b&RR QAr24d7BtGqA QA68'7( rc #xK |j}|sdg}|dddk(r/|d\}}}}}|t|||z |t|||z |f|d<|dddk(r/|d\}}}}}||t|||z|t|||zf|d<||z}g} |D]\}}}}}|dk(r\||z |kDrT| j||t|||z|t|||zf| g} t|||z t|||z }}| j|||||f| rt | dk(r | dddk(s| yyyw)N)rqrr0rr0rrqr0)rwmaxminr4r:) r"rAcodesrvrdrhrerinngroups rget_grouped_opcodesz#SequenceMatcher.get_grouped_opcodes#s 0  "*+E 8A;' !"'( CRRCBqDM2s2r!t}b@E!H 9Q<7 ""') CRRRRACBqDMAE"I U#( CRRg~"R%"* c2s2r!t}b#b"Q$-HI RAB1 B LL#r2r2. /$) #e*a-E!HQK7,BK-C5sD8D:c td|jD}t|t|jt|j zS)Nc3&K|] }|d yw)ryNr).0triples r z(SequenceMatcher.ratio..ksJ/IVfRj/Is)sumrkrr:rr)r"rs rratiozSequenceMatcher.ratioUsD *Jt/G/G/IJJTVVs466{)BCCrc |j2ix|_}|jD]}|j|ddz||<|j}i}|jd}}|jD]5}||r||}n|j|d}|dz ||<|dkDs1|dz}7t |t |jt |jzSrF)r+rrIrGrrr:)r"r+r=availavailhasrnumbs r quick_ratiozSequenceMatcher.quick_rations  ?? "+- -DOjvv",..a"81"< 3__ !..'66C}Sz!~~c1-E#Jax!A+ TVVs466{)BCCrc t|jt|j}}tt ||||zSr)r:rrrr{)r"r`ras rreal_quick_ratioz SequenceMatcher.real_quick_ratios; TVVc$&&kB B R"W55r)NrmrmT)rNrN))__name__ __module__ __qualname__r#r!r%r&r,rXrkrwrrrr classmethodr__class_getitem__rrrrr,s]HT>@ 34X%Nr-hE$N5n0dD2D: 6$L1rrc |dkDstd|d|cxkrdksntd|g}t}|j||D]p}|j||j |k\s(|j |k\s<|j |k\sP|j|j |frt||}|Dcgc]\}}| c}}Scc}}w)Nrzn must be > 0: grzcutoff must be in [0.0, 1.0]: ) ValueErrorrr&r%rrrr4 _nlargest)word possibilitiesrAcutoffresultsrcscores rrrs8 6344 & C vGHH FAJJt  1   6 ) ==?f $ 779  MM1779a. ) q& !F$ %f(%Af %% %s C#cH djdt||DS)Nrmc3TK|] \}}|dk(r|jr|n|"yw) N)isspace)rctag_cs rrz$_keep_original_ws..s/%HAuc\aiiku4%s&()joinzip)rtag_ss r_keep_original_wsrs)K 77Au  rc:eZdZ d dZdZdZdZdZdZdZ y) rNc" ||_||_yrlinejunkcharjunk)r"rrs rr#zDiffer.__init__*s &!   rc #zK t|j||}|jD]\}}}}}|dk(r|j||||||} n\|dk(r|j d|||} nB|dk(r|j d|||} n(|dk(r|j d|||} nt d|| Ed{y7w) Nrnro-rp+rqr unknown tag )rrrw_fancy_replace_dumpr) r"rrcruncherrvrJrKrLrMgs rcomparezDiffer.compareAs 2#4==!Q7'/';';'= #Cc3i''3QSAJJsAsC0JJsAsC0JJsAsC0 S!:;;LL(> sB/B;1B92B;c#HK t||D]}|d||yw)Nr)rH)r"rvrclohir<s rrz Differ._dumpjs(Br2A !A$' 's "c#K||z ||z kr)|jd|||}|jd|||}n(|jd|||}|jd|||}||fD] } | Ed{y7w)Nrr)r) r"rrJrKrrLrMfirstsecondrs r_plain_replacezDiffer._plain_replaceos 9sSy ZZQS1EZZQS1FZZQS1EZZQS1FALL sA)A5+A3,A5c#K d\}}t|j} d\} } t||D]} || } | j| t||D]t}||}|| k(r| || } } | j || j |kDs9| j |kDsM| j|kDsa| j|| }}}v||kr(| |j||||||Ed{y| | d}}}nd} |j||||Ed{||||}}| dx}}| j||| jD]g\}}}}}||z ||z }}|dk(r|d|zz }|d|zz })|dk(r |d|zz }7|d k(r |d |zz }E|d k(r|d |zz }|d |zz }[td ||j||||Ed{nd|z|j||dz|||dz|Ed{y77767 w)N)gGz?g?NNrrmrn^rorrprrqrr r0)rrrHr&r%rrrr _fancy_helperr!rwr_qformat)r"rrJrKrrLrM best_ratiorreqieqjrVrtr<rsbest_ibest_jaeltbeltatagsbtagsrvai1ai2bj1bj2r`ras rrzDiffer._fancy_replace}s (( F"4==1S sCA1B   b !3_qT8{#$aS!!"%,,.;**,z9nn&3191A1aJ!%!(  {..q#sAsCHHH),c3JFFC %%afafEEEvY& d ; EE   dD )+3+?+?+A'S#sCsC#IB)#S2X%ES2X%EH_S2X%EH_S2X%EG^S2X%ES2X%E$%>??,B}}T4> > >+ %%a36!8SIIIQI F, ? Js[B H H!H58H-G?.'HHB7H H+H9H:HHHHc#Kg}||kr1||kr|j||||||}n.|jd|||}n||kr|jd|||}|Ed{y7w)Nrr)rr)r"rrJrKrrLrMrs rrzDiffer._fancy_helpersi  9Sy''3QSAJJsAsC0 3Y 33,A sAA!AA!c#K t||j}t||j}d|z|rd|dd|z|r d|dyyw)N- z?  + )rrstrip)r"alineblinerrs rrzDiffer._qformatsr "%/668!%/668Ul ugR. Ul ugR.  sAAr) rrrr#rrrrrrrrrrrs0Sj!.'R( \J| !rrNz \s*(?:#\s*)?$c ||duSrr)linepats rrrs  t9D  rc ||vSrr)chwss rrr%s  8Orcv |dz}||z }|dk(rdj|S|s|dz}dj||SNr0z{}z{},{}formatstartstop beginningrs r_format_range_unifiedr<sJ& I E\F {{{9%% Q >>)V ,,rc #JK t|||||||d}td||j|D]} |sVd}|rdj|nd} |rdj|nd} dj|| |dj|| || d| d} } t | d | d }t | d | d }d j|||| D]J\}}}}}|dk(r|||D] }d|z  |dvr|||D] }d|z |dvs:|||D] }d|z Lyw)NFT {}rm --- {}{}{}z +++ {}{}{}rryr0rz@@ -{} +{} @@{}rqr>rornr>rprnr) _check_typesrrrr)rrfromfiletofile fromfiledate tofiledaterAlinetermstartedr~fromdatetodaterlast file1_range file2_rangervrdrhrerirs rr r Gsi%NAxz8LG a*>>qAG6Bv}}\2H2 +E!Hd1g> &&{KJJ#( CRRg~bHD*$%++bHD*$%++bHD*$%$)Bs D D# D#c |dz}||z }|s|dz}|dkrdj|Sdj|||zdz Srrrs r_format_range_contextrsT& I E\F Q  {{{9%% >>)Y%7!%; <rornNrrrv_s rrzcontext_diff..!I5Q1as++5rprrz --- {} ----{}c30K|]\}}}}}|dvyw)>rprnNrrs rrzcontext_diff..rrro)rdictrrrrany)rrrrrrrArprefixrr~rrrrrrvrdrhrrrreris rr r s(TAxz8L dD EFG a*>>qAG6Bv}}\2H2 $$[(;; I5I I%*!RQ(? !"R$SkD00!)&+ ,E!Hd1g> $$[(;; I5I I%*!Q2r(? !"R$SkD00!)&+1BsC5E38AE3E3E3cN|r>t|dts+tdt|djd|dd|r>t|dts+tdt|djd|dd|D] }t|trtd|y)Nrz"lines to compare must be str, not  ()z all arguments must be str, not: ) isinstancestr TypeErrortyper)rrargsargs rrrs AaD#&ad,,ad45 5AaD#&ad,,ad45 5#s#CIJ Jrc # K d} tt| |}tt| |}| |}| |}| |}| |}| |}|||||||||} | D]} | jddyw)Nc |jddS#t$r-}dt|jd|d}t ||d}~wwxYw)Nasciisurrogateescapez!all arguments must be bytes, not rr)decodeAttributeErrorr rr)rerrmsgs rrzdiff_bytes..decodesK *88G%67 7 *G$$a)CC.c ) *s A (AA rr)r]r^encode) dfuncrrrrrrrArrlinesrs rr r s* S^A S^AhH F^F,'L #JhH !Q&, Ax PEkk'#455sBBc< t||j||Sr)rr)rrrrs rrrs$!D (H % - -a 33rc#K ddl}|jdt||||ddgffd fdfd}|}| |Ed{y|dz }d} ddg|z} } d} | dur' t|\} } } | |z}| | | f| |<| dz } | dur'| |kDrd|}n| }d} |r| |z}| dz } | ||dz}|r|dz } |r&t|\} } } | r|dz }n|dz}| | | f|r&7#t$rYywxYw#t$rYywxYww) Nrz (\++|\-+|\^+)c ||xxdz cc<||||jdddfS|dk(rq|jd|jd}}g}|fd} j||t|D]"\}\} } |d| dz|z|| | zdz|| dz}$|dd}n#|jddd}|sd}d|z|zdz}|||fS) Nr0rr?c|j|jdd|jg|jdS)Nr0r)r4r~span) match_objectsub_infos rrecord_sub_infoz3_mdiff.._make_line..record_sub_infos=!3!3A!6q!9,:K:K:M NO#))!,,rr)r[subreversed) r format_keyside num_linestextmarkersrrkeybeginend change_res r _make_linez_mdiff.._make_linefs , $1  dOEIIaL$45 5  !IIaL%))A,'DH6> - MM/' 2$,H#5KU3Ae}T)#-d5o=dB4:M$68D99Q<#D*$t+d2D$%%rc3K g}d\}} t|dkr*|jtdt|dkr*dj|Dcgc]}|d c}}|j dr|}n|j dr|dd|dd df|j d r|d z}|d dddf|j d r|d dd}}|d z d}}n|j d r|dd|dd df|j dr|dd|dd df9|j d r|d z}|d dddf`|j dr|d z }d|dd df|j drd|dd }}|d zd}}nT|j dr|d z }d|dd df|j dr|dddd|dd df|dkr|d z }d|dkr|dkDr|d z}d|dkDr|j drydfBcc}ww)N)rrTrXrmrz-?+?rr0z--++r)z--?+z--+rz-+?z-?+z+--r)rz+-rF)NrmrT)r0NT)r:r4nextr startswith) rnum_blanks_pendingnum_blanks_to_yieldrr from_lineto_liner-diff_lines_iterators r_line_iteratorz_mdiff.._line_iterators 26//e*q. T"5s;<e*q.U3UTaU34A||C '9#f% s1-z%A/FLLf%#a'" s1-tT9934%/uS$;T' 9KA9Ma$6#e$ tA. 5Q0GMMe$ s1-z%Q/GMMc""a'" s1-tT99e$#a'"JuS3T99l+%):eC+B7 9KA9Ma$6#c""a'"JuS3T99c" q$q1*U42J5PP&)#q(#))&)&)#q(#))&)||C ,,M 4s%AII I F?I I4 Ic3K }gg}} t|dk(st|dk(rX t|\}}}||j||f||j||ft|dk(rIt|dk(rX|j d\}}|j d\}}|||xs|f#t$rYywxYwwrZ)r:r1 StopIterationr4r[) line_iterator fromlinestolinesr5r6 found_difffromDiffto_diffr8s r_line_pair_iteratorz#_mdiff.._line_pair_iterators '( R' y>1$G a59-5H2Iw ($$i %;<&NNGJ#78y>1$G a#,--"2 Ix&{{1~ GWWX%89 9 %s3*CB98C6C4C9 CCCCr0F)NNN)recompilerr1r:)r<r=contextrrrBrAline_pair_iteratorlines_to_writeindex contextLinesr>r5r6r<r8r-r,r7s @@@@r_mdiffrI<s@ +,I '(8D78e6&pV-p:B-.%%% 1 #$dVW%5 %(table)s%(legend)s aH table.diff {font-family:Courier; border:medium;} .diff_header {background-color:#e0e0e0} td.diff_header {text-align:right} .diff_next {background-color:#c0c0c0} .diff_add {background-color:#aaffaa} .diff_chg {background-color:#ffff77} .diff_sub {background-color:#ffaaaa}aZ %(header_row)s %(data_rows)s
a
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op
czeZdZ eZeZeZeZdZdddefdZ ddddZ dZ d Z d Z d Zd Zd ZdZ ddZy)r rNc> ||_||_||_||_yr)_tabsize _wrapcolumn _linejunk _charjunk)r"tabsize wrapcolumnrrs rr#zHtmlDiff.__init__s&   %!!rzutf-8)charsetc  |jt|j|j|j |||||||zj |dj |S)N)rDnumlines)styleslegendtablerSxmlcharrefreplace)_file_templater_styles_legend make_tablerr)r"r<r=fromdesctodescrDrUrSs r make_filezHtmlDiff.make_filesk "##d<<<<//)Wh*1H"F '  6'. /w  @rc fd}|Dcgc] }|| }}|Dcgc] }|| }}||fScc}wcc}w)Nc|jdd}|jj}|jdd}|jddjdS)Nrr  r)rn expandtabsrMr)rr"s r expand_tabsz2HtmlDiff._tab_newline_replace..expand_tabssS<<D)D??4==1D<<D)D<<S)006 6rr)r"r<r=rers` r_tab_newline_replacezHtmlDiff._tab_newline_replacesT  74==94[&9 =189;t$9  >9s6;c |s|j||fyt|}|j}||ks||jddzz |kr|j||fyd}d}d}||krB||kr=||dk(r|dz }||}|dz }n||dk(r|dz }d}n |dz }|dz }||kr||kr=|d|} ||d} |r | dz} d|z| z} |j|| f|j |d| y)Nr rrrmr0r!>)r4r:rNcount _split_line) r" data_listline_numr'rurzr<rAmarkline1line2s rrjzHtmlDiff._split_linesH    ht_ - 4y CKdTZZ%5a%78S@   ht_ -   #g!d(Aw$QAwQaDQQQ#g!d(RaQR DLE4K%'E (5)* 3u-rc#K |D]\}}}||||f||c\}}\}}gg} } |j| |||j| ||| s| sK| r| jd}nd}| r| jd}nd}|||f| r6| r9yw)Nr)rmr)rjr[) r"diffsfromdatatodataflagfromlinefromtexttolinetotextfromlisttolists r _line_wrapperzHtmlDiff._line_wrappersC%* HVD|vd**2:6 / Xh!VH   Xhx 8   VF6 2f'||AH'H#ZZ]F%Fvd**f%*sAB 5B B  B cB ggg}}}|D]^\}}} |j|jd|g||j|jd|g||j|`|||fS#t$r%|jd|jdYEwxYwrF)r4 _format_liner)r"rqryrzflaglistrrrsrts r_collect_lineszHtmlDiff._collect_lines.s $&b$) HVD $ 1 1 1!D C( CD /d//$??@ OOD !%*x''  $% d# $sAA00+BBc d|z}d|j||d}|jddjddjd d }|jd d j}d |d|d|dS#t$rd}YkwxYw)Nz%dz id=""rm&z&rhz>z)_prefixrrnr)r"r%rtlinenumr'ids rr}zHtmlDiff._format_lineCs  WnG!%d!3GnFz2 No Differences Found z( Empty File z!fz#t)rr:r2rz)r"ryrzr~rDrUrnext_id next_hrefnum_chg in_changerr<rts r_convert_flagszHtmlDiff._convert_flagses*(<<?$s8}$DX& %)FAd $IDQqzN+A!:hw=O!OGAJqLG&J!'N+'+IdO" !*$wHdGIDPQ!%O$PP6{>IIaL?8L $x '99rc F |j|j||\}}|r|}nd}t||||j|j}|j r|j |}|j|\} } } |j| | | ||\} } } } } g}d}tt| D]G}| ||dkDs|jd |j|| || || || || |fzI|s|rddd|zdd|zd}nd }|jtd j|||jd  z}|j!d d j!ddj!ddj!ddj!ddS)NrzV %s%s%s%s rz) z z!
z+%sz rmr0) data_rows header_rowrz+zz-zz^zr!zrcr)rrfrIrOrPrNr{rrrHr:r4_table_templaterrrrn)r"r<r=r^r_rDrU context_linesrqryrzr~rrrfmtr<rrXs rr]zHtmlDiff.make_tables $ !55iH ' $M My#~~/   &&u-E$(#6#6u#= 6:5H5H VHWX6727 7s8}%A{"q5HHJK#IaL!+4Q<q !CCD& v3=H3=F HJ J$$tggaj!<<?($$ }}U#<=WU#<=WU#<=WT),WT(+  ,r)rmrmF)rrrrZr[rr\rrr#r`rfrjr{rr}rrr]rrrr r s $NG%OGO4+""AC*+@8?@6!.5.n+8(*#. --:^INK,rr c#K dddt|}d|f}|D]}|dd|vs |ddy#t$rtd|zdwxYww)Nrr)r0rz)unknown delta choice (must be 1 or 2): %rrr)intKeyErrorr)deltawhichrvprefixesrs rrrs|*.4 U,c{H 8x qr(N .D"#$)- ..sA 1A  A A  A c4ddl}ddl}|j|SrZ)doctestdifflibtestmod)rrs r_testrs ??7 ##r__main__)rg333333?)z )rmrmrmrmrr)rrrrr )%__all__heapqrr collectionsr _namedtupletypesrr rrrrrrBrCmatchrrrr rr rr rrIrZr[rr\objectr rrrrrrrs8 >(1GZ( k 2k 2\.&bl!l!~  %2::&67==! . -=?.2B%R =,.?CJ1XK"25?D6<(9#4J(,d%K\ ( 0 "],v],~ @$ z Gr