Your IP : 18.117.184.125


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/filecmp.cpython-33.pyo

�
��f}%c@s�dZddlZddlZddlmZdddgZiZdZdd	d�Z	d
d�Z
dd
�ZGdd�d�Zddd�Z
ee	dd�Zdd�Zdd�Zedkr�e�ndS(u�Utilities for comparing files and directories.

Classes:
    dircmp

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

iN(ufilterfalseucmpudircmpucmpfilesiicCs�ttj|��}ttj|��}|dtjksP|dtjkrTdS|rj||krjdS|d|dkr�dStj||||f�}|dkr�t	||�}t
t�dkr�tj�n|t||||f<n|S(u�Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- Just check stat signature (do not read the files).
               defaults to 1.

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with a cache invalidation mechanism relying on stale signatures.

    iiidFTN(u_siguosustatuS_IFREGuFalseuTrueu_cacheugetuNoneu_do_cmpulenuclear(uf1uf2ushallowus1us2uoutcome((u,/opt/alt/python33/lib64/python3.3/filecmp.pyucmps&
cCstj|j�|j|jfS(N(ustatuS_IFMTust_modeust_sizeust_mtime(ust((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu_sig;su_sigcCsxt}t|d��]}t|d��E}x;|j|�}|j|�}||kr[dS|s-dSq-WdQXWdQXdS(NurbFT(uBUFSIZEuopenureaduFalseuTrue(uf1uf2ubufsizeufp1ufp2ub1ub2((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu_do_cmp@s$u_do_cmpcBs�|EeZdZdZd$d$dd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zede
de	de	de	dedededededed ed!e�Zd"d#�Zd$S(%udircmpuTA 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 ['RCS', 'CVS', 'tags'].
      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 objects, keyed by names in common_dirs.
     cCsm||_||_|dkr6tjtjg|_n	||_|dkr`dddg|_n	||_dS(NuRCSuCVSutags(ulefturightuNoneuosucurdirupardiruhideuignore(uselfuaubuignoreuhide((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu__init__os			udircmp.__init__cCsnttj|j�|j|j�|_ttj|j�|j|j�|_|jj	�|jj	�dS(N(
u_filteruosulistdiruleftuhideuignoreu	left_listurightu
right_listusort(uself((u,/opt/alt/python33/lib64/python3.3/filecmp.pyuphase0{s
u
dircmp.phase0cCs�ttttjj|j�|j��}ttttjj|j�|j��}tt|j	t
|j|���|_tt|j	t
|j|���|_tt|j	t
|j|���|_dS(N(udictuzipumapuosupathunormcaseu	left_listu
right_listulistu__getitem__ufilteru__contains__ucommonufilterfalseu	left_onlyu
right_only(uselfuaub((u,/opt/alt/python33/lib64/python3.3/filecmp.pyuphase1�s
**''u
dircmp.phase1c
Cs�g|_g|_g|_x|jD]t}tjj|j|�}tjj|j|�}d}ytj	|�}Wn.tj
k
r�}zd}WYdd}~XnXytj	|�}Wn.tj
k
r�}zd}WYdd}~XnX|r�t	j|j�}t	j|j�}	||	kr2|jj
|�q�t	j|�rT|jj
|�q�t	j|�rv|jj
|�q�|jj
|�q%|jj
|�q%WdS(Nii(ucommon_dirsucommon_filesucommon_funnyucommonuosupathujoinulefturightustatuerroruS_IFMTust_modeuappenduS_ISDIRuS_ISREG(
uselfuxua_pathub_pathuokua_statuwhyub_statua_typeub_type((u,/opt/alt/python33/lib64/python3.3/filecmp.pyuphase2�s4			u
dircmp.phase2cCs7t|j|j|j�}|\|_|_|_dS(N(ucmpfilesulefturightucommon_filesu
same_filesu
diff_filesufunny_files(uselfuxx((u,/opt/alt/python33/lib64/python3.3/filecmp.pyuphase3�su
dircmp.phase3cCssi|_xc|jD]X}tjj|j|�}tjj|j|�}t|||j|j	�|j|<qWdS(N(
usubdirsucommon_dirsuosupathujoinulefturightudircmpuignoreuhide(uselfuxua_xub_x((u,/opt/alt/python33/lib64/python3.3/filecmp.pyuphase4�s
	u
dircmp.phase4cCs2|j�x!|jj�D]}|j�qWdS(N(uphase4usubdirsuvaluesuphase4_closure(uselfusd((u,/opt/alt/python33/lib64/python3.3/filecmp.pyuphase4_closure�s
udircmp.phase4_closurecCsKtd|j|j�|jrH|jj�td|jd|j�n|jrz|jj�td|jd|j�n|jr�|jj�td|j�n|jr�|jj�td|j�n|jr�|jj�td|j�n|j	r|j	j�td|j	�n|j
rG|j
j�td|j
�ndS(	NudiffuOnly inu:uIdentical files :uDiffering files :uTrouble with common files :uCommon subdirectories :uCommon funny cases :(uprintulefturightu	left_onlyusortu
right_onlyu
same_filesu
diff_filesufunny_filesucommon_dirsucommon_funny(uself((u,/opt/alt/python33/lib64/python3.3/filecmp.pyureport�s,	
	
	
	
	
	
	
u
dircmp.reportcCs9|j�x(|jj�D]}t�|j�qWdS(N(ureportusubdirsuvaluesuprint(uselfusd((u,/opt/alt/python33/lib64/python3.3/filecmp.pyureport_partial_closure�s
udircmp.report_partial_closurecCs9|j�x(|jj�D]}t�|j�qWdS(N(ureportusubdirsuvaluesuprintureport_full_closure(uselfusd((u,/opt/alt/python33/lib64/python3.3/filecmp.pyureport_full_closure�s
udircmp.report_full_closureusubdirsu
same_filesu
diff_filesufunny_filesucommon_dirsucommon_filesucommon_funnyucommonu	left_onlyu
right_onlyu	left_listu
right_listcCs<||jkrt|��n|j||�t||�S(N(u	methodmapuAttributeErrorugetattr(uselfuattr((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu__getattr__�sudircmp.__getattr__N(u__name__u
__module__u__qualname__u__doc__uNoneu__init__uphase0uphase1uphase2uphase3uphase4uphase4_closureureportureport_partial_closureureport_full_closureudictu	methodmapu__getattr__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/filecmp.pyudircmpMs" #
cCskgggf}xU|D]M}tjj||�}tjj||�}|t|||�j|�qW|S(u]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.

    (uosupathujoinu_cmpuappend(uaubucommonushallowuresuxuaxubx((u,/opt/alt/python33/lib64/python3.3/filecmp.pyucmpfiles�s

!cCs;y|||||��SWntjk
r6dSYnXdS(Ni(uosuerror(uaubushuabsucmp((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu_cmpsu_cmpcCstt|j|��S(N(ulistufilterfalseu__contains__(uflistuskip((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu_filtersu_filtercCs�ddl}ddl}|j|jdd�d�\}}t|�dkrd|jdd��nt|d|d�}d|kr�|j�n
|j�dS(	Niiuriuneed exactly two argsu-ru(u-ru(	usysugetoptuargvulenuGetoptErroruNoneudircmpureport_full_closureureport(usysugetoptuoptionsuargsudd((u,/opt/alt/python33/lib64/python3.3/filecmp.pyudemos%
udemou__main__i T(u__doc__uosustatu	itertoolsufilterfalseu__all__u_cacheuBUFSIZEuTrueucmpu_sigu_do_cmpudircmpucmpfilesuabsu_cmpu_filterudemou__name__(((u,/opt/alt/python33/lib64/python3.3/filecmp.pyu<module>
s &
�	

?>