§
    öyIfÏ„  ã                  ó˜  — U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZ ddlmZ dd	lmZmZmZmZmZmZmZm Z m!Z!m"Z" ddl#Z#dd
l#m$Z$ ddl%m&Z&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z. ddl/m0Z0m1Z1 erddl2m3Z3 dZ4 ej5        d¦  «        Z6 ede7¦  «        Z8 ede7¦  «        Z9 G d„ de¦  «        Z:edee8         f         Z;ee8df         Z<e"e eef         Z= G d„ d¦  «        Z>ede>f         Z? G d„ d¦  «        Z@ G d„ d¦  «        ZA G d„ de¦  «        ZBe!de9e9f         ZCe4fdVd$„ZDdWd(„ZEdXd.„ZF G d/„ d0e¦  «        ZG G d1„ d2¦  «        ZH	 dYdZd=„ZIejJ         G d>„ d¦  «        ¦   «         ZKd?d@iZLdAeMdB<   d[dI„ZN G dJ„ dKe'eH¦  «        ZOd\dN„ZPd]d^dQ„ZQdYd_dT„ZReSdUk    r eR¦   «          dS dS )`aé  A similarities / code duplication command line tool and pylint checker.

The algorithm is based on comparing the hash value of n successive lines of a file.
First the files are read and any line that doesn't fulfill requirement are removed
(comments, docstrings...)

Those stripped lines are stored in the LineSet class which gives access to them.
Then each index of the stripped lines collection is associated with the hash of n
successive entries of the stripped lines starting at the current index (n is the
minimum common lines option).

The common hashes between both linesets are then looked for. If there are matches, then
the match indices in both linesets are stored and associated with the corresponding
couples (start line number/end line number) in both files.

This association is then post-processed to handle the case of successive matches. For
example if the minimum common lines setting is set to four, then the hashes are
computed with four lines. If one of match indices couple (12, 34) is the
successor of another one (11, 33) then it means that there are in fact five lines which
are common.

Once post-processed the values of association table are the result looked for, i.e.
start and end lines numbers of common lines in both files.
é    )ÚannotationsN)Údefaultdict)ÚCallableÚ	GeneratorÚIterableÚSequence)Úgetopt)ÚBufferedIOBaseÚBufferedReaderÚBytesIO)Úchain)
ÚTYPE_CHECKINGÚAnyÚDictÚListÚ
NamedTupleÚNewTypeÚNoReturnÚTextIOÚTupleÚUnion)Únodes)ÚBaseCheckerÚBaseRawFileCheckerÚtable_lines_from_stats)ÚSectionÚTable)ÚMessageDefinitionTupleÚOptions)ÚLinterStatsÚdecoding_stream)ÚPyLinteré   z.*\w+ÚIndexÚ
LineNumberc                  ó$   — e Zd ZU ded<   ded<   dS )ÚLineSpecifsr%   Úline_numberÚstrÚtextN©Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© ó    úK/var/www/piapp/venv/lib/python3.11/site-packages/pylint/checkers/similar.pyr'   r'   Q   s%   € € € € € € ØÐÐÑØ€I€I�I€I€Ir1   r'   Ú
LinesChunkÚSuccessiveLinesLimitsc                  ó   — e Zd ZdZdZdd
„ZdS )ÚCplSuccessiveLinesLimitsz¬Holds a SuccessiveLinesLimits object for each checked file and counts the number
    of common lines between both stripped lines collections extracted from both files.
    ©Ú
first_fileÚsecond_fileÚeffective_cmn_lines_nbr8   r4   r9   r:   ÚintÚreturnÚNonec                ó0   — || _         || _        || _        d S ©Nr7   )Úselfr8   r9   r:   s       r2   Ú__init__z!CplSuccessiveLinesLimits.__init__h   s!   € ð %ˆŒØ&ˆÔØ&<ˆÔ#Ð#Ð#r1   N)r8   r4   r9   r4   r:   r;   r<   r=   )r,   r-   r.   Ú__doc__Ú	__slots__rA   r0   r1   r2   r6   r6   a   s:   € € € € € ðð ð H€Ið=ð =ð =ð =ð =ð =r1   r6   ÚLineSetStartCouplec                  ó>   — e Zd ZdZdZdd„Zdd„Zdd„Zdd„Zdd„Z	dS )r3   zlThe LinesChunk object computes and stores the hash of some consecutive stripped
    lines of a lineset.
    ©Ú_fileidÚ_indexÚ_hashÚfileidr)   Únum_liner;   ÚlinesúIterable[str]r<   r=   c                ó|   — || _         	 t          |¦  «        | _        	 t          d„ |D ¦   «         ¦  «        | _        d S )Nc              3  ó4   K  — | ]}t          |¦  «        V — Œd S r?   )Úhash)Ú.0Úlins     r2   ú	<genexpr>z&LinesChunk.__init__.<locals>.<genexpr>ˆ   s(   è è € Ð9Ð9¨C�d 3™iœiÐ9Ð9Ð9Ð9Ð9Ð9r1   )rG   r$   rH   ÚsumrI   )r@   rJ   rK   rL   s       r2   rA   zLinesChunk.__init__   sD   € Ø"ˆŒØQå" 8™_œ_ˆŒð	õ Ð9Ð9°5Ð9Ñ9Ô9Ñ9Ô9ˆŒ
Ø1Ð1r1   Úor   Úboolc                óZ   — t          |t          ¦  «        st          S | j        |j        k    S r?   )Ú
isinstancer3   ÚNotImplementedrI   )r@   rU   s     r2   Ú__eq__zLinesChunk.__eq__‹   s)   € Ý˜!�ZÑ(Ô(ð 	"Ý!Ð!ØŒz˜QœWÒ$Ð$r1   c                ó   — | j         S r?   )rI   ©r@   s    r2   Ú__hash__zLinesChunk.__hash__�   s
   € ØŒzÐr1   c                ó8   — d| j         › d| j        › d| j        › d�S )Nz<LinesChunk object for file z (z, z)>rF   r\   s    r2   Ú__repr__zLinesChunk.__repr__“   s+   € àX¨4¬<ÐXÐX¸4¼;ÐXÐXÈ$Ì*ÐXÐXÐXð	
r1   c                ó6   — d| j         › d| j        › d| j        › �S )NzLinesChunk object for file z, starting at line z
 
Hash is rF   r\   s    r2   Ú__str__zLinesChunk.__str__˜   s7   € ð$¨$¬,ð $ð $È4Ì;ð $ð $Ø”zð$ð $ð	
r1   N)rJ   r)   rK   r;   rL   rM   r<   r=   )rU   r   r<   rV   ©r<   r;   ©r<   r)   )
r,   r-   r.   rB   rC   rA   rZ   r]   r_   ra   r0   r1   r2   r3   r3   x   s‰   € € € € € ðð ð /€Ið
2ð 
2ð 
2ð 
2ð%ð %ð %ð %ð
ð ð ð ð
ð 
ð 
ð 
ð

