Your IP : 18.190.239.189


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/difflib.cpython-38.opt-2.pyc

U

i�fZH�@s4dddddddddd	d
dgZdd
lmZddlmZedd�Zdd�ZGdd�d�Z	d7dd�Z
dd�ZGdd�d�Zddl
Z
e
�d�jfdd�Zd8dd�Zdd�Zd9d"d�Zd#d$�Zd:d%d�Zd&d'�Zd;d*d	�Zdefd+d�Zddefd,d-�Zd.Zd/Zd0Zd1ZGd2d
�d
e�Z[
d3d�Z d4d5�Z!e"d6k�r0e!�dS)<�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtupleza b sizecCs|rd||SdS)Ng@��?�)�matches�lengthrr�,/opt/alt/python38/lib64/python3.8/difflib.py�_calculate_ratio&src@speZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�ZdS)rN�TcCs(||_d|_|_||_|�||�dS�N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__�s;zSequenceMatcher.__init__cCs|�|�|�|�dSr)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dSr)r�matching_blocks�opcodes)rrrrrr�s
zSequenceMatcher.set_seq1cCs2||jkrdS||_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_bcCs4|j|j|j|jjf\}}}}||d}	}
}i}g}
t||�D]�}|j}i}|�|||
�D]\}||krlq^||krxq�||dd�d}||<||kr^||d||d|}	}
}q^|}q@|	|k�r |
|k�r |||
d��s ||	d||
dk�r |	d|
d|d}	}
}q�|	||k�rt|
||k�rt|||
|��st||	|||
|k�rt|d7}�q |	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�qt|	||k�r(|
||k�r(|||
|��r(||	|||
|k�r(|d}�q�t|	|
|�S�Nr
r')rrr(r-�__contains__�range�getr)r�alo�ahi�blo�bhirrr(ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr2Zj2lengetZnewj2len�j�krrr�find_longest_matchPsR8"����	�� ��z"SequenceMatcher.find_longest_matchcCs||jdk	r|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!r0rr�popr@r+�sort�list�mapr�_make)r�la�lbZqueuer!r:r;r<r=r2r>r?�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdk	r|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"rNr+)rr2r>Zanswer�ai�bj�size�tagrrr�get_opcodess$

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)rRr
r'r
r'r
rR���r')rW�max�minr+r0)
rr5ZcodesrVrJrLrKrMZnn�grouprrr�get_grouped_opcodes<s(&&(&z#SequenceMatcher.get_grouped_opcodescCs0tdd�|��D��}t|t|j�t|j��S)Ncss|]}|dVqdS)rYNr)�.0Ztriplerrr�	<genexpr>�sz(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrNrr0rr)rrrrr�rationszSequenceMatcher.ratiocCs�|jdkr4i|_}|jD]}|�|d�d||<q|j}i}|jd}}|jD]>}||�rf||}n|�|d�}|d||<|dkrP|d}qPt|t|j�t|j��Sr6)r#rr9r7rrr0)rr#r3ZavailZavailhasrZnumbrrr�quick_ratio�s






zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�Sr)r0rrrr[)rrGrHrrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)rX)�__name__�
__module__�__qualname__rrrr r$r@rNrWr]rarbrcrrrrr+sl
@,'nG7
2rX�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^ZscorerIrrr�
<listcomp>�sz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrr rrcrbrar+�	_nlargest)ZwordZ
possibilitiesr5�cutoff�result�srIrrrr�s"


�
�
cCsd�dd�t||�D��S)Nrcss*|]"\}}|dkr|��r|n|VqdS)� N)�isspace)r^�cZtag_crrrr_�s�z$_keep_original_ws.<locals>.<genexpr>)�join�zip)rmZtag_srrr�_keep_original_ws�s
�rsc@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rNcCs||_||_dSr��linejunk�charjunk)rrurvrrrrHszDiffer.__init__c
	cs�t|j||�}|��D]�\}}}}}|dkrB|�||||||�}	n\|dkr\|�d|||�}	nB|dkrv|�d|||�}	n(|dkr�|�d|||�}	ntd|f��|	EdHqdS)	NrOrP�-rQ�+rRrn�unknown tag %r)rrurW�_fancy_replace�_dumpri)
