Your IP : 18.220.13.15


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/difflib.cpython-39.opt-2.pyc

a

R�fkE�@s,gd�ZddlmZddlmZddlmZedd�Z	dd�Z
Gd	d
�d
�Zd9d
d�Zdd�Z
Gdd�d�ZddlZe�d�jfdd�Zd:dd�Zdd�Zd;dd�Zd d!�Zd<d"d#�Zd$d%�Zd=d(d)�Zdefd*d+�Zddefd,d-�Zd.Zd/Zd0Zd1ZGd2d3�d3e �Z![d4d5�Z"d6d7�Z#e$d8k�r(e#�dS)>)�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtuple)�GenericAliasrza b sizecCs|rd||SdS)Ng@��?�)�matches�lengthrr�,/opt/alt/python39/lib64/python3.9/difflib.py�_calculate_ratio'src@szeZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zddd�Zdd�Z	dd�Z
d dd�Zdd�Zdd�Z
dd�Zee�ZdS)!rN�TcCs(||_d|_|_||_|�||�dS�N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__xs;zSequenceMatcher.__init__cCs|�|�|�|�dSr)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jurdS||_d|_|_dSr)r�matching_blocks�opcodes)rrrrrr �s
zSequenceMatcher.set_seq1cCs2||jurdS||_d|_|_d|_|��dSr)rr"r#�
fullbcount�_SequenceMatcher__chain_b)rrrrrr!�s
zSequenceMatcher.set_seq2cCs�|j}i|_}t|�D]\}}|�|g�}|�|�qt�|_}|j}|r~|��D]}||�rV|�	|�qV|D]
}||=qrt�|_
}t|�}	|jr�|	dkr�|	dd}
|�
�D]\}}t|�|
kr�|�	|�q�|D]
}||=q�dS)N���d�)r�b2j�	enumerate�
setdefault�append�set�bjunkr�keys�addZbpopular�lenr�items)rrr)�i�elt�indicesZjunkrZpopular�nZntestZidxsrrrZ	__chain_b
s,
zSequenceMatcher.__chain_br
cCsT|j|j|j|jjf\}}}}|dur.t|�}|dur>t|�}||d}	}
}i}g}
t||�D]�}|j}i}|�|||
�D]\}||kr�q~||kr�q�||dd�d}||<||kr~||d||d|}	}
}q~|}q`|	|k�r@|
|k�r@|||
d��s@||	d||
dk�r@|	d|
d|d}	}
}q�|	||k�r�|
||k�r�|||
|��s�||	|||
|k�r�|d7}�q@|	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�q�|	||k�rH|
||k�rH|||
|��rH||	|||
|k�rH|d}�q�t|	|
|�S�Nr
r()	rrr)r.�__contains__r1�range�getr)r�alo�ahi�blo�bhirrr)ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr3Zj2lengetZnewj2len�j�krrr�find_longest_match1sZ:"����	�� ��z"SequenceMatcher.find_longest_matchcCs||jdur|jSt|j�t|j�}}d|d|fg}g}|r�|��\}}}}|�||||�\}	}
}}|r8|�|�||	kr�||
kr�|�||	||
f�|	||kr8|
||kr8|�|	|||
||f�q8|��d}
}}g}|D]V\}}}|
||k�r|||k�r||7}q�|�r,|�|
||f�|||}
}}q�|�rT|�|
||f�|�||df�tt	t
j|��|_|jS�Nr
)r"r1rr�poprAr,�sort�list�mapr�_make)r�la�lbZqueuer"r;r<r=r>r3r?r@�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdur|jSd}}g|_}|��D]�\}}}d}||krN||krNd}n||kr\d}n||krhd}|r�|�|||||f�||||}}|r*|�d||||f�q*|S)Nr
r�replace�delete�insert�equal)r#rOr,)rr3r?Zanswer�ai�bj�size�tagrrr�get_opcodes�s$

zSequenceMatcher.get_opcodes�c
csn|��}|sdg}|dddkrZ|d\}}}}}|t|||�|t|||�|f|d<|dddkr�|d\}}}}}||t|||�|t|||�f|d<||}g}	|D]�\}}}}}|dk�r(|||k�r(|	�||t|||�|t|||�f�|	Vg}	t|||�t|||�}}|	�|||||f�q�|	�rjt|	�dk�rd|	dddk�sj|	VdS)N)rSr
r(r
r(r
rS���r()rX�max�minr,r1)
rr6ZcodesrWrKrMrLrNZnn�grouprrr�get_grouped_opcodes#s(&&(&z#SequenceMatcher.get_grouped_opcodescCs0tdd�|��D��}t|t|j�t|j��S)Ncss|]}|dVqdS)rZNr)�.0Ztriplerrr�	<genexpr>k�z(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrOrr1rr)rrrrr�ratioUszSequenceMatcher.ratiocCs�|jdur4i|_}|jD]}|�|d�d||<q|j}i}|jd}}|jD]>}||�rf||}n|�|d�}|d||<|dkrP|d}qPt|t|j�t|j��Sr7)r$rr:r8rrr1)rr$r4ZavailZavailhasrZnumbrrr�quick_rations






zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�Sr)r1rrrr\)rrHrIrrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)r
Nr
N)rY)�__name__�
__module__�__qualname__rrr r!r%rArOrXr^rcrdre�classmethodr�__class_getitem__rrrrr,sL
@,'
tG7
2rrY�333333�?cCs�|dkstd|f��d|kr*dks:ntd|f��g}t�}|�|�|D]D}|�|�|��|krR|��|krR|��|krR|�|��|f�qRt||�}dd�|D�S)Nr
zn must be > 0: %rgrz cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|�qSrr)r_ZscorerJrrr�
<listcomp>�raz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrr!r rerdrcr,�	_nlargest)ZwordZ
possibilitiesr6�cutoff�result�srJrrrr�s"


�
�
rcCsd�dd�t||�D��S)Nrcss*|]"\}}|dkr|��r|n|VqdS)� N)�isspace)r_�cZtag_crrrr`�s�z$_keep_original_ws.<locals>.<genexpr>)�join�zip)rqZtag_srrr�_keep_original_ws�s
�rwc@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rNcCs||_||_dSr��linejunk�charjunk)rryrzrrrr*szDiffer.__init__c
	cs�t|j||�}|��D]�\}}}}}|dkrB|�||||||�}	n\|dkr\|�d|||�}	nB|dkrv|�d|||�}	n(|dkr�|�d|||�}	ntd|f��|	EdHqdS)	NrPrQ�-rR�+rSrr�unknown tag %r)rryrX�_fancy_replace�_dumprm)