ð 
ð 
ð 
ð 
ð 
r1   c                  óx   — e Zd ZdZdZdd„Zedd	„¦   «         Zedd
„¦   «         Zej	        dd„¦   «         Zdd„Z
dS )r4   zA class to handle the numbering of begin and end of successive lines.

    :note: Only the end line number can be updated.
    ©Ú_startÚ_endÚstartr%   Úendr<   r=   c                ó"   — || _         || _        d S r?   re   )r@   rh   ri   s      r2   rA   zSuccessiveLinesLimits.__init__§   s   € Ø"'ˆŒØ #ˆŒ	ˆ	ˆ	r1   c                ó   — | j         S r?   )rf   r\   s    r2   rh   zSuccessiveLinesLimits.start«   s
   € àŒ{Ðr1   c                ó   — | j         S r?   ©rg   r\   s    r2   ri   zSuccessiveLinesLimits.end¯   s
   € àŒyÐr1   Úvaluec                ó   — || _         d S r?   rm   ©r@   rn   s     r2   ri   zSuccessiveLinesLimits.end³   s   € àˆŒ	ˆ	ˆ	r1   r)   c                ó(   — d| j         › d| j        › d�S )Nz<SuccessiveLinesLimits <ú;ú>>re   r\   s    r2   r_   zSuccessiveLinesLimits.__repr__·   s   € ØE¨$¬+ÐEÐE¸¼	ÐEÐEÐEÐEr1   N)rh   r%   ri   r%   r<   r=   )r<   r%   )rn   r%   r<   r=   rc   )r,   r-   r.   rB   rC   rA   Úpropertyrh   ri   Úsetterr_   r0   r1   r2   r4   r4   Ÿ   sµ   € € € € € ðð ð
 #€Ið$ð $ð $ð $ð ðð ð ñ „Xðð ðð ð ñ „Xðð 	„Zðð ð ñ „ZððFð Fð Fð Fð Fð Fr1   c                  óH   — e Zd ZU dZded<   ded<   dd„Zdd„Zdd„Zdd„ZdS )rD   zEIndices in both linesets that mark the beginning of successive lines.r$   Úfst_lineset_indexÚsnd_lineset_indexr<   r)   c                ó(   — d| j         › d| j        › d�S )Nz<LineSetStartCouple <rr   rs   )rw   rx   r\   s    r2   r_   zLineSetStartCouple.__repr__Á   s#   € àW DÔ$:ÐWÐW¸TÔ=SÐWÐWÐWð	
r1   Úotherr   rV   c                óz   — t          |t          ¦  «        st          S | j        |j        k    o| j        |j        k    S r?   )rX   rD   rY   rw   rx   ©r@   rz   s     r2   rZ   zLineSetStartCouple.__eq__Æ   sB   € Ý˜%Õ!3Ñ4Ô4ð 	"Ý!Ð!àÔ" eÔ&=Ò=ð BØÔ&¨%Ô*AÒAð	
r1   r;   c                óT   — t          | j        ¦  «        t          | j        ¦  «        z   S r?   )rP   rw   rx   r\   s    r2   r]   zLineSetStartCouple.__hash__Î   s#   € Ý�DÔ*Ñ+Ô+­d°4Ô3IÑ.JÔ.JÑJÐJr1   rn   c                óv   — t          t          | j        |z   ¦  «        t          | j        |z   ¦  «        ¦  «        S r?   )rD   r$   rw   rx   rp   s     r2   Ú	incrementzLineSetStartCouple.incrementÑ   s:   € Ý!Ý�$Ô(¨5Ñ0Ñ1Ô1Ý�$Ô(¨5Ñ0Ñ1Ô1ñ
ô 
ð 	
r1   Nrc   ©rz   r   r<   rV   rb   )rn   r$   r<   rD   )	r,   r-   r.   rB   r/   r_   rZ   r]   r   r0   r1   r2   rD   rD   »   sˆ   € € € € € € ØOÐOàÐÐÑØÐÐÑð
ð 
ð 
ð 
ð

