§
    (¶ÕiÂ'  ã                   óÂ   — d Z ddlZddlZddlmZ ddlmZ g d¢Zi ZdZ	g d¢Z
d„ Zdd
„Zd„ Zd„ Z G d„ d¦  «        Zdd„Zeefd„Zd„ Zd„ Zedk    r e¦   «          dS dS )z³Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=True) -> int
    cmpfiles(a, b, common) -> ([], [], [])
    clear_cache()

é    N)Úfilterfalse)ÚGenericAlias)Úclear_cacheÚcmpÚdircmpÚcmpfilesÚDEFAULT_IGNORESi    )ÚRCSÚCVSÚtagsz.gitz.hgz.bzrÚ_darcsÚ__pycache__c                  ó8   — t                                ¦   «          dS )zClear the filecmp cache.N)Ú_cacheÚclear© ó    ú/usr/lib/python3.11/filecmp.pyr   r      s   € å
‡L‚L�N„N€N€N€Nr   Tc                 óê  — t          t          j        | ¦  «        ¦  «        }t          t          j        |¦  «        ¦  «        }|d         t          j        k    s|d         t          j        k    rdS |r||k    rdS |d         |d         k    rdS t                               | |||f¦  «        }|€Dt          | |¦  «        }t          t          ¦  «        dk    rt          ¦   «          |t          | |||f<   |S )aM  Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- treat files as identical if their stat signatures (type, size,
               mtime) are identical. Otherwise, files are considered different
               if their sizes or contents differ.  [default: True]

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with cache entries invalidated if their stat information
    changes.  The cache may be cleared by calling clear_cache().

    r   FTé   Néd   )	Ú_sigÚosÚstatÚS_IFREGr   ÚgetÚ_do_cmpÚlenr   )Úf1Úf2ÚshallowÚs1Ús2Úoutcomes         r   r   r      sÜ   € õ. 
�bŒg�b‰kŒkÑ	Ô	€BÝ	�bŒg�b‰kŒkÑ	Ô	€BØ	ˆ!„u•”ÒÐ  1¤­¬Ò 5Ð 5ØˆuØð �2˜’8�8ØˆtØ	ˆ!„u��1”‚~€~Øˆuå�jŠj˜"˜b " bÐ)Ñ*Ô*€GØ€Ý˜"˜b‘/”/ˆÝ�v‰;Œ;˜ÒÐÝ‰MŒMˆMØ!(�ˆr�2�r˜2ˆ~ÑØ€Nr   c                 óN   — t          j        | j        ¦  «        | j        | j        fS ©N)r   ÚS_IFMTÚst_modeÚst_sizeÚst_mtime)Ústs    r   r   r   F   s%   € ÝŒK˜œ
Ñ#Ô#ØŒJØŒKðð r   c                 ój  — t           }t          | d¦  «        5 }t          |d¦  «        5 }	 |                     |¦  «        }|                     |¦  «        }||k    r	 d d d ¦  «         d d d ¦  «         dS |s	 d d d ¦  «         d d d ¦  «         dS Œe# 1 swxY w Y   d d d ¦  «         d S # 1 swxY w Y   d S )NÚrbTF)ÚBUFSIZEÚopenÚread)r   r    ÚbufsizeÚfp1Úfp2Úb1Úb2s          r   r   r   K   sƒ  € Ý€GÝ	ˆb�$‰Œð ˜3¥ R¨¡¤ð °#ð	Ø—’˜'Ñ"Ô"ˆBØ—’˜'Ñ"Ô"ˆBØ�RŠxˆxØðð ð ñ ô ð ð ð ð ñ ô ð ð ð ð ð Øðð ð ñ ô ð ð ð ð ñ ô ð ð ð ð	ðð ð ð øøøð ð ð ð ð ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð sF   ˜B(©3BÁB(Á4BÁ7B(ÂBÂB	ÂB(ÂB	ÂB(Â(B,Â/B,c                   óš   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Z ee	eeeeeeeeeee¬¦  «        Zd„ Z ee¦  «        ZdS )r   a®  A class that manages the comparison of 2 directories.

    dircmp(a, b, ignore=None, hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to DEFAULT_IGNORES.
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp instances (or MyDirCmp instances if this
       object is of type MyDirCmp, a subclass of dircmp), keyed by names
       in common_dirs.
     Nc                 óž   — || _         || _        |€t          j        t          j        g| _        n|| _        |€t          | _        d S || _        d S r&   )ÚleftÚrightr   ÚcurdirÚpardirÚhider	   Úignore)ÚselfÚaÚbr=   r<   s        r   Ú__init__zdircmp.__init__|   sI   € ØˆŒ	ØˆŒ