rrr�cruncherrWr;r<r=r>�grrr�compareAszDiffer.compareccs&t||�D]}d|||fVq
dS)Nz%s %s)r9)rrWrJ�lo�hir3rrrrjszDiffer._dumpc
csn||||kr2|�d|||�}|�d|||�}n |�d|||�}|�d|||�}||fD]}	|	EdHqZdS)Nr|r{)r)
rrr;r<rr=r>�first�secondr�rrr�_plain_replaceoszDiffer._plain_replaceccs:d\}}t|j�}	d\}
}t||�D]�}||}
|	�|
�t||�D]j}||}||
krl|
durD||}
}qD|	�|�|	��|krD|	��|krD|	��|krD|	��||}}}qDq$||kr�|
dur�|�||||||�EdHdS|
|d}}}nd}
|�	||||||�EdH||||}}|
du�r
d}}|	�
||�|	��D]�\}}}}}||||}}|dk�r�|d|7}|d|7}nb|dk�r�|d|7}nJ|d	k�r�|d
|7}n2|dk�r�|d|7}|d|7}ntd
|f���qH|�
||||�EdHn
d|V|�	||d|||d|�EdHdS)N)g�G�z��?g�?)NNrrrP�^rQr{rRr|rSrrr}�  r()rrzr9r!r rerdrcr��
_fancy_helperrrXrm�_qformat)rrr;r<rr=r>Z
best_ratioror�ZeqiZeqjr?rUr3rTZbest_iZbest_jZaeltZbelt�atags�btagsrWZai1Zai2Zbj1Zbj2rHrIrrrr~}s\