rrr�cruncherrVr:r;r<r=�grrr�compare_szDiffer.compareccs&t||�D]}d|||fVq
dS)Nz%s %s)r8)rrVrI�lo�hir2rrrr{�szDiffer._dumpc
csn||||kr2|�d|||�}|�d|||�}n |�d|||�}|�d|||�}||fD]}	|	EdHqZdS)Nrxrw)r{)
rrr:r;rr<r=�first�secondr}rrr�_plain_replace�szDiffer._plain_replaceccs:d\}}t|j�}	d\}
}t||�D]�}||}
|	�|
�t||�D]j}||}||
krl|
dkrD||}
}qD|	�|�|	��|krD|	��|krD|	��|krD|	��||}}}qDq$||kr�|
dkr�|�||||||�EdHdS|
|d}}}nd}
|�	||||||�EdH||||}}|
dk�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�?)NNrrrO�^rPrwrQrxrRrnry�  r')rrvr8r rrcrbrar��
_fancy_helperrrWri�_qformat)rrr:r;rr<r=Z
best_ratiorkr|ZeqiZeqjr>rTr2rSZbest_iZbest_jZaeltZbelt�atags�btagsrVZai1Zai2Zbj1Zbj2rGrHrrrrz�s\




�
�




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

zDiffer._qformat)NN)
rdrerfrr~r{r�rzr�r�rrrrr�s^
)^Nz
\s*(?:#\s*)?$cCs||�dk	Srr)�lineZpatrrrr3s� 	cCs||kSrr)ZchZwsrrrrCscCs:|d}||}|dkr"d�|�S|s.|d8}d�||�S�Nr'z{}z{},{}��format��start�stopZ	beginningrrrr�_format_range_unifiedZs
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�|dk�r"|||�D]}d|V�q|dkr�|||�D]}d|V�q6q�q*dS)NFT�	{}r�
--- {}{}{}z
+++ {}{}{}r
rYr'�rX�z@@ -{} +{} @@{}rRrn>rOrPrw>rOrQrx)�_check_typesrr]r�r�)rr�fromfile�tofile�fromfiledate�
tofiledater5�lineterm�startedr\�fromdate�todater��last�file1_range�file2_rangerVrJrLrKrMr�rrrr	es0)
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�)rQrPrOrRFTr�rz
*** {}{}{}r�r
rYz***************r'r�z
*** {} ****{}css |]\}}}}}|dkVqdS)>rOrPNr�r^rV�_rrrr_�szcontext_diff.<locals>.<genexpr>rQrXr�z
--- {} ----{}css |]\}}}}}|dkVqdS)>rOrQNrr�rrrr_srP)r��dictrr]r�r��any)rrr�r�r�r�r5r��prefixr�r\r�r�r�r�r�rVrJrLr�r�r�rKrMrrrr�s4,

cGs�|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�typerd)rr�args�argrrrr�s��
r���
c		cs~dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
|
D]}|�dd�VqfdS)Nc
SsRz|�dd�WStk
rL}z dt|�j|f}t|�|�W5d}~XYnXdS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�rdr�)rm�err�msgrrrr�"s�zdiff_bytes.<locals>.decoder�r�)rDrE�encode)Zdfuncrrr�r�r�r�r5r�r��linesr�rrrr
scCst||��||�Sr)rr~)rrrurvrrrr5s#c#s�ddl}|�d��t||||��ddgf�fdd�	���fdd���fdd�}|�}|dkrj|EdH�n|d	7}d}ddg|}	}
d
}|d
kr�zt|�\}}
}Wntk
r�YdSX|	|}||
|f|
|<|	d	7}	q�|	|kr�dV|}n|	}d}	|�r"|	|}|	d	7}	|
|V|d	8}q�|d	}z@|�rht|�\}}
}|�rP|d	}n|d	8}||
|fV�q,Wqvtk
�r�YdSXqvdS)Nr
z
(\++|\-+|\^+)cs�||d7<|dkr2|||�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��rn)rB�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_line�s 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�rrrrh�sz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r
r'Tz--++rw)z--?+z--+r�z-+?z-?+z+--rx)r�z+-rnF)N�rr�T)r�NT)r0r+�nextrq�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldrm�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sd



