Wc' ddlZddlZddlmZddlmZgdZiZdZgdZ dZ dd Z d Z d Z Gd d ZddZee fdZdZdZedkr edSdS)N) filterfalse) GenericAlias) clear_cachecmpdircmpcmpfilesDEFAULT_IGNORESi )RCSCVStagsz.gitz.hgz.bzr_darcs __pycache__c4 tjdSN)_cacheclear /usr/lib64/python3.12/filecmp.pyrrs" LLNNNNrTc ttj|}ttj|}|dtjks|dtjkrdS|r||krdS|d|dkrdStj ||||f}|>t ||}ttdkr t|t||||f<|S)NrFTd) _sigosstatS_IFREGrget_do_cmplenr)f1f2shallows1s2outcomes rrrs, bggbk B bggbk B !u 1 5 5uw288t !u1~~ujj"b"b)*G"b/ v;   MM!(r2r2~ Nrcrtj|j|j|jfSr)rS_IFMTst_modest_sizest_mtime)sts rrrFs* KK # JJ KK rcDt}t|d5}t|d5} |j|}|j|}||kr dddddddS|s dddddddSW#1swYnxYwddddS#1swYdSxYw)NrbTF)BUFSIZEopenread)r r!bufsizefp1fp2b1b2s rrrKs^G b$3R#'"B'"BRxx  2s4B-A> B&A>) B=A>>B BBceZdZ ddZdZdZdZdZdZdZ d Z d Z d Z e eeeeeeeeeeee Zd ZeeZdS)rNc||_||_|(tjtjg|_n||_|t |_dS||_dSr)leftrightrcurdirpardirhider ignore)selfabr=r<s r__init__zdircmp.__init__|sM  <BII.DIIDI >)DKKK DKKKrcttj|j|j|j z|_ttj|j|j|j z|_|j j|jjdSr) _filterrlistdirr8r<r= left_listr9 right_listsortr>s rphase0z dircmp.phase0s DII!6!%4;;!68!"**TZZ"8"&))DKK"79  rc ttttjj |j |j }ttttjj |j|j}tt|jt|j||_ tt|jt|j||_tt|jt|j||_dSr)dictzipmaprpathnormcaserErFlist __getitem__filter __contains__commonr left_only right_only)r>r?r@s rphase1z dircmp.phase1s S))4>>:DNNK L S))4??;T__M N3q}}fQ^^Q.GHI c!--Q^^Q1OPQs1==+anna2PQRrcg|_g|_g|_|jD]}tj j |j|}tj j |j|}d} t j|} t j|}|rtjj}tjj}||kr|jj|tj|r|jj|*tj|r|jj|_|jj|}|jj|dS#t$rd}Y6wxYw#t$rd}Y1wxYw)NTF) common_dirs common_files common_funnyrTrrNjoinr8r9rOSErrorr'r(appendS_ISDIRS_ISREG) r>xa_pathb_pathoka_statb_stata_typeb_types rphase2z dircmp.phase2s , ,AWW\\$))Q/FWW\\$**a0FB   rV^^4V^^4V##%%,,Q///\\&))$$++A...\\&))%%,,Q///%%,,Q///!!((+++9 , ,         s$F?G? GG G"!G"ct|j|j|j}|\|_|_|_dSr)rr8r9rZ same_files diff_files funny_files)r>xxs rphase3z dircmp.phase3s7 diiT->-> ?=?:$*:*:*:rcPi|_|jD]}tjj |j |}tjj |j |}|j|||j|j|j|<dSr) subdirsrYrrNr\r8r9 __class__r=r<)r>raa_xb_xs rphase4z dircmp.phase4s  !! P PA'',,tyy!,C'',,tzz1-C#~~c3 TYYODLLOO P Prc|j|jjD]}|jdSr)rurqvaluesphase4_closurer>sds rrxzdircmp.phase4_closuresE ,,%%'  B        rctd|j|j|jr?|jj td|jd|j|j r?|j j td|jd|j |j r3|j j td|j |jr3|jj td|j|jr3|jj td|j|jr3|jj td|j|jr5|jj td|jdSdS) NdiffzOnly in:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :) printr8r9rUrGrVrkrlrmrYr[rHs rreportz dircmp.reports fdii,, >>> NN   ! ! )TYYT^^ < < ??? OO " " )TZZdoo > > ??? OO " " %t 7 7 ??? OO " " %t 7 7        ! ! # # /1A1A B B        ! ! # # +T-=-= > >        " " $ $ ($*;*; < < < <  rc|j|jjD]}t|j!dSr)rrqrwr~rys rreport_partial_closurezdircmp.report_partial_closuresG ,,%%'  B GG IIKKK  rc|j|jjD]}t|j !dSr)rrqrwr~report_full_closurerys rrzdircmp.report_full_closuresL ,,%%' % %B GG  " " $ $ $ % %r) rqrkrlrmrYrZr[rTrUrVrErFc||jvr t||j||t||Sr) methodmapAttributeErrorgetattr)r>attrs r __getattr__zdircmp.__getattr__s? t~~ % % & &tT""tT""r)NN)__name__ __module__ __qualname__rArIrWrirorurxrrrrKrr classmethodr__class_getitem__rrrrrXs! F ! ! ! !SSS!,!,!,F@@@ P P P   ===2 %%% V &6v!'f6"f%& ::I ### $ L1rrc gggf}|D]k}tjj||}tjj||}|t|||j |m|Sr)rrNr\_cmpr^)r?r@rTr"resraaxbxs rrrsr  r2,C -- WW\\!Q  WW\\!Q  DR !"))!,,, JrcL ||||| S#t$rYdSwxYw)N)r])r?r@shabsrs rrrsC3ss1a}%%% qqs  ##cHtt|j|Sr)rPrrS)flistskips rrCrC&s  D--u5 66rc(ddl}ddl}|j|jddd\}}t|dkr|j ddt |d|d}d|vr|j dS|jdS)Nrrrrzneed exactly two args)z-r)sysgetoptargvr GetoptErrorrrr)rroptionsargsdds rdemor,sJJJMMMMM#((12,4MGT 4yA~~  !8$?? Qa !BW      r__main__)T)rr itertoolsrtypesr__all__rr.r rrrrrrrrrCrrrrrrsG  !!!!!! I I I  JJJ&&&&P   g2g2g2g2g2g2g2T6777    zDFFFFr