�
�





zDiffer._fancy_replaceccsbg}||kr<||kr*|�||||||�}qT|�d|||�}n||krT|�d|||�}|EdHdS)Nr{r|)r~r)rrr;r<rr=r>r�rrrr��szDiffer._fancy_helperccsXt||���}t||���}d|V|r8d|�d�Vd|V|rTd|�d�VdS)N�- z? �
�+ )rw�rstrip)rZalineZbliner�r�rrrr��s

zDiffer._qformat)NN)
rfrgrhrr�rr�r~r�r�rrrrr�sV
)^rNz
\s*(?:#\s*)?$cCs||�duSrr)�lineZpatrrrrsr� 	cCs||vSrr)ZchZwsrrrr%srcCs:|d}||}|dkr"d�|�S|s.|d8}d�||�S�Nr(z{}z{},{}��format��start�stopZ	beginningrrrr�_format_range_unified<s
r�rr�ccsPt|||||||�d}td||��|�D�]}	|s|d}|rFd�|�nd}
|rXd�|�nd}d�||
|�Vd�|||�V|	d|	d}}
t|d	|
d
�}t|d|
d�}d
�|||�V|	D]�\}}}}}|dkr�|||�D]}d|Vq�q�|dv�r"|||�D]}d|V�q|dvr�|||�D]}d|V�q6q�q*dS)NFT�	{}r�
--- {}{}{}z
+++ {}{}{}r
rZr(�rY�z@@ -{} +{} @@{}rSrr>rQrPr{>rRrPr|)�_check_typesrr^r�r�)rr�fromfile�tofile�fromfiledate�
tofiledater6�lineterm�startedr]�fromdate�todater��last�file1_range�file2_rangerWrKrMrLrNr�rrrr	Gs0)
r	cCsB|d}||}|s|d8}|dkr.d�|�Sd�|||d�Sr�r�r�rrr�_format_range_context�s
r�ccs�t|||||||�tddddd�}d}	td||��|�D�]R}
|	s�d}	|rVd�|�nd	}|rhd�|�nd	}d
�|||�Vd�|||�V|
d|
d
}
}d|Vt|
d|d�}d�||�Vtdd�|
D���r|
D]8\}}}}}|dkr�|||�D]}|||V�qq�t|
d|d�}d�||�Vtdd�|
D��r:|
D]<\}}}}}|dk�rP|||�D]}|||V�qt�qPq:dS)Nr�r�z! r�)rRrQrPrSFTr�rz
*** {}{}{}r�r
rZz***************r(r�z
*** {} ****{}css |]\}}}}}|dvVqdS)>rQrPNr�r_rW�_rrrr`�razcontext_diff.<locals>.<genexpr>rRrYr�z
--- {} ----{}css |]\}}}}}|dvVqdS)>rRrPNrr�rrrr`�rarQ)r��dictrr^r�r��any)rrr�r�r�r�r6r��prefixr�r]r�r�r�r�r�rWrKrMr�r�r�rLrNrrrr�s4,

