ó
    F\hœ)  ã                   ó¸   • S r SSKrSSKrSSKJr  SSKJr  / SQr0 rSr	/ SQr
S rSS	 jrS
 rS r " S S5      rSS jr\\4S jrS rS r\S:X  a  \" 5         gg)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                  ó,   • [         R                  5         g)zClear the filecmp cache.N)Ú_cacheÚclear© ó    Ú/usr/lib/python3.13/filecmp.pyr   r      s   € ä
‡L�L…Nr   c                 ó®  • [        [        R                  " U 5      5      n[        [        R                  " U5      5      nUS   [        R                  :w  d  US   [        R                  :w  a  gU(       a  X4:X  a  gUS   US   :w  a  g[        R                  XX445      nUc3  [        X5      n[        [        5      S:”  a
  [        5         U[        XX44'   U$ )a  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é   éd   )	Ú_sigÚosÚstatÚS_IFREGr   ÚgetÚ_do_cmpÚlenr   )Úf1Úf2ÚshallowÚs1Ús2Úoutcomes         r   r   r      s«   € ô. 
Œb�gŠg�b‹kÓ	€BÜ	Œb�gŠg�b‹kÓ	€BØ	ˆ!�u”—‘Ó  1¡¬¯©Ó 5ØÞ�2“8ØØ	ˆ!�u��1‘ƒ~Øä�j‰j˜" "Ð)Ó*€GØ�Ü˜"“/ˆÜŒv‹;˜ÓÜŒMØ!(Œˆr�rˆ~ÑØ€Nr   c                 óp   • [         R                  " U R                  5      U R                  U R                  4$ ©N)r   ÚS_IFMTÚst_modeÚst_sizeÚst_mtime)Ústs    r   r   r   F   s*   € Ü�KŠK˜Ÿ
™
Ó#Ø�J‰JØ�K‰Kðð r   c                 óB  • [         n[        U S5       n[        US5       n UR                  U5      nUR                  U5      nXV:w  a   S S S 5        S S S 5        gU(       d   S S S 5        S S S 5        gMT  ! , (       d  f       O= fS S S 5        g ! , (       d  f       g = f)NÚrbTF)ÚBUFSIZEÚopenÚread)r   r    ÚbufsizeÚfp1Úfp2Úb1Úb2s          r   r   r   K   so   € Ü€GÜ	ˆb�$Œ˜3¤ R¨¤°#ØØ—‘˜'Ó"ˆBØ—‘˜'Ó"ˆBØ‹xØ÷ !/�ˆö Ø÷ !/�ˆÙ÷ !/¥ú��Žús4   “B *A6Á
BÁA6Á#BÁ4A6Á6
B	Â BÂ
Bc                   ó˜   • \ rS rSrSrSSS.S jjrS rS rS	 rS
 r	S r
S rS rS rS r\" \
\	\	\	\\\\\\\\S9rS r\" \5      rSrg)r   éX   a·  A class that manages the comparison of 2 directories.

dircmp(a, b, ignore=None, hide=None, *, shallow=True)
  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].
  SHALLOW specifies whether to just check the stat signature (do not read
    the files).
    defaults to True.

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.
 NT©r!   c                ó°   • Xl         X l        Uc&  [        R                  [        R                  /U l        OX@l        Uc  [        U l        OX0l        XPl        g r&   )	ÚleftÚrightr   ÚcurdirÚpardirÚhider	   Úignorer!   )ÚselfÚaÚbr?   r>   r!   s         r   Ú__init__Údircmp.__init__   s@   € ØŒ	ØŒ
Ø‰<ÜŸ™¤B§I¡IÐ.ˆD�IàŒIØ‰>Ü)ˆD�Kà ŒKØ�r   c                 ó„  • [        [        R                  " U R                  5      U R                  U R
                  -   5      U l        [        [        R                  " U R                  5      U R                  U R
                  -   5      U l        U R                  R                  5         U R                  R                  5         g r&   )
Ú_filterr   Úlistdirr:   r>   r?   Ú	left_listr;   Ú
right_listÚsort©r@   s    r   Úphase0Údircmp.phase0Œ   sx   € Ü ¤§¢¨D¯I©IÓ!6Ø!%§¡¨4¯;©;Ñ!6ó8ˆŒä!¤"§*¢*¨T¯Z©ZÓ"8Ø"&§)¡)¨D¯K©KÑ"7ó9ˆŒà�‰×ÑÔØ�‰×ÑÕr   c           	      ó€  • [        [        [        [        R                  R
                  U R                  5      U R                  5      5      n[        [        [        [        R                  R
                  U R                  5      U R                  5      5      n[        [        UR                  [        UR                  U5      5      5      U l        [        [        UR                  [        UR                  U5      5      5      U l        [        [        UR                  [        UR                  U5      5      5      U l        g r&   )ÚdictÚzipÚmapr   ÚpathÚnormcaserH   rI   ÚlistÚ__getitem__ÚfilterÚ__contains__Úcommonr   Ú	left_onlyÚ
right_only)r@   rA   rB   s      r   Úphase1Údircmp.phase1”   s¼   € Ü””SœŸ™×)Ñ)¨4¯>©>Ó:¸D¿N¹NÓKÓLˆÜ””SœŸ™×)Ñ)¨4¯?©?Ó;¸T¿_¹_ÓMÓNˆÜœ3˜qŸ}™}¬f°Q·^±^ÀQÓ.GÓHÓIˆŒÜœc !§-¡-´¸Q¿^¹^ÈQÓ1OÓPÓQˆŒÜœs 1§=¡=´+¸a¿n¹nÈaÓ2PÓQÓRˆ�r   c                 óì  • / U l         / U l        / U l        U R                   GHœ  n[        R
                  R                  U R                  U5      n[        R
                  R                  U R                  U5      nSn [        R                  " U5      n [        R                  " U5      nU(       aò  [        R                  " WR                  5      n[        R                  " WR                  5      nXx:w  a  U R                  R                  U5        Mñ  [        R                  " U5      (       a  U R                   R                  U5        GM*  [        R                   " U5      (       a  U R                  R                  U5        GMc  U R                  R                  U5        GM�  U R                  R                  U5        GMŸ     g ! [        [        4 a    Sn GNFf = f! [        [        4 a    Sn GNHf = f)NTF)Úcommon_dirsÚcommon_filesÚcommon_funnyrX   r   rR   Újoinr:   r;   r   ÚOSErrorÚ
ValueErrorr'   r(   ÚappendÚS_ISDIRÚS_ISREG)	r@   ÚxÚa_pathÚb_pathÚokÚa_statÚb_statÚa_typeÚb_types	            r   Úphase2Údircmp.phase2›   si  € ØˆÔØˆÔØˆÔà—•ˆAÜ—W‘W—\‘\ $§)¡)¨QÓ/ˆFÜ—W‘W—\‘\ $§*¡*¨aÓ0ˆFàˆBðÜŸš ›�ðÜŸš ›�ö
 ÜŸš V§^¡^Ó4�ÜŸš V§^¡^Ó4�ØÓ#Ø×%Ñ%×,Ñ,¨QÖ/Ü—\’\ &×)Ñ)Ø×$Ñ$×+Ñ+¨A×.Ü—\’\ &×)Ñ)Ø×%Ñ%×,Ñ,¨Q×/à×%Ñ%×,Ñ,¨Q×/à×!Ñ!×(Ñ(¨×+ò= øô œZÐ(ó ð “ð	ûô œZÐ(ó à“ðús$   Á=GÂGÇGÇGÇG3Ç2G3c                 óš   • [        U R                  U R                  U R                  U R                  5      nUu  U l        U l        U l        g r&   )r   r:   r;   r_   r!   Ú
same_filesÚ
diff_filesÚfunny_files)r@   Úxxs     r   Úphase3Údircmp.phase3À   s7   € Ü�d—i‘i §¡¨T×->Ñ->ÀÇÁÓMˆØ=?Ñ:ˆŒ˜œ¨$Õ*:r   c           	      óZ  • 0 U l         U R                   H”  n[        R                  R	                  U R
                  U5      n[        R                  R	                  U R                  U5      nU R                  X#U R                  U R                  U R                  S9U R                   U'   M–     g )Nr8   )Úsubdirsr^   r   rR   ra   r:   r;   Ú	__class__r?   r>   r!   )r@   rg   Úa_xÚb_xs       r   Úphase4Údircmp.phase4Ä   s|   € ð
 ˆŒØ×!Ô!ˆAÜ—'‘'—,‘,˜tŸy™y¨!Ó,ˆCÜ—'‘'—,‘,˜tŸz™z¨1Ó-ˆCØ#Ÿ~™~¨c¸¿¹ÀTÇYÁYØ6:·l±lð  .ð  DˆD�L‰L˜‹Oò "r   c                 ó†   • U R                  5         U R                  R                  5        H  nUR                  5         M     g r&   )r}   ry   ÚvaluesÚphase4_closure©r@   Úsds     r   r�   Údircmp.phase4_closureÐ   s.   € Ø�‰ŒØ—,‘,×%Ñ%Ö'ˆBØ×ÑÖò (r   c                 ó  • [        SU R                  U R                  5        U R                  (       a<  U R                  R	                  5         [        SU R                  SU R                  5        U R
                  (       a<  U R
                  R	                  5         [        SU R                  SU R
                  5        U R                  (       a0  U R                  R	                  5         [        SU R                  5        U R                  (       a0  U R                  R	                  5         [        SU R                  5        U R                  (       a0  U R                  R	                  5         [        SU R                  5        U R                  (       a0  U R                  R	                  5         [        SU R                  5        U R                  (       a1  U R                  R	                  5         [        SU R                  5        g g )	NÚdiffzOnly inÚ:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)Úprintr:   r;   rY   rJ   rZ   rr   rs   rt   r^   r`   rK   s    r   ÚreportÚdircmp.reportÕ   sE  € äˆf�d—i‘i §¡Ô,Ø�>�>Ø�N‰N×ÑÔ!Ü�)˜TŸY™Y¨¨T¯^©^Ô<Ø�?�?Ø�O‰O× Ñ Ô"Ü�)˜TŸZ™Z¨¨d¯o©oÔ>Ø�?�?Ø�O‰O× Ñ Ô"ÜÐ% t§¡Ô7Ø�?�?Ø�O‰O× Ñ Ô"ÜÐ% t§¡Ô7Ø××Ø×Ñ×!Ñ!Ô#ÜÐ/°×1AÑ1AÔBØ××Ø×Ñ×!Ñ!Ô#ÜÐ+¨T×-=Ñ-=Ô>Ø××Ø×Ñ×"Ñ"Ô$ÜÐ(¨$×*;Ñ*;Õ<ð r   c                 óš   • U R                  5         U R                  R                  5        H  n[        5         UR                  5         M     g r&   )r‰   ry   r€   rˆ   r‚   s     r   Úreport_partial_closureÚdircmp.report_partial_closureî   s0   € Ø�‰ŒØ—,‘,×%Ñ%Ö'ˆBÜŒGØ�I‰IŽKò (r   c                 óš   • U R                  5         U R                  R                  5        H  n[        5         UR	                  5         M     g r&   )r‰   ry   r€   rˆ   Úreport_full_closurer‚   s     r   r�   Údircmp.report_full_closureô   s3   € Ø�‰ŒØ—,‘,×%Ñ%Ö'ˆBÜŒGØ×"Ñ"Ö$ò (r   )ry   rr   rs   rt   r^   r_   r`   rX   rY   rZ   rH   rI   c                 óv   • XR                   ;  a  [        U5      eU R                   U   " U 5        [        X5      $ r&   )Ú	methodmapÚAttributeErrorÚgetattr)r@   Úattrs     r   Ú__getattr__Údircmp.__getattr__   s3   € Ø—~‘~Ó%Ü  Ó&Ð&Ø�‰�tÒ˜TÔ"Ü�tÓ"Ð"r   )rX   r^   r_   r`   rs   rt   r>   r?   r:   rH   rY   r;   rI   rZ   rr   r!   ry   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rC   rL   r[   ro   rv   r}   r�   r‰   rŒ   r�   rO   r’   r–   Úclassmethodr   Ú__class_getitem__Ú__static_attributes__r   r   r   r   r   X   s   † ñ$	ðLÀö òòSò#,òJ@ò
Dò ò
=ò2ò%ñ ˜VØ &°6ÀvØ!'°fÈ6Ø"¨fÀØ%°&ñ	:€Iò#ñ $ LÓ1Ór   r   c                 óÚ   • / / / 4nU H_  n[         R                  R                  X5      n[         R                  R                  X5      nU[        XgU5         R	                  U5        Ma     U$ )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   rR   ra   Ú_cmprd   )rA   rB   rX   r!   Úresrg   ÚaxÚbxs           r   r   r   	  s^   € ð ˆr�2ˆ,€CÛˆÜ�W‰W�\‰\˜!ÓˆÜ�W‰W�\‰\˜!ÓˆØŒD�˜Ó!Ñ"×)Ñ)¨!Ö,ñ ð €Jr   c                 óX   •  U" U" XU5      5      (       + $ ! [         [        4 a     gf = f)Né   )rb   rc   )rA   rB   ÚshÚabsr   s        r   r¡   r¡   $  s2   € ðÙ‘s˜1 “}Ó%Ô%Ð%øÜ”ZÐ ó Ùðús   ‚ –)¨)c                 ó@   • [        [        UR                  U 5      5      $ r&   )rT   r   rW   )ÚflistÚskips     r   rF   rF   -  s   € Ü”˜D×-Ñ-¨uÓ5Ó6Ð6r   c                  ó
  • SS K n SS KnUR                  U R                  SS  S5      u  p#[        U5      S:w  a  UR	                  SS 5      e[        US   US   5      nSU;   a  UR                  5         g UR                  5         g )Nr   r   Úrr¦   zneed exactly two args)z-rÚ )ÚsysÚgetoptÚargvr   ÚGetoptErrorr   r�   r‰   )r¯   r°   ÚoptionsÚargsÚdds        r   Údemor¶   3  st   € ÛÛØ—M‘M #§(¡(¨1¨2 ,°Ó4�M€GÜ
ˆ4ƒ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¡   rF   r¶   r˜   r   r   r   Ú<module>r»      s€   ðñ
ó 
Û Ý !Ý â
I€à	€Ø
€òJ€òô&òPò
	÷n2ñ n2ôbð6  ô ò7ò
ð ˆzÓÙ…Fð r   