Øˆ<Ýœ¥B¤IÐ.ˆDŒIˆIàˆDŒIØˆ>Ý)ˆDŒKˆKˆKà ˆDŒKˆKˆKr   c                 óN  — t          t          j        | j        ¦  «        | j        | j        z   ¦  «        | _        t          t          j        | j        ¦  «        | j        | j        z   ¦  «        | _        | j         	                    ¦   «          | j         	                    ¦   «          d S r&   )
Ú_filterr   Úlistdirr8   r<   r=   Ú	left_listr9   Ú
right_listÚsort©r>   s    r   Úphase0zdircmp.phase0ˆ   s†   € Ý ¥¤¨D¬IÑ!6Ô!6Ø!%¤¨4¬;Ñ!6ñ8ô 8ˆŒå!¥"¤*¨T¬ZÑ"8Ô"8Ø"&¤)¨D¬KÑ"7ñ9ô 9ˆŒàŒ×ÒÑÔÐØŒ×ÒÑÔÐÐÐr   c           	      ór  — t          t          t          t          j        j        | j        ¦  «        | j        ¦  «        ¦  «        }t          t          t          t          j        j        | j        ¦  «        | j        ¦  «        ¦  «        }t          t          |j	        t          |j        |¦  «        ¦  «        ¦  «        | _        t          t          |j	        t          |j        |¦  «        ¦  «        ¦  «        | _        t          t          |j	        t          |j        |¦  «        ¦  «        ¦  «        | _        d S r&   )ÚdictÚzipÚmapr   ÚpathÚnormcaserE   rF   ÚlistÚ__getitem__ÚfilterÚ__contains__Úcommonr   Ú	left_onlyÚ
right_only)r>   r?   r@   s      r   Úphase1zdircmp.phase1�   sÏ   € Ý••S�œÔ)¨4¬>Ñ:Ô:¸D¼NÑKÔKÑLÔLˆÝ••S�œÔ)¨4¬?Ñ;Ô;¸T¼_ÑMÔMÑNÔNˆÝ�3˜qœ}­f°Q´^ÀQÑ.GÔ.GÑHÔHÑIÔIˆŒÝ�c !¤-µ¸Q¼^ÈQÑ1OÔ1OÑPÔPÑQÔQˆŒÝ�s 1¤=µ+¸a¼nÈaÑ2PÔ2PÑQÔQÑRÔRˆŒˆˆr   c                 óV  — g | _         g | _        g | _        | j        D �]Š}t          j                             | j        |¦  «        }t          j                             | j        |¦  «        }d}	 t	          j	        |¦  «        }n# t          $ r d}Y nw xY w	 t	          j	        |¦  «        }n# t          $ r d}Y nw xY w|rÏt          j        |j        ¦  «        }t          j        |j        ¦  «        }||k    r| j                             |¦  «         Œôt          j        |¦  «        r| j                              |¦  «         �Œ$t          j        |¦  «        r| j                             |¦  «         �ŒT| j                             |¦  «         �Œp| j                             |¦  «         �ŒŒd S )Nr   r   )Úcommon_dirsÚcommon_filesÚcommon_funnyrT   r   rN   Újoinr8   r9   r   ÚOSErrorr'   r(   ÚappendÚS_ISDIRÚS_ISREG)	r>   ÚxÚa_pathÚb_pathÚokÚa_statÚb_statÚa_typeÚb_types	            r   Úphase2zdircmp.phase2—   sµ  € ØˆÔØˆÔØˆÔà”ð 	,ñ 	,ˆAÝ”W—\’\ $¤)¨QÑ/Ô/ˆFÝ”W—\’\ $¤*¨aÑ0Ô0ˆFàˆBðÝœ ™œ��øÝð ð ð à���ðøøøðÝœ ™œ��øÝð ð ð à���ðøøøð ð ,Ýœ V¤^Ñ4Ô4�Ýœ V¤^Ñ4Ô4�Ø˜VÒ#Ð#ØÔ%×,Ò,¨QÑ/Ô/Ð/Ð/Ý”\ &Ñ)Ô)ð 0ØÔ$×+Ò+¨AÑ.Ô.Ð.Ñ.Ý”\ &Ñ)Ô)ð 0ØÔ%×,Ò,¨QÑ/Ô/Ð/Ñ/àÔ%×,Ò,¨QÑ/Ô/Ð/Ñ/àÔ!×(Ò(¨Ñ+Ô+Ð+Ñ+ð9	,ð 	,s$   Á-BÂBÂBÂB*Â*B9Â8B9c                 óp   — t          | j        | j        | j        ¦  «        }|\  | _        | _        | _        d S r&   )r   r8   r9   rZ   Ú
same_filesÚ
diff_filesÚfunny_files)r>   Úxxs     r   Úphase3zdircmp.phase3º   s3   € Ý�d”i ¤¨TÔ->Ñ?Ô?ˆØ=?Ñ:ˆŒ˜œ¨$Ô*:Ð*:Ð*:r   c                 ó  — i | _         | j        D ]v}t          j                             | j        |¦  «        }t          j                             | j        |¦  «        }|                      ||| j        | j	        ¦  «        | j         |<   Œwd S r&   )
ÚsubdirsrY   r   rN   r\   r8   r9   Ú	__class__r=   r<   )r>   ra   Úa_xÚb_xs       r   Úphase4zdircmp.phase4¾   s|   € ð
 ˆŒØÔ!ð 	Pð 	PˆAÝ”'—,’,˜tœy¨!Ñ,Ô,ˆCÝ”'—,’,˜tœz¨1Ñ-Ô-ˆCØ#Ÿ~š~¨c°3¸¼ÀTÄYÑOÔOˆDŒL˜‰OˆOð	Pð 	Pr   c                 óŽ   — |                       ¦   «          | j                             ¦   «         D ]}|                     ¦   «          Œd S r&   )ru   rq   ÚvaluesÚphase4_closure©r>   Úsds     r   rx   zdircmp.phase4_closureÉ   sK   € Ø�Š‰ŒˆØ”,×%Ò%Ñ'Ô'ð 	 ð 	 ˆBØ×ÒÑÔÐÐð	 ð 	 r   c                 óB  — t          d| j        | j        ¦  «         | j        r5| j                             ¦   «          t          d| j        d| j        ¦  «         | j        r5| j                             ¦   «          t          d| j        d| j        ¦  «         | j        r.| j                             ¦   «          t          d| j        ¦  «         | j        r.| j                             ¦   «          t          d| j        ¦  «         | j        r.| j                             ¦   «          t          d| j        ¦  «         | j	        r.| j	                             ¦   «          t          d| j	        ¦  «         | j
        r0| j
                             ¦   «          t          d| j
        ¦  «         d S d S )	NÚdiffzOnly inú:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)Úprintr8   r9   rU   rG   rV   rk   rl   rm   rY   r[   rH   s    r   Úreportzdircmp.reportÎ   s“  € åˆf�d”i ¤Ñ,Ô,Ð,ØŒ>ð 	=ØŒN×ÒÑ!Ô!Ð!Ý�)˜TœY¨¨T¬^Ñ<Ô<Ð<ØŒ?ð 	?ØŒO× Ò Ñ"Ô"Ð"Ý�)˜TœZ¨¨d¬oÑ>Ô>Ð>ØŒ?ð 	8ØŒO× Ò Ñ"Ô"Ð"ÝÐ% t¤Ñ7Ô7Ð7ØŒ?ð 	8ØŒO× Ò Ñ"Ô"Ð"ÝÐ% t¤Ñ7Ô7Ð7ØÔð 	CØÔ×!Ò!Ñ#Ô#Ð#ÝÐ/°Ô1AÑBÔBÐBØÔð 	?ØÔ×!Ò!Ñ#Ô#Ð#ÝÐ+¨TÔ-=Ñ>Ô>Ð>ØÔð 	=ØÔ×"Ò"Ñ$Ô$Ð$ÝÐ(¨$Ô*;Ñ<Ô<Ð<Ð<Ð<ð	=ð 	=r   c                 óª   — |                       ¦   «          | j                             ¦   «         D ]$}t          ¦   «          |                      ¦   «          Œ%d S r&   )r   rq   rw   r~   ry   s     r   Úreport_partial_closurezdircmp.report_partial_closureç   sN   € Ø�Š‰ŒˆØ”,×%Ò%Ñ'Ô'ð 	ð 	ˆBÝ‰GŒGˆGØ�IŠI‰KŒKˆKˆKð	ð 	r   c                 óª   — |                       ¦   «          | j                             ¦   «         D ]$}t          ¦   «          |                     ¦   «          Œ%d S r&   )r   rq   rw   r~   Úreport_full_closurery   s     r   rƒ   zdircmp.report_full_closureí   sT   € Ø�Š‰ŒˆØ”,×%Ò%Ñ'Ô'ð 	%ð 	%ˆBÝ‰GŒGˆGØ×"Ò"Ñ$Ô$Ð$Ð$ð	%ð 	%r   )rq   rk   rl   rm   rY   rZ   r[   rT   rU   rV   rE   rF   c                 ó~   — || j         vrt          |¦  «        ‚ | j         |         | ¦  «         t          | |¦  «        S r&   )Ú	methodmapÚAttributeErrorÚgetattr)r>   Úattrs     r   Ú__getattr__zdircmp.__getattr__ù   sD   € Ø�t”~Ð%Ð%Ý  Ñ&Ô&Ð&ØˆŒ�tÔ˜TÑ"Ô"Ð"Ý�t˜TÑ"Ô"Ð"r   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rA   rI   rW   ri   ro   ru   rx   r   r�   rƒ   rK   r…   r‰   Úclassmethodr   Ú__class_getitem__r   r   r   r   r   X   s  € € € € € ð!	ð !	ðF