rcGs�|r0t|dt�s0tdt|d�j|df��|r`t|dt�s`tdt|d�j|df��|D]}t|t�sdtd|f��qddS)Nr
z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r)�
isinstance�str�	TypeError�typerf)rr�args�argrrrr��s��
r�ra�
c		cs~dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
|
D]}|�dd�VqfdS)Nc
SsTz|�dd�WStyN}z(dt|�j|f}t|�|�WYd}~n
d}~00dS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�rfr�)rq�err�msgrrrr�s�zdiff_bytes.<locals>.decoder�r�)rErF�encode)Zdfuncrrr�r�r�r�r6r�r��linesr�rrrr
�sr
cCst||��||�Sr)rr�)rrryrzrrrrs#rc#s�ddl}|�d��t||||��ddgf�fdd�	���fdd���fdd�}|�}|durj|EdH�n|d	7}d}ddg|}	}
d
}|d
ur�zt|�\}}
}Wnty�YdS0|	|}||
|f|
|<|	d	7}	q�|	|kr�dV|}n|	}d}	|�r |	|}|	d	7}	|
|V|d	8}q�|d	}z@|�rft|�\}}
}|�rN|d	}n|d	8}||
|fV�q*Wqvt�y~YdS0qvdS)Nr
z
(\++|\-+|\^+)cs�||d7<|dur2|||�d�dd�fS|dkr�|�d�|�d�}}g}|fdd�}��||�t|�D]<\}\}	}
|d|	�d|||	|
�d||
d�}qt|dd�}n*|�d�dd�}|s�d	}d||d}|||fS)
Nr(r
r��?cSs&|�|�d�d|��g�|�d�S)Nr(r
)r,r]�span)Zmatch_object�sub_inforrr�record_sub_info�sz3_mdiff.<locals>._make_line.<locals>.record_sub_info��rr)rC�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_linefs 2z_mdiff.<locals>._make_linec3sng}d\}}t|�dkr*|�t�d��qd�dd�|D��}|�d�rP|}�n�|�d�r|�|dd	��|dd
�dfVq�n�|�d�r�|d
8}�|d
d	�ddfVq�nl|�d�rֈ|d
d	�d}}|d
d	}}�n>|�d��r�|dd	��|dd
�dfVq�n|�d��r0�|dd	��|dd
�dfVqn�|�d
��r\|d
8}�|d
d	�ddfVqn�|�d��r�|d
7}d�|dd
�dfVqn�|�d��r�d�|dd
�}}|d
d	}}n^|�d��r�|d
7}d�|dd
�dfVqn2|�d��r�|dd�dd	��|dd
�dfVq|d	k�r0|d
7}dV�q|d	k�rL|d
8}dV�q0|�d��r\dS||dfVqdS)N)r
r
r��XrcSsg|]}|d�qS)r
r�r_r�rrrrl�raz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r
r(Tz--++r{)z--?+z--+r�z-+?z-?+z+--r|)r�z+-rrF)N�rr�T)r�NT)r1r,�nextru�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldrq�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sd



$



z_mdiff.<locals>._line_iteratorc3s���}gg}}t|�dks(t|�dkr~zt|�\}}}WntyNYdS0|durf|�||f�|dur|�||f�q|�d�\}}|�d�\}}|||p�|fVqdSrB)r1r��
StopIterationr,rC)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterator�s

z#_mdiff.<locals>._line_pair_iteratorr(F)NNN)�re�compilerr�r�)r�r��contextryrzr�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r3r)r�r�r�r�r�_mdiff<sR"
8X!