$



z_mdiff.<locals>._line_iteratorc3s���}gg}}t|�dks(t|�dkr�zt|�\}}}Wntk
rPYdSX|dk	rh|�||f�|dk	r|�||f�q|�d�\}}|�d�\}}|||p�|fVqdSrA)r0r��
StopIterationr+rB)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterators

z#_mdiff.<locals>._line_pair_iteratorr'F)NNN)�re�compilerr�r�)r�r��contextrurvr�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r2r)r�r�r�r�r�_mdiffZsR"
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
wrapcolumnrurvrrrr�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)Nrnr��	r�)rO�
expandtabsr�r�)r�)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrrr��r�rrrh�sz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrrr�r�rrrh�sr)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�rXr
rr'r��>)r+r0r��count�_split_line)rZ	data_listZline_numr�rUrZr2r5ZmarkZline1Zline2rrrr��s8


zHtmlDiff._split_lineccs�|D]�\}}}|dkr$|||fVq||\}}\}}gg}	}
|�|	||�|�|
||�|	sd|
r|	rt|	�d�}nd}|
r�|
�d�}nd}|||fVq\qdS)Nr
)rrn)r�rB)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrapper0s 
zHtmlDiff._line_wrapperc	Cs�ggg}}}|D]r\}}}z4|�|jd|f|���|�|jd|f|���Wn(tk
rz|�d�|�d�YnX|�|�q|||fSr6)r+�_format_liner�)rr�r�r��flaglistr�r�r�rrr�_collect_linesLs
zHtmlDiff._collect_linescCsrzd|}d|j||f}Wntk
r6d}YnX|�dd��dd��dd	�}|�d
d���}d|||fS)
Nz%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rn�&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rOr�)rr�r�Zlinenumr��idrrrr�as
�zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)Nzfrom%d_zto%d_r')r�_default_prefixr)rZ
fromprefix�toprefixrrr�_make_prefixxs

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>)rr0r)rZ)rr�r�rr�r�r�next_id�	next_hrefZnum_chgZ	in_changer�r2r�rrr�_convert_flags�s>
�
zHtmlDiff._convert_flagsc
CsR|��|�||�\}}|r"|}nd}t||||j|jd�}|jrL|�|�}|�|�\}	}
}|�|	|
|||�\}	}
}}}
g}d}t	t
|��D]P}||dkr�|dkr�|�d�q�|�||
||||	||||
|f�q�|s�|�rddd|dd|f}nd}|jt
d�|�||jd	d
�}|�dd��d
d��dd��dd��dd�S)NrtzV            <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�r�rrr8r0r+�_table_templater�rqrrO)rr�r�r�r�r�r�Z
context_linesr�r�r�rrr
rmZfmtr2r
r�rrrr��sl�
��

������zHtmlDiff.make_table)rrFr�)rrFr�)rdrerfr�r�rr�rrrr�r�r�r�rr�r	rr�rrrrr�s0�
��7/�ccsnzddd�t|�}Wn"tk
r8td|�d�YnXd|f}|D]"}|dd�|krF|dd�VqFdS)Nr�r�)r'r�z)unknown delta choice (must be 1 or 2): %rr�r�)�int�KeyErrorri)ZdeltaZwhichrV�prefixesr�rrrrs��cCsddl}ddl}|�|�SrA)�doctest�difflibZtestmod)rrrrr�_test!sr�__main__)rXrg)r�)rrrrrXr�)rrrrrXr�)r�r�r�r�rXr�)#�__all__�heapqrrj�collectionsrZ_namedtuplerrrrrsrr�r��matchrrr�r	r�rr�r
rr�r�r�rr��objectrrrrdrrrr�<module>s��


1	I
�
I�
L�
%�
	
a 


?>