!ð 
!ð 
!ð 
!ðð ð ðSð Sð Sð!,ð !,ð !,ðF@ð @ð @ð	Pð 	Pð 	Pð ð  ð  ð
=ð =ð =ð2ð ð ð%ð %ð %ð �˜VØ &°6ÀvØ#)¸ÈVØ"¨fÀØ%°&ð	:ñ :ô :€Ið#ð #ð #ð $˜ LÑ1Ô1ÐÐÐr   r   c                 óî   — g g g f}|D ]l}t           j                             | |¦  «        }t           j                             ||¦  «        }|t          |||¦  «                                      |¦  «         Œm|S )a]  Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    )r   rN   r\   Ú_cmpr^   )r?   r@   rT   r!   Úresra   ÚaxÚbxs           r   r   r     su   € ð ˆr�2ˆ,€CØð -ð -ˆÝŒW�\Š\˜!˜QÑÔˆÝŒW�\Š\˜!˜QÑÔˆØ�D��R˜Ñ!Ô!Ô"×)Ò)¨!Ñ,Ô,Ð,Ð,Ø€Jr   c                 óT   — 	  | || ||¦  «        ¦  «         S # t           $ r Y dS w xY w)Né   )r]   )r?   r@   ÚshÚabsr   s        r   r‘   r‘     sH   € ðØ�3�s�s˜1˜a ‘}”}Ñ%Ô%Ð%Ð%øÝð ð ð Øˆqˆqðøøøs   ‚ ™
'¦'c                 óF   — t          t          |j        | ¦  «        ¦  «        S r&   )rP   r   rS   )ÚflistÚskips     r   rC   rC   &  s   € Ý•˜DÔ-¨uÑ5Ô5Ñ6Ô6Ð6r   c                  óH  — dd l } dd l}|                     | j        dd …         d¦  «        \  }}t          |¦  «        dk    r|                     dd ¦  «        ‚t          |d         |d         ¦  «        }d|v r|                     ¦   «          d S |                     ¦   «          d S )Nr   r   Úrr–   zneed exactly two args)z-rÚ )ÚsysÚgetoptÚargvr   ÚGetoptErrorr   rƒ   r   )rŸ   r    ÚoptionsÚargsÚdds        r   Údemor¦   ,  s¦   € Ø€J€J€JØ€M€M€MØ—M’M #¤(¨1¨2¨2¤,°Ñ4Ô4�M€GˆTÝ
ˆ4�y„y�A‚~€~Ø× Ò Ð!8¸$Ñ?Ô?Ð?Ý	��Q”˜˜aœÑ	!Ô	!€BØ�WÐÐØ
×ÒÑ Ô Ð Ð Ð à
�	Š	‰Œˆˆˆr   Ú__main__)T)r�   r   r   Ú	itertoolsr   Útypesr   Ú__all__r   r.   r	   r   r   r   r   r   r   r˜   r‘   rC   r¦   rŠ   r   r   r   ú<module>r«      sT  ðð
ð 
ð 
€	€	€	Ø €€€Ø !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð à
IÐ
IÐ
I€à	€Ø
€ðJð Jð J€ðð ð ð&ð &ð &ð &ðPð ð ð
	ð 	ð 	ðg2ð g2ð g2ð g2ð g2ñ g2ô g2ð g2ðTð ð ð ð6  ð ð ð ð ð7ð 7ð 7ð
ð 
ð 
ð ˆzÒÐØ€D�F„F€F€F€Fð Ðr   