r�an
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>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
    <table class="diff" id="difflib_chg_%(prefix)s_top"
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>a�
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>c@s�eZdZeZeZeZeZdZdddefdd�Z	dd	d
�dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zddd�ZdS)rr
�NcCs||_||_||_||_dSr)�_tabsize�_wrapcolumn�	_linejunk�	_charjunk)r�tabsizeZ
wrapcolumnryrzrrrr�szHtmlDiff.__init__rF�zutf-8)�charsetcCs:|jt|j|j|j||||||d�|d��|d��|�S)N)r��numlines)ZstylesZlegend�tabler��xmlcharrefreplace)�_file_templater��_styles�_legend�
make_tabler�r�)rr�r��fromdesc�todescr�r�r�rrr�	make_file�s����zHtmlDiff.make_filecs8�fdd���fdd�|D�}�fdd�|D�}||fS)Ncs6|�dd�}|��j�}|�dd�}|�dd��d�S)Nrrr��	r�)rP�
expandtabsr�r�)r�)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrrr��r�rrrl�raz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrrr�r�rrrl�rar)rr�r�r)r�rr�_tab_newline_replace�s
	zHtmlDiff._tab_newline_replacecCs|s|�||f�dSt|�}|j}||ksB||�d�d|krT|�||f�dSd}d}d}||kr�||kr�||dkr�|d7}||}|d7}q`||dkr�|d7}d}q`|d7}|d7}q`|d|�}	||d�}
|r�|	d}	d||
}
|�||	f�|�|d|
�dS)Nr�rYr
rr(r��>)r,r1r��count�_split_line)rZ	data_listZline_numr�rVr[r3r6ZmarkZline1Zline2rrrr��s8


zHtmlDiff._split_lineccs�|D]�\}}}|dur$|||fVq||\}}\}}gg}	}
|�|	||�|�|
||�|	sd|
r|	rt|	�d�}nd}|
r�|
�d�}nd}|||fVq\qdS)Nr
)rrr)r�rC)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrappers 
zHtmlDiff._line_wrapperc	Cs�ggg}}}|D]t\}}}z8|�|jd|g|�R��|�|jd|g|�R��Wn&ty||�d�|�d�Yn0|�|�q|||fSr7)r,�_format_liner�)rr�r�r�flaglistr�r�r�rrr�_collect_lines.s
zHtmlDiff._collect_linescCspzd|}d|j||f}Wnty4d}Yn0|�dd��dd��dd	�}|�d
d���}d|||fS)
Nz%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rr�&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rPr�)rr�r�Zlinenumr��idrrrrCs
�zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)Nzfrom%d_zto%d_r()r�_default_prefixr)rZ
fromprefix�toprefixrrr�_make_prefixZs

zHtmlDiff._make_prefixcCs�|jd}dgt|�}dgt|�}d\}	}
d}t|�D]V\}}
|
r�|
s�d}
|}td||g�}d||	f||<|	d7}	d||	f||<q:d}
q:|s�dg}dg}dg}d}|r�d	g}|}n
d
g}}|ds�d||d<d|||<|||||fS)
Nr(r)r
Fr
Tz id="difflib_chg_%s_%d"z"<a href="#difflib_chg_%s_%d">n</a>Fz2<td></td><td>&nbsp;No Differences Found&nbsp;</td>z(<td></td><td>&nbsp;Empty File&nbsp;</td>z!<a href="#difflib_chg_%s_0">f</a>z#<a href="#difflib_chg_%s_top">t</a>)rr1r*r[)rr�rrr�r�r�next_id�	next_hrefZnum_chgZ	in_changer�r3r�rrr�_convert_flagses<
�
zHtmlDiff._convert_flagsc
CsR|��|�||�\}}|r"|}nd}t||||j|jd�}|jrL|�|�}|�|�\}	}
}|�|	|
|||�\}	}
}}}
g}d}t	t
|��D]P}||dur�|dkr�|�d�q�|�||
||||	||||
|f�q�|s�|�rddd|dd|f}nd}|jt
d�|�||jd	d
�}|�dd��d
d��dd��dd��dd�S)NrxzV            <tr><td class="diff_next"%s>%s</td>%s<td class="diff_next">%s</td>%s</tr>
r
z)        </tbody>        
        <tbody>
z <thead><tr>%s%s%s%s</tr></thead>z!<th class="diff_next"><br /></th>z+<th colspan="2" class="diff_header">%s</th>rr()Z	data_rows�
header_rowr�z+z<span class="diff_add">z-z<span class="diff_sub">z^z<span class="diff_chg">r�z</span>r�r)rr�r�r�r�r�rrrr9r1r,�_table_templater�rurrP)rr�r�r�r�r�r�Z
context_linesr�r�rrrr
rqZfmtr3rr�rrrr��sZ�

��

������zHtmlDiff.make_table)rrFr�)rrFr�)rfrgrhr�r�rr�r
rrr�r�r�rrrrrr�rrrrr�s.�
��7/�rccslzddd�t|�}Wn ty6td|�d�Yn0d|f}|D]"}|dd�|vrD|dd�VqDdS)Nr�r�)r(r�z)unknown delta choice (must be 1 or 2): %rr�r�)�int�KeyErrorrm)ZdeltaZwhichrW�prefixesr�rrrr�s��rcCsddl}ddl}|�|�SrB)�doctest�difflibZtestmod)rrrrr�_testsr�__main__)rYrk)r�)rrrrrYr�)rrrrrYr�)rararararYr�)%�__all__�heapqrrn�collectionsrZ_namedtuple�typesrrrrrrwrr�r��matchrrr�r	r�rr�r
rr�r�r�rr��objectrrrrfrrrr�<module>s`
r
1	A
�
I�
L�
%�
	
a 


?>