ð 
ð 
ð 
ðKð Kð Kð Kð
ð 
ð 
ð 
ð 
ð 
r1   ÚLineSetÚlinesetÚmin_common_linesr;   r<   ú$tuple[HashToIndex_T, IndexToLines_T]c                óR  ‡— t          t          ¦  «        }i }t          d„ | j        D ¦   «         ¦  «        Šˆfd„t	          |¦  «        D ¦   «         }t          t          |Ž ¦  «        D ]½^}}t          | j        |         j        ¦  «        }	 | j        ||z            j        }n2# t          $ r% t          | j        d         j        dz   ¦  «        }Y nw xY wt          |¦  «        }	t          ||¬¦  «        ||	<   t          | j        |	g|¢R Ž }
||
                              |	¦  «         Œ¾||fS )a`  Return two dicts.

    The first associates the hash of successive stripped lines of a lineset
    to the indices of the starting lines.
    The second dict, associates the index of the starting line in the lineset's stripped lines to the
    couple [start, end] lines number in the corresponding file.

    :param lineset: lineset object (i.e the lines in a file)
    :param min_common_lines: number of successive lines that are used to compute the hash
    :return: a dict linking hashes to corresponding start index and a dict that links this
             index to the start and end lines in the file
    c              3  ó$   K  — | ]}|j         V — Œd S r?   )r*   )rQ   Úxs     r2   rS   zhash_lineset.<locals>.<genexpr>î   s$   è è € Ð9Ð9˜Q�!”&Ð9Ð9Ð9Ð9Ð9Ð9r1   c                ó>   •— g | ]}t          ‰|d …         ¦  «        ‘ŒS r?   )Úiter)rQ   ÚirL   s     €r2   ú
<listcomp>z hash_lineset.<locals>.<listcomp>ð   s'   ø€ ÐFÐFÐF¨•T˜%   œ)‘_”_ÐFÐFÐFr1   éÿÿÿÿé   )rh   ri   )r   ÚlistÚtupleÚstripped_linesÚrangeÚ	enumerateÚzipr%   r(   Ú
IndexErrorr$   r4   r3   ÚnameÚappend)r‚   rƒ   Ú
hash2indexÚindex2linesÚshifted_linesrŠ   Ú
succ_linesÚstart_linenumberÚend_linenumberÚindexÚl_crL   s              @r2   Úhash_linesetrŸ   Û   s^  ø€ õ �TÑ"Ô"€JØ€Kõ Ð9Ð9 'Ô"8Ð9Ñ9Ô9Ñ9Ô9€EàFÐFÐFÐF­eÐ4DÑ.EÔ.EÐFÑFÔF€Må#¥C¨Ð$7Ñ8Ô8ð &ð &ˆˆˆJÝ% gÔ&<¸QÔ&?Ô&KÑLÔLÐð	TØ$Ô3°AÐ8HÑ4HÔIÔUˆNˆNøÝð 	Tð 	Tð 	TÝ'¨Ô(>¸rÔ(BÔ(NÐQRÑ(RÑSÔSˆNˆNˆNð	Tøøøõ �a‘”ˆÝ2Ø"¨ð
ñ 
ô 
ˆ�EÑõ ˜œ uÐ:¨zÐ:Ð:Ð:ˆØ�3Œ×Ò˜uÑ%Ô%Ð%Ð%à�{Ð"Ð"s   ÂB!Â!,CÃCÚall_couplesÚCplIndexToCplLines_Tr=   c                ó  — t          |                      ¦   «         ¦  «        D ]ê}g }|                     t          d¦  «        ¦  «        }|| v r•| |         j        j        | |         j        _        | |         j        j        | |         j        _        | |         xj        dz  c_        |                     |¦  «         |                     t          d¦  «        ¦  «        }|| v °•|D ](}	 |  	                    |¦  «         Œ# t          $ r Y Œ%w xY wŒëdS )a  Removes all successive entries in the dictionary in argument.

    :param all_couples: collection that has to be cleaned up from successive entries.
                        The keys are couples of indices that mark the beginning of common entries
                        in both linesets. The values have two parts. The first one is the couple
                        of starting and ending line numbers of common successive lines in the first file.
                        The second part is the same for the second file.

    For example consider the following dict:

    >>> all_couples
    {(11, 34): ([5, 9], [27, 31]),
     (23, 79): ([15, 19], [45, 49]),
     (12, 35): ([6, 10], [28, 32])}

    There are two successive keys (11, 34) and (12, 35).
    It means there are two consecutive similar chunks of lines in both files.
    Thus remove last entry and update the last line numbers in the first entry

    >>> remove_successive(all_couples)
    >>> all_couples
    {(11, 34): ([5, 10], [27, 32]),
     (23, 79): ([15, 19], [45, 49])}
    r�   N)r�   Úkeysr   r$   r8   ri   r9   r:   r–   ÚpopÚKeyError)r    ÚcoupleÚ	to_removeÚtestÚtargets        r2   Úremove_successiverª     s1  € õ4 ˜×(Ò(Ñ*Ô*Ñ+Ô+ð ð ˆØˆ	Ø×Ò¥ a¡¤Ñ)Ô)ˆØ�kÐ!Ð!Ø1<¸TÔ1BÔ1MÔ1QˆK˜ÔÔ*Ô.Ø2=¸dÔ2CÔ2OÔ2SˆK˜ÔÔ+Ô/Ø˜ÔÐ6Ô6¸!Ñ;Ð6Ô6Ø×Ò˜TÑ"Ô"Ð"Ø—>’>¥%¨¡(¤(Ñ+Ô+ˆDð �kÐ!Ð!ð  ð 	ð 	ˆFðØ—’ Ñ'Ô'Ð'Ð'øÝð ð ð Ø�ðøøøð	ðð s   Ã&C<Ã<
D	ÄD	Úls_1Ú	stindex_1Úls_2Ú	stindex_2Úcommon_lines_nbc                óÀ   — d„ | j         |||z   …         D ¦   «         }d„ |j         |||z   …         D ¦   «         }t          d„ t          ||¦  «        D ¦   «         ¦  «        S )a|  Return the effective number of common lines between lineset1
    and lineset2 filtered from non code lines.

    That is to say the number of common successive stripped
    lines except those that do not contain code (for example
    a line with only an ending parenthesis)

    :param ls_1: first lineset
    :param stindex_1: first lineset starting index
    :param ls_2: second lineset
    :param stindex_2: second lineset starting index
    :param common_lines_nb: number of common successive stripped lines before being filtered from non code lines
    :return: the number of common successive stripped lines that contain code
    c                óZ   — g | ](}t                                |j        ¦  «        ¯!|j        ‘Œ)S r0   ©ÚREGEX_FOR_LINES_WITH_CONTENTÚmatchr*   ©rQ   Úlspecifs     r2   r‹   z(filter_noncode_lines.<locals>.<listcomp>D  ó@   € ð ð ð àÝ'×-Ò-¨g¬lÑ;Ô;ðØŒðð ð r1   c                óZ   — g | ](}t                                |j        ¦  «        ¯!|j        ‘Œ)S r0   r²   rµ   s     r2   r‹   z(filter_noncode_lines.<locals>.<listcomp>I  r·   r1   c              3  ó(   K  — | ]\  }}||k    V — Œd S r?   r0   )rQ   Úsline_1Úsline_2s      r2   rS   z'filter_noncode_lines.<locals>.<genexpr>N  s,   è è € ÐXÐXÑ&6 g¨wˆw˜'Ò!ÐXÐXÐXÐXÐXÐXr1   )r�   rT   r“   )r«   r¬   r­   r®   r¯   Ústripped_l1Ústripped_l2s          r2   Úfilter_noncode_linesr¾   /  s‹   € ð*ð àÔ*¨9°yÀ?Ñ7RÐ+RÔSðñ ô €Kð
ð àÔ*¨9°yÀ?Ñ7RÐ+RÔSðñ ô €Kõ
 ÐXÐX½#¸kÈ;Ñ:WÔ:WÐXÑXÔXÑXÔXÐXr1   c                  óV   — e Zd ZU ded<   ded<   ded<   ded<   ded<   ded	<   ded
<   dS )ÚCommonalityr;   Úcmn_lines_nbr�   Úfst_lsetr%   Úfst_file_startÚfst_file_endÚsnd_lsetÚsnd_file_startÚsnd_file_endNr+   r0   r1   r2   rÀ   rÀ   Q  sf   € € € € € € ØÐÐÑØÐÐÑØÐÐÑØÐÐÑØÐÐÑØÐÐÑØÐÐÑÐÐr1   rÀ   c                  ór   — e Zd ZdZeddddfd&d„Z	 d'd(d„Zd)d„Zd*d„Zd+d„Z	d,d„Z
d-d„Zd.d „Zd/d"„Zd0d%„ZdS )1ÚSimilarz-Finds copy-pasted lines of code in a project.FÚ	min_linesr;   Úignore_commentsrV   Úignore_docstringsÚignore_importsÚignore_signaturesr<   r=   c                ó
  — t          | t          ¦  «        r| j        j        | _        nt          j        ¦   «         | _        || j        _        || j        _        || j        _	        || j        _
        || j        _        g | _        d S r?   )rX   r   ÚlinterÚconfigÚ	namespaceÚargparseÚ	NamespaceÚmin_similarity_linesrË   rÌ   rÍ   rÎ   Úlinesets)r@   rÊ   rË   rÌ   rÍ   rÎ   s         r2   rA   zSimilar.__init__^  sq   € õ �d�KÑ(Ô(ð 	2Ø!œ[Ô/ˆDŒNˆNå%Ô/Ñ1Ô1ˆDŒNà.7ˆŒÔ+Ø)8ˆŒÔ&Ø+<ˆŒÔ(Ø(6ˆŒÔ%Ø+<ˆŒÔ(Ø')ˆŒˆˆr1   NÚstreamidr)   ÚstreamÚSTREAM_TYPESÚencodingú
str | Nonec                óœ  — t          |t          ¦  «        r|€t          ‚t          ||¦  «        j        }n|j        }	  |¦   «         }n# t
          $ r g }Y nw xY w| j                             t          ||| j	        j
        | j	        j        | j	        j        | j	        j        t          | d¦  «        r| j        j        nd¬¦  «        ¦  «         dS )z)Append a file to search for similarities.NrÐ   ©Úline_enabled_callback)rX   r
   Ú
ValueErrorr!   Ú	readlinesÚUnicodeDecodeErrorrÖ   r–   r�   rÒ   rË   rÌ   rÍ   rÎ   ÚhasattrrÐ   Ú_is_one_message_enabled)r@   r×   rØ   rÚ   rà   rL   s         r2   Úappend_streamzSimilar.append_streams  sõ   € õ �f�nÑ-Ô-ð 	)ØÐÝ Ð Ý'¨°Ñ9Ô9ÔCˆIˆIð Ô(ˆIð	Ø�I‘K”KˆEˆEøÝ!ð 	ð 	ð 	ØˆEˆEˆEð	øøøð 	Œ×ÒÝØØØ”Ô.Ø”Ô0Ø”Ô-Ø”Ô0õ ˜t XÑ.Ô.ð�D”KÔ7Ð7àðñ ô ñ	
ô 	
ð 	
ð 	
ð 	
s   ½
A ÁAÁAc                óx   — | j         j        dk    rdS |                      |                      ¦   «         ¦  «         dS )z=Start looking for similarities and display results on stdout.r   N)rÒ   rÕ   Ú_display_simsÚ_compute_simsr\   s    r2   ÚrunzSimilar.run”  s=   € àŒ>Ô.°!Ò3Ð3ØˆFØ×Ò˜4×-Ò-Ñ/Ô/Ñ0Ô0Ð0Ð0Ð0r1   ú)list[tuple[int, set[LinesChunkLimits_T]]]c                óò  — t          t          ¦  «        }|                      ¦   «         D ]m}|j        }|j        }|j        }|j        }|j        }|j        }|j	        }	||         }
|
D ]}|||f|v s|||	f|v r nŒ|
 
                    |||f|||	fh¦  «         Œng }|                     ¦   «         D ]!\  }}|D ]}| 
                    ||f¦  «         ŒŒ"|                     ¦   «          |                     ¦   «          |S )z'Compute similarities in appended files.)r   rŽ   Ú
_iter_simsrÁ   rÂ   rÃ   rÄ   rÅ   rÆ   rÇ   r–   ÚitemsÚsortÚreverse)r@   Úno_duplicatesÚcommonalityÚnumÚlineset1Ústart_line_1Ú
end_line_1Úlineset2Ústart_line_2Ú
end_line_2Ú	duplicateÚcouplesÚsimsÚ	ensemblesÚcplss                  r2   rç   zSimilar._compute_simsš  s^  € åBMÍdÑBSÔBSˆàŸ?š?Ñ,Ô,ð 	ð 	ˆKØÔ*ˆCØ"Ô+ˆHØ&Ô5ˆLØ$Ô1ˆJØ"Ô+ˆHØ&Ô5ˆLØ$Ô1ˆJà% cÔ*ˆIà$ð ð �Ø˜l¨JÐ7¸7ÐBÐBØØ ØðGð ð	Gð Gð
 �EðGð × Ò à! <°Ð<Ø! <°Ð<ðñô ð øð ;=ˆà+×1Ò1Ñ3Ô3ð 	)ð 	)‰NˆC�à!ð )ð )�Ø—’˜S $˜KÑ(Ô(Ð(Ð(ð)à�	Š	‰ŒˆØ�Š‰ŒˆØˆr1   Úsimilaritiesc                óN   — |                       |¦  «        }t          |¦  «         dS )z(Display computed similarities on stdout.N)Ú_get_similarity_reportÚprint)r@   rý   Úreports      r2   ræ   zSimilar._display_simsÁ  s&   € ð ×,Ò,¨\Ñ:Ô:ˆÝˆf‰Œˆˆˆr1   c           
     óÖ  — d}d}|D ]­\  }}|d|› dt          |¦  «        › d�z  }t          |¦  «        }dx}x}}	|D ]\  }}}	|d|j        › d|› d	|	› d
�z  }Œ|rC|j        ||	…         D ]3}
||
                     ¦   «         rd|
                     ¦   «         › d�ndz  }Œ4||t          |¦  «        dz
  z  z  }Œ®t          d„ | j        D ¦   «         ¦  «        }|d|› d|› d|dz  |z  d›d�z  }|S )z"Create a report from similarities.Ú r   ú
z similar lines in z files
Nú==ú:[ú:z]
z   r�   c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r?   ©Úlen©rQ   r‚   s     r2   rS   z1Similar._get_similarity_report.<locals>.<genexpr>Ø  s(   è è € Ð$OÐ$O°g¥S¨¡\¤\Ð$OÐ$OÐ$OÐ$OÐ$OÐ$Or1   zTOTAL lines=z duplicates=z	 percent=ç      Y@z.2f)r
  Úsortedr•   Ú_real_linesÚrstriprT   rÖ   )r@   rý   r  Úduplicated_line_numberÚnumberrù   Ú	couples_lÚline_setÚ
start_lineÚend_lineÚlineÚtotal_line_numbers               r2   rÿ   zSimilar._get_similarity_reportÈ  s’  € ð ˆØ&'ÐØ+ð 		Dð 		D‰OˆF�GØÐK˜6ÐKÐKµS¸±\´\ÐKÐKÐKÑKˆFÝ˜w™œˆIØ/3Ð3ˆHÐ3�z HØ2;ð Kð KÑ.�˜* hØÐJ˜xœ}ÐJÐJ°
ÐJÐJ¸XÐJÐJÐJÑJ��Øð QØ$Ô0°¸HÐ1DÔEð Qð Q�DØ¸¿º¹¼ÐPÐ5 D§K¢K¡M¤MÐ5Ð5Ð5Ð5ÈDÑP�F�FØ" fµ°I±´ÀÑ0BÑ&CÑCÐ"Ð"Ý!$Ð$OÐ$OÀÄÐ$OÑ$OÔ$OÑ!OÔ!OÐØðRÐ,ð Rð RØ0ðRð Rà-°Ñ5Ð8IÑIÐQðRð Rð Rñ	
ˆð
 ˆr1   rò   r�   rõ   ú"Generator[Commonality, None, None]c           
   #  óê  ‡K  — t          || j        j        ¦  «        \  Š}t          || j        j        ¦  «        \  }}t          ‰                     ¦   «         ¦  «        }t          |                     ¦   «         ¦  «        }t          ||z  ˆfd„¬¦  «        }i }	t          |t          j        d¦  «        ¬¦  «        D ]“}
t          j	        ‰|
         ||
         ¦  «        D ]o}|d         }|d         }t          t          j        ||         ¦  «        t          j        ||         ¦  «        | j        j        ¬¦  «        |	t          ||¦  «        <   ŒpŒ”t          |	¦  «         |	                     ¦   «         D ]\  }}|j        }|j        }|j        }t%          |||j        j        |j        j        ||j        j        |j        j        ¬¦  «        }t/          |||||¦  «        }|| j        j        k    r|V — Œ€dS )	at  Find similarities in the two given linesets.

        This the core of the algorithm. The idea is to compute the hashes of a
        minimal number of successive lines of each lineset and then compare the
        hashes. Every match of such comparison is stored in a dict that links the
        couple of starting indices in both linesets to the couple of corresponding
        starting and ending lines in both files.

        Last regroups all successive couples in a bigger one. It allows to take into
        account common chunk of lines that have more than the minimal number of
        successive lines required.
        c                ó    •— ‰|          d         S )Nr   r0   )ÚmÚhash_to_index_1s    €r2   ú<lambda>z&Similar._find_common.<locals>.<lambda>ÿ  s   ø€ ¨?¸1Ô+=¸aÔ+@€ r1   )ÚkeyrH   r   r�   )r:   )rÁ   rÂ   rÃ   rÄ   rÅ   rÆ   rÇ   N)rŸ   rÒ   rÕ   Ú	frozensetr£   r  ÚoperatorÚ
attrgetterÚ	itertoolsÚproductr6   ÚcopyrD   rª   rì   rw   rx   r:   rÀ   r8   rh   ri   r9   r¾   )r@   rò   rõ   Úindex_to_lines_1Úhash_to_index_2Úindex_to_lines_2Úhash_1Úhash_2Úcommon_hashesr    Úc_hashÚindices_in_linesetsÚindex_1Úindex_2Úcml_stripped_lÚcmn_lÚstart_index_1Ústart_index_2Únb_common_linesÚcomÚ
eff_cmn_nbr  s                        @r2   Ú_find_commonzSimilar._find_commoná  s<  øè è € õ& -9Ø�d”nÔ9ñ-
ô -
Ñ)ˆÐ)õ -9Ø�d”nÔ9ñ-
ô -
Ñ)ˆÐ)õ )2°/×2FÒ2FÑ2HÔ2HÑ(IÔ(IˆÝ(1°/×2FÒ2FÑ2HÔ2HÑ(IÔ(Iˆå.4Ø�V‰OÐ!@Ð!@Ð!@Ð!@ð/
ñ /
ô /
ˆð -/ˆå˜]µÔ0CÀHÑ0MÔ0MÐNÑNÔNð 	ð 	ˆFÝ'0Ô'8Ø Ô'¨¸Ô)@ñ(ô (ð ð Ð#ð .¨aÔ0�Ø-¨aÔ0�å,Ýœ	Ð"2°7Ô";Ñ<Ô<Ýœ	Ð"2°7Ô";Ñ<Ô<Ø/3¬~Ô/Rðñ ô ð Õ.¨w¸Ñ@Ô@ÑAÐAðõ 	˜+Ñ&Ô&Ð&à%0×%6Ò%6Ñ%8Ô%8ð 	ð 	Ñ!ˆN˜EØ*Ô<ˆMØ*Ô<ˆMØ#Ô:ˆOåØ,Ø!Ø$Ô/Ô5Ø"Ô-Ô1Ø!Ø$Ô0Ô6Ø"Ô.Ô2ðñ ô ˆCõ .Ø˜-¨°=À/ñô ˆJð ˜DœNÔ?Ò?Ð?Ø�	�	�	øð)	ð 	r1   c              #  ó°   K  — t          | j        dd…         ¦  «        D ]6\  }}| j        |dz   d…         D ]}|                      ||¦  «        E d{V —† ŒŒ7dS )zXIterate on similarities among all files, by making a Cartesian
        product.
        NrŒ   r�   )r’   rÖ   r6  )r@   Úidxr‚   rõ   s       r2   rë   zSimilar._iter_sims,  s�   è è € õ & d¤m°C°R°CÔ&8Ñ9Ô9ð 	@ð 	@‰LˆC�Ø œM¨#°©'¨)¨)Ô4ð @ð @�Ø×,Ò,¨W°hÑ?Ô?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?ð@ð	@ð 	@r1   úlist[LineSet]c                ó   — | j         S )zÏReturns the data we can use for a map/reduce process.

        In this case we are returning this instance's Linesets, that is all file
        information that will later be used for vectorisation.
        ©rÖ   r\   s    r2   Úget_map_datazSimilar.get_map_data4  s   € ð Œ}Ðr1   Úlinesets_collectionúlist[list[LineSet]]c                ó(   — d„ |D ¦   «         | _         dS )zyReduces and recombines data into a format that we can report on.

        The partner function of get_map_data()
        c                ó   — g | ]	}|D ]}|‘ŒŒ
S r0   r0   )rQ   r‚   r  s      r2   r‹   z2Similar.combine_mapreduce_data.<locals>.<listcomp>A  s%   € ÐUÐUÐU 'ÈWÐUÐUÀT˜ÐUÐUÐUÐUr1   Nr;  )r@   r=  s     r2   Úcombine_mapreduce_datazSimilar.combine_mapreduce_data<  s   € ð
 VÐUÐ-@ÐUÑUÔUˆŒˆˆr1   )rÊ   r;   rË   rV   rÌ   rV   rÍ   rV   rÎ   rV   r<   r=   r?   )r×   r)   rØ   rÙ   rÚ   rÛ   r<   r=   ©r<   r=   )r<   ré   )rý   ré   r<   r=   )rý   ré   r<   r)   )rò   r�   rõ   r�   r<   r  )r<   r  ©r<   r9  )r=  r>  r<   r=   )r,   r-   r.   rB   ÚDEFAULT_MIN_SIMILARITY_LINErA   rä   rè   rç   ræ   rÿ   r6  rë   r<  rA  r0   r1   r2   rÉ   rÉ   [  s  € € € € € Ø7Ð7ð 5Ø %Ø"'Ø$Ø"'ð*ð *ð *ð *ð *ð, KOð
ð 
ð 
ð 
ð 
ðB1ð 1ð 1ð 1ð%ð %ð %ð %ðNð ð ð ðð ð ð ð2Ið Ið Ið IðV@ð @ð @ð @ðð ð ð ðVð Vð Vð Vð Vð Vr1   rÉ   rL   rM   rË   rV   rÌ   rÍ   rÎ   rÞ   ú!Callable[[str, int], bool] | Noneúlist[LineSpecifs]c           
     óN  ‡— |s|r't          j        d                     | ¦  «        ¦  «        }|r\i }|                     t          j        t          j        f¦  «        D ].}t          |j        |j	        p|j        dz   ¦  «        D ]}	d||	<   ŒŒ/|r2dˆfd	„Š ‰g |¦  «        }
t          t          d
„ |
D ¦   «         Ž ¦  «        }g }d}t          | d¬¦  «        D �]O\  }	}|� |d|	¦  «        sŒ|                     ¦   «         }|rš|s}|                     d¦  «        s|                     d¦  «        r|dd…         }|dd…         }n>|                     d¦  «        s|                     d¦  «        r|dd…         }|dd…         }|r|                     |¦  «        rd}d}|r|                     |	d¦  «        }|rd}|r.|                     dd¦  «        d                              ¦   «         }|r|	|v rd}|r4|                     t'          |t)          |	dz
  ¦  «        ¬¦  «        ¦  «         �ŒQ|S )aû  Return tuples of line/line number/line type with leading/trailing white-space and
    any ignored code features removed.

    :param lines: a collection of lines
    :param ignore_comments: if true, any comment in the lines collection is removed from the result
    :param ignore_docstrings: if true, any line that is a docstring is removed from the result
    :param ignore_imports: if true, any line that is an import is removed from the result
    :param ignore_signatures: if true, any line that is part of a function signature is removed from the result
    :param line_enabled_callback: If called with "R0801" and a line number, a return value of False will disregard
           the line
    :return: the collection of line/line number/line type tuples
    r  r�   TÚ	functionsúlist[nodes.NodeNG]Útreeúnodes.NodeNGr<   c                ó  •— |j         D ]z}t          |t          j        t          j        f¦  «        r|                      |¦  «         t          |t          j        t          j        t          j        f¦  «        r ‰| |¦  «         Œ{| S )zeRecursively get all functions including nested in the classes from the
            tree.
            )ÚbodyrX   r   ÚFunctionDefÚAsyncFunctionDefr–   ÚClassDef)rH  rJ  ÚnodeÚ_get_functionss      €r2   rR  z&stripped_lines.<locals>._get_functionsa  s‰   ø€ ð œ	ð 4ð 4�Ý˜d¥UÔ%6½Ô8NÐ$OÑPÔPð +Ø×$Ò$ TÑ*Ô*Ð*åØÝ”^¥UÔ%6½Ô8NÐOñô ð 4ð #�N 9¨dÑ3Ô3Ð3øàÐr1   c              3  ó‚   K  — | ]:}t          |j        |j        r|j        d          j        n	|j        dz   ¦  «        V — Œ;dS )r   r�   N)r‘   ÚlinenorM  Útolineno)rQ   Úfuncs     r2   rS   z!stripped_lines.<locals>.<genexpr>w  sf   è è € ð ð ð
 õ	 ØœØ/3¬yÐO˜œ	 !œÔ+Ð+¸d¼mÈaÑ>Oñô ðð ð ð ð ð r1   N)rh   ÚR0801z"""z'''é   zr"""zr'''r#   Fú#r   )r*   r(   )rH  rI  rJ  rK  r<   rI  )ÚastroidÚparseÚjoinÚnodes_of_classr   ÚImportÚ
ImportFromr‘   rT  Ú
end_linenoÚsetr   r’   ÚstripÚ
startswithÚendswithÚgetÚsplitr–   r'   r%   )rL   rË   rÌ   rÍ   rÎ   rÞ   rJ  Úimport_linesrQ  rT  rH  Úsignature_linesÚstrippedlinesÚ	docstringr  Úcurrent_line_is_importrR  s                   @r2   r�   r�   D  sÕ  ø€ ð( ð -Ð*ð -ÝŒ}˜RŸWšW U™^œ^Ñ,Ô,ˆØð ,ØˆØ×'Ò'­¬µuÔ7GÐ(HÑIÔIð 	,ð 	,ˆDÝ ¤¨d¬oÐ.LÀÄÐPQÑ-QÑRÔRð ,ð ,�Ø'+�˜VÑ$Ð$ð,àð  
ð	ð 	ð 	ð 	ð 	ð 	ð& #�N 2 tÑ,Ô,ˆ	ÝÝðð ð
 !*ðñ ô ðñ

ô 

ˆð €MØ€IÝ! %¨qÐ1Ñ1Ô1ð ñ ‰ˆ�Ø Ð,Ð5JÐ5JØ�Vñ6
ô 6
Ð,ð Ø�zŠz‰|Œ|ˆØð 	Øð $Ø—?’? 5Ñ)Ô)ð $¨T¯_ª_¸UÑ-CÔ-Cð $Ø $ R a R¤�IØ   œ8�D�DØ—_’_ VÑ,Ô,ð $°·²ÀÑ0GÔ0Gð $Ø $ Q q S¤	�IØ   œ8�DØð Ø—=’= Ñ+Ô+ð %Ø $�IØ�Øð 	Ø%1×%5Ò%5°f¸eÑ%DÔ%DÐ"Ø%ð Ø�Øð 	1Ø—:’:˜c 1Ñ%Ô% aÔ(×.Ò.Ñ0Ô0ˆDØð 	 ¨?Ð!:Ð!:ØˆDØð 	Ø× Ò Ý µ:¸fÀq¹jÑ3IÔ3IÐJÑJÔJñô ð ùð Ðr1   c                  ó†   — e Zd ZdZ	 	 	 	 	 d d!d„Zd"d„Zd#d„Zd$d„Zd%d„Zd#d„Z	d&d„Z
ed'd„¦   «         Zed(d„¦   «         ZdS ))r�   zâHolds and indexes all the lines of a single source file.

    Allows for correspondence between real lines of the source file and stripped ones, which
    are the real ones from which undesired patterns have been removed.
    FNr•   r)   rL   ú	list[str]rË   rV   rÌ   rÍ   rÎ   rÞ   rE  r<   r=   c                óV   — || _         || _        t          ||||||¬¦  «        | _        d S )NrÝ   )r•   r  r�   Ú_stripped_lines)r@   r•   rL   rË   rÌ   rÍ   rÎ   rÞ   s           r2   rA   zLineSet.__init__¬  sB   € ð ˆŒ	Ø ˆÔÝ-ØØØØØØ"7ð 
ñ  
ô  
ˆÔÐÐr1   c                ó   — d| j         › d�S )Nz<Lineset for ú>©r•   r\   s    r2   ra   zLineSet.__str__Á  s   € Ø+˜tœyÐ+Ð+Ð+Ð+r1   r;   c                ó*   — t          | j        ¦  «        S r?   )r
  r  r\   s    r2   Ú__len__zLineSet.__len__Ä  s   € Ý�4Ô#Ñ$Ô$Ð$r1   r�   r'   c                ó   — | j         |         S r?   ©ro  )r@   r�   s     r2   Ú__getitem__zLineSet.__getitem__Ç  s   € ØÔ# EÔ*Ð*r1   rz   c                ó"   — | j         |j         k     S r?   rr  r|   s     r2   Ú__lt__zLineSet.__lt__Ê  s   € ØŒy˜5œ:Ò%Ð%r1   c                ó    — t          | ¦  «        S r?   )Úidr\   s    r2   r]   zLineSet.__hash__Í  s   € Ý�$‰xŒxˆr1   r   c                óP   — t          |t          ¦  «        sdS | j        |j        k    S )NF)rX   r�   Ú__dict__r|   s     r2   rZ   zLineSet.__eq__Ð  s(   € Ý˜%¥Ñ)Ô)ð 	Ø�5ØŒ} ¤Ò.Ð.r1   rF  c                ó   — | j         S r?   rv  r\   s    r2   r�   zLineSet.stripped_linesÕ  s   € àÔ#Ð#r1   c                ó   — | j         S r?   )r  r\   s    r2   Ú
real_lineszLineSet.real_linesÙ  s   € àÔÐr1   )FFFFN)r•   r)   rL   rm  rË   rV   rÌ   rV   rÍ   rV   rÎ   rV   rÞ   rE  r<   r=   rc   rb   )r�   r;   r<   r'   )rz   r�   r<   rV   r€   )r<   rF  )r<   rm  )r,   r-   r.   rB   rA   ra   rt  rw  ry  r]   rZ   rt   r�   r€  r0   r1   r2   r�   r�   ¤  s   € € € € € ðð ð !&Ø"'Ø$Ø"'ØCGð
ð 
ð 
ð 
ð 
ð*,ð ,ð ,ð ,ð%ð %ð %ð %ð+ð +ð +ð +ð&ð &ð &ð &ðð ð ð ð/ð /ð /ð /ð
 ð$ð $ð $ñ „Xð$ð ð ð  ð  ñ „Xð ð  ð  r1   rW  )zSimilar lines in %s files
%szduplicate-codez�Indicates that a set of similar lines has been detected among multiple file. This usually means that the code should be refactored to avoid this duplication.z!dict[str, MessageDefinitionTuple]ÚMSGSÚsectr   Ústatsr    Ú	old_statsúLinterStats | Nonec                ó‚   — g d¢}|t          ||d¦  «        z  }|                      t          |ddd¬¦  «        ¦  «         dS )z0Make a layout with some stats about duplication.)r  ÚnowÚpreviousÚ
differenceÚduplicated_linesr#   r�   )ÚchildrenÚcolsÚrheadersÚcheadersN)r   r–   r   )r‚  rƒ  r„  rL   s       r2   Úreport_similaritiesr�  é  sP   € ð 2Ð1Ð1€EØ	Õ# E¨9Ð6HÑIÔIÑI€EØ‡K‚K•˜u¨1°qÀ1ÐEÑEÔEÑFÔFÐFÐFÐFr1   c            
      ó¶   — e Zd ZU dZdZeZdeddddœfdd	d
dddœfdd	d
dddœfdd	d
dddœfdd	d
dddœffZde	d<   dde
ffZd'd„Zd(d„Zd)d„Zd(d „Zd*d"„Zd+d%„Zd&S ),ÚSimilarCheckerz¤Checks for similarities and duplicated code.

    This computation may be memory / CPU intensive, so you
    should disable it if you experience some problems.
    rý   zmin-similarity-linesr;   z<int>z%Minimum lines number of a similarity.)ÚdefaultÚtypeÚmetavarÚhelpúignore-commentsTÚynz<y or n>z4Comments are removed from the similarity computationúignore-docstringsz6Docstrings are removed from the similarity computationúignore-importsz3Imports are removed from the similarity computationúignore-signaturesz6Signatures are removed from the similarity computationr   ÚoptionsÚRP0801ÚDuplicationrÐ   r"   r<   r=   c                ó  — t          j        | |¦  «         t                               | | j        j        j        | j        j        j        | j        j        j        | j        j        j        | j        j        j	        ¬¦  «         d S )N)rÊ   rË   rÌ   rÍ   rÎ   )
r   rA   rÉ   rÐ   rÑ   rÕ   rË   rÌ   rÍ   rÎ   )r@   rÐ   s     r2   rA   zSimilarChecker.__init__4  sv   € ÝÔ# D¨&Ñ1Ô1Ð1Ý×ÒØØ”kÔ(Ô=Ø œKÔ.Ô>Ø"œkÔ0ÔBØœ;Ô-Ô<Ø"œkÔ0ÔBð 	ñ 	
ô 	
ð 	
ð 	
ð 	
r1   c                óP   — g | _         | j        j                             ¦   «          dS )z=Init the checkers: reset linesets and statistics information.N)rÖ   rÐ   rƒ  Úreset_duplicated_linesr\   s    r2   ÚopenzSimilarChecker.open?  s&   € àˆŒØŒÔ×0Ò0Ñ2Ô2Ð2Ð2Ð2r1   rQ  únodes.Modulec                óü   — | j         j        €t          j        dt          d¬¦  «         |                     ¦   «         5 }|                      | j         j        ||j        ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )z�Process a module.

        the module's content is accessible via the stream object

        stream must implement the readlines method
        Nz‰In pylint 3.0 the current_name attribute of the linter object should be a string. If unknown it should be initialized as an empty string.é   )Ú
stacklevel)rÐ   Úcurrent_nameÚwarningsÚwarnÚDeprecationWarningrØ   rä   Úfile_encoding)r@   rQ  rØ   s      r2   Úprocess_modulezSimilarChecker.process_moduleD  sÚ   € ð Œ;Ô#Ð+åŒMðNõ #Øðñ ô ð ð �[Š[‰]Œ]ð 	U˜fØ×Ò˜tœ{Ô7¸ÀÔASÑTÔTÐTð	Uð 	Uð 	Uñ 	Uô 	Uð 	Uð 	Uð 	Uð 	Uð 	Uð 	Uð 	Uøøøð 	Uð 	Uð 	Uð 	Uð 	Uð 	Us   ½'A1Á1A5Á8A5c                óÀ  — t          d„ | j        D ¦   «         ¦  «        }d}| j        j        }|                      ¦   «         D ]Ú\  }}g }dx}x}}	|D ]*\  }}}	|                     d|j        › d|› d|	› d�¦  «         Œ+|                     ¦   «          |r9|j        ||	…         D ])}
|                     |
 	                    ¦   «         ¦  «         Œ*|  
                    dt          |¦  «        d	                     |¦  «        f¬
¦  «         ||t          |¦  «        dz
  z  z  }ŒÛ|xj        t          |¦  «        z  c_        |xj        t!          |o|dz  |z  ¦  «        z  c_        dS )zBCompute and display similarities on closing (i.e. end of parsing).c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r?   r	  r  s     r2   rS   z'SimilarChecker.close.<locals>.<genexpr>Z  s(   è è € Ð>Ð> W•C˜‘L”LÐ>Ð>Ð>Ð>Ð>Ð>r1   r   Nr  r  r  ú]rW  r  )Úargsr�   r  )rT   rÖ   rÐ   rƒ  rç   r–   r•   rí   r€  r  Úadd_messager
  r\  Únb_duplicated_linesr;   Úpercent_duplicated_linesÚfloat)r@   ÚtotalÚ
duplicatedrƒ  rñ   rù   Úmsgr‚   r  r  r  s              r2   ÚclosezSimilarChecker.closeX  s�  € åÐ>Ð>°´Ð>Ñ>Ô>Ñ>Ô>ˆØˆ
Ø”Ô!ˆØ ×.Ò.Ñ0Ô0ð 	3ð 	3‰LˆC�ØˆCØ.2Ð2ˆGÐ2�j 8Ø18ð Jð JÑ-�˜ XØ—
’
ÐH ¤ÐHÐH°
ÐHÐH¸XÐHÐHÐHÑIÔIÐIÐIØ�HŠH‰JŒJˆJàð .Ø#Ô.¨z¸(Ð/BÔCð .ð .�DØ—J’J˜tŸ{š{™}œ}Ñ-Ô-Ð-Ð-à×Ò˜W­C°©L¬L¸$¿)º)ÀC¹.¼.Ð+IÐÑJÔJÐJØ˜#¥ W¡¤°Ñ!1Ñ2Ñ2ˆJˆJØÐ!Ô!¥S¨¡_¤_Ñ4Ð!Ô!ØÐ&Ô&­%°Ð0T¸*ÀuÑ:LÈuÑ:TÑ*UÔ*UÑUÐ&Ô&Ð&Ð&r1   r9  c                ó6   — t                                | ¦  «        S )zPassthru override.)rÉ   r<  r\   s    r2   r<  zSimilarChecker.get_map_datam  s   € å×#Ò# DÑ)Ô)Ð)r1   Údatar>  c                óf   — t                                | |¬¦  «         |                      ¦   «          dS )zÆReduces and recombines data into a format that we can report on.

        The partner function of get_map_data()

        Calls self.close() to actually calculate and report duplicate code.
        )r=  N)rÉ   rA  r·  )r@   rÐ   r¹  s      r2   Úreduce_map_datazSimilarChecker.reduce_map_dataq  s.   € õ 	×&Ò& tÀÐ&ÑFÔFÐFØ�
Š
‰Œˆˆˆr1   N©rÐ   r"   r<   r=   rB  )rQ  r¢  r<   r=   rC  )rÐ   r"   r¹  r>  r<   r=   )r,   r-   r.   rB   r•   r�  ÚmsgsrD  r›  r/   r�  ÚreportsrA   r¡  r«  r·  r<  r»  r0   r1   r2   r‘  r‘  õ  s{  € € € € € € ðð ð €Dà€Dð
 #à6ØØ"Ø?ð	ð ð	
ð àØØ%ØNð	ð ð	
ð  àØØ%ØPð	ð ð	
ð àØØ%ØMð	ð ð	
ð  àØØ%ØPð	ð ð	
ðK.€Gð .ð .ð .ñ .ð` ˜-Ð)<Ð=Ð?€Gð	
ð 	
ð 	
ð 	
ð3ð 3ð 3ð 3ð
Uð Uð Uð Uð(Vð Vð Vð Vð**ð *ð *ð *ðð ð ð ð ð r1   r‘  rÐ   r"   c                óJ   — |                       t          | ¦  «        ¦  «         d S r?   )Úregister_checkerr‘  )rÐ   s    r2   ÚregisterrÁ  |  s$   € Ø
×Ò�N¨6Ñ2Ô2Ñ3Ô3Ð3Ð3Ð3r1   Ústatusr   c                ó†   — t          d¦  «         t          ¦   «          t          d¦  «         t          j        | ¦  «         dS )z'Display command line usage information.z*finds copy pasted blocks in a set of filesz”Usage: symilar [-d|--duplicates min_duplicated_lines] [-i|--ignore-comments] [--ignore-docstrings] [--ignore-imports] [--ignore-signatures] file1...N)r   ÚsysÚexit)rÂ  s    r2   ÚusagerÆ  €  sJ   € å	Ð
6Ñ7Ô7Ð7Ý	�G„G€GÝ	ð	`ñô ð õ „HˆVÑÔÐÐÐr1   ÚargvúSequence[str] | Nonec                óR  — | €t           j        dd…         } d}g d¢}t          }d}d}d}d}t          t	          | ¦  «        ||¦  «        \  }}	|D ]G\  }
}|
dv rt          |¦  «        }Œ|
dv rt          ¦   «          Œ,|
dv rd	}Œ3|
d
v rd	}Œ:|
dv rd	}ŒA|
dv rd	}ŒH|	st          d¦  «         t          |||||¦  «        }|	D ]A}t          |d¬¦  «        5 }| 	                    ||¦  «         ddd¦  «         n# 1 swxY w Y   ŒB| 
                    ¦   «          t          j        d¦  «         dS )z%Standalone command line access point.Nr�   Úhdi)r•  zduplicates=r–  r™  r˜  rš  F>   ú-dú--duplicates>   ú-hú--help>   ú-iú--ignore-commentsT>   ú--ignore-docstrings>   ú--ignore-imports>   ú--ignore-signatureszutf-8)rÚ   r   )rÄ  rÇ  rD  r	   rŽ   r;   rÆ  rÉ   r¡  rä   rè   rÅ  )rÇ  Ús_optsÚl_optsrÊ   rË   rÌ   rÍ   rÎ   Úoptsr¯  ÚoptÚvalÚsimÚfilenamerØ   s                  r2   ÚRunrÛ  ‹  sÏ  € à€|ÝŒx˜˜˜Œ|ˆà€Fðð ð €Fõ ,€IØ€OØÐØ€NØÐÝ�˜T™
œ
 F¨FÑ3Ô3�J€Dˆ$Øð %ð %‰ˆˆSØÐ(Ð(Ð(Ý˜C™œˆIˆIØÐ$Ð$Ð$Ý‰GŒGˆGˆGØÐ/Ð/Ð/Ø"ˆOˆOØÐ+Ð+Ð+Ø $ÐÐØÐ(Ð(Ð(Ø!ˆNˆNØÐ+Ð+Ð+Ø $ÐøØð Ýˆa‰ŒˆÝ
Ø�?Ð$5°~ÐGXñô €Cð ð 0ð 0ˆÝ�( WÐ-Ñ-Ô-ð 	0°Ø×Ò˜h¨Ñ/Ô/Ð/ð	0ð 	0ð 	0ñ 	0ô 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0øøøð 	0ð 	0ð 	0ð 	0øà‡G‚G�I„I€IÝ„HˆQ�K„K€K€K€Ks   ÃC3Ã3C7	Ã:C7	Ú__main__)r‚   r�   rƒ   r;   r<   r„   )r    r¡   r<   r=   )r«   r�   r¬   r$   r­   r�   r®   r$   r¯   r;   r<   r;   r?   )rL   rM   rË   rV   rÌ   rV   rÍ   rV   rÎ   rV   rÞ   rE  r<   rF  )r‚  r   rƒ  r    r„  r…  r<   r=   r¼  )r   )rÂ  r;   r<   r   )rÇ  rÈ  r<   r   )TrB   Ú
__future__r   rÓ   r$  Ú	functoolsr"  r   ÚrerÄ  r§  Úcollectionsr   Úcollections.abcr   r   r   r   r	   Úior
   r   r   r   Útypingr   r   r   r   r   r   r   r   r   r   rZ  r   Úpylint.checkersr   r   r   Úpylint.reporters.ureports.nodesr   r   Úpylint.typingr   r   Úpylint.utilsr    r!   Úpylint.lintr"   rD  Úcompiler³   r;   r$   r%   r'   ÚHashToIndex_TÚIndexToLines_TrÙ   r6   r¡   r3   r4   rD   ÚLinesChunkLimits_TrŸ   rª   r¾   rÀ   rÉ   r�   Útotal_orderingr�   r�  r/   r�  r‘  rÁ  rÆ  rÛ  r,   r0   r1   r2   ú<module>rî     sf  ðð
ð ð ð2 #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø 
€
€
€
Ø €€€Ø #Ð #Ð #Ð #Ð #Ð #Ø CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CØ Ð Ð Ð Ð Ð Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð €€€Ø Ð Ð Ð Ð Ð à SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SØ :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5àð %Ø$Ð$Ð$Ð$Ð$Ð$àÐ à)˜rœz¨(Ñ3Ô3Ð ð 	ˆ�˜ÑÔ€ð ˆW�\ 3Ñ'Ô'€
ðð ð ð ð �*ñ ô ð ð �\ 4¨¤;Ð.Ô/€ð �eÐ4Ð4Ô5€ð �V˜^¨WÐ4Ô5€ð=ð =ð =ð =ð =ñ =ô =ð =ð( Ð0Ð2JÐJÔKÐ ð$
ð $
ð $
ð $
ð $
ñ $
ô $
ð $
ðNFð Fð Fð Fð Fñ Fô Fð Fð8
ð 
ð 
ð 
ð 
˜ñ 
ô 
ð 
ð: ˜9 j°*Ð<Ô=Ð ð /Jð&#ð &#ð &#ð &#ð &#ðR(ð (ð (ð (ðVYð Yð Yð YðDð ð ð ð �*ñ ô ð ðfVð fVð fVð fVð fVñ fVô fVð fVð^ @Dð]ð ]ð ]ð ]ð ]ð@ Ôð6 ð 6 ð 6 ð 6 ð 6 ñ 6 ô 6 ñ Ôð6 ðt ð ð+€ð ð ð ñ ðGð Gð Gð GðDð Dð Dð Dð DÐ'¨ñ Dô Dð DðN4ð 4ð 4ð 4ðð ð ð ð ð*ð *ð *ð *ð *ðZ ˆzÒÐØ€C�E„E€E€E€Eð Ðr1   