Your IP : 3.22.42.25


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/filecmp.cpython-312.pyc

�

�Q�f�(���dZddlZddlZddlmZddlmZgd�ZiZdZ	gd�Z
d�Zdd	�Zd
�Z
d�ZGd�d
�Zdd�Zeefd�Zd�Zd�Zedk(re�yy)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�,�tj�y)zClear the filecmp cache.N)�_cache�clear���./opt/alt/python312/lib64/python3.12/filecmp.pyrrs��
�L�L�Nrc��ttj|��}ttj|��}|dtjk7s|dtjk7ry|r||k(ry|d|dk7rytj||||f�}|�5t
||�}tt�dkDr
t�|t||||f<|S)aMCompare 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().

    rFT��d)	�_sig�os�stat�S_IFREGr�get�_do_cmp�lenr)�f1�f2�shallow�s1�s2�outcomes      rrrs���.
�b�g�g�b�k�	�B�	
�b�g�g�b�k�	�B�	�!�u������1����� 5���2��8��	�!�u��1��~���j�j�"�b�"�b�)�*�G����"�b�/���v�;����M�!(��r�2�r�2�~���Nrc�n�tj|j�|j|jfS�N)r�S_IFMT�st_mode�st_size�st_mtime)�sts rrrFs*���K�K��
�
�#��J�J��K�K��rc�"�t}t|d�5}t|d�5}	|j|�}|j|�}||k7r	ddd�ddd�y|s	ddd�ddd�y�N#1swYnxYwddd�y#1swYyxYw)N�rbTF)�BUFSIZE�open�read)rr �bufsize�fp1�fp2�b1�b2s       rrrKs}���G�	
�b�$��3��R���#�����'�"�B����'�"�B��R�x�����������!/������s4�
B�*A0�
B�A0�B�/A0�0A9	�5B�Bc��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
ee	eeeeeeeeeee�
�Zd�Zee�Zy)ra�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��||_||_|�&tjtjg|_n||_|�t|_y||_yr&)�left�rightr�curdir�pardir�hider	�ignore)�self�a�br=r<s     r�__init__zdircmp.__init__|sC����	���
��<����B�I�I�.�D�I��D�I��>�)�D�K� �D�Krc��ttj|j�|j|j
z�|_ttj|j�|j|j
z�|_|jj�|jj�yr&)
�_filterr�listdirr8r<r=�	left_listr9�
right_list�sort�r>s r�phase0z
dircmp.phase0�sx�� ����D�I�I�!6�!%���4�;�;�!6�8���!�"�*�*�T�Z�Z�"8�"&�)�)�D�K�K�"7�9��������������rc	��ttttjj
|j�|j��}ttttjj
|j�|j��}tt|jt|j|���|_tt|jt|j|���|_tt|jt|j|���|_yr&)�dict�zip�mapr�path�normcaserErF�list�__getitem__�filter�__contains__�commonr�	left_only�
right_only)r>r?r@s   r�phase1z
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��rc��g|_g|_g|_|jD�]�}tj
j
|j|�}tj
j
|j|�}d}	t	j|�}	t	j|�}|r�tjj�}tjj�}||k7r|jj|���tj|�r|jj|���tj |�r|jj|���K|jj|���h|jj|����y#ttf$rd}Y��+wxYw#ttf$rd}Y��-wxYw)NTF)�common_dirs�common_files�common_funnyrTrrN�joinr8r9r�OSError�
ValueErrorr'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�se��������������A��W�W�\�\�$�)�)�Q�/�F��W�W�\�\�$�*�*�a�0�F��B�
�������
�������
����V�^�^�4�����V�^�^�4���V�#��%�%�,�,�Q�/��\�\�&�)��$�$�+�+�A�.��\�\�&�)��%�%�,�,�Q�/��%�%�,�,�Q�/��!�!�(�(��+�=���Z�(�
���	
���Z�(�
���
�s$�=F)�G�)F>�=F>�G�Gc��t|j|j|j�}|\|_|_|_yr&)rr8r9rZ�
same_files�
diff_files�funny_files)r>�xxs  r�phase3z
dircmp.phase3�s1��
�d�i�i����T�->�->�
?��=?�:�����$�*:rc�F�i|_|jD]�}tjj	|j
|�}tjj	|j|�}|j|||j|j�|j|<��yr&)
�subdirsrYrrNr\r8r9�	__class__r=r<)r>rb�a_x�b_xs    r�phase4z
dircmp.phase4�so��
����!�!�A��'�'�,�,�t�y�y�!�,�C��'�'�,�,�t�z�z�1�-�C�#�~�~�c�3����T�Y�Y�O�D�L�L��O�"rc��|j�|jj�D]}|j��yr&)rvrr�values�phase4_closure�r>�sds  rryzdircmp.phase4_closure�s.�����
��,�,�%�%�'�B�����(rc��td|j|j�|jr<|jj	�td|jd|j�|j
r<|j
j	�td|jd|j
�|jr0|jj	�td|j�|jr0|jj	�td|j�|jr0|jj	�td|j�|jr0|jj	�td|j�|jr1|jj	�td|j�yy)	N�diffzOnly in�:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printr8r9rUrGrVrlrmrnrYr[rHs r�reportz
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�-=�-=�>�������"�"�$��(�$�*;�*;�<�rc��|j�|jj�D]}t�|j��yr&)r�rrrxrrzs  r�report_partial_closurezdircmp.report_partial_closure�s0�����
��,�,�%�%�'�B��G��I�I�K�(rc��|j�|jj�D]}t�|j	��yr&)r�rrrxr�report_full_closurerzs  rr�zdircmp.report_full_closure�s3�����
��,�,�%�%�'�B��G��"�"�$�(r)rrrlrmrnrYrZr[rTrUrVrErFc�v�||jvrt|��|j||�t||�Sr&)�	methodmap�AttributeError�getattr)r>�attrs  r�__getattr__zdircmp.__getattr__�s9���t�~�~�%� ��&�&�����t��T�"��t�T�"�"r)NN)�__name__�
__module__�__qualname__�__doc__rArIrWrjrprvryr�r�r�rKr�r��classmethodr�__class_getitem__rrrrrXsx��!	�F
!��S�#,�J@�	P� �
=�2�%��V� &�6�v�!'�f�6�"�f��%�&�	:�I�#�$�L�1�rrc���gggf}|D]a}tjj||�}tjj||�}|t|||�j	|��c|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.

    )rrNr\�_cmpr_)r?r@rTr!�resrb�ax�bxs        rrrsd���r�2�,�C�
��
�W�W�\�\�!�Q�
��
�W�W�\�\�!�Q�
���D��R��!�"�)�)�!�,���Jrc�P�	|||||��S#ttf$rYywxYw)N�)r]r^)r?r@�sh�absrs     rr�r�s4����s�1�a��}�%�%�%���Z� ����s��%�%c�@�tt|j|��Sr&)rPrrS)�flist�skips  rrCrC(s����D�-�-�u�5�6�6rc��ddl}ddl}|j|jddd�\}}t|�dk7r|j	dd��t|d|d�}d|vr|j
�y|j�y)Nrr�rr�zneed exactly two args)z-r�)�sys�getopt�argvr�GetoptErrorrr�r�)r�r��options�args�dds     r�demor�.sv�����M�M�#�(�(�1�2�,��4�M�G�T�
�4�y�A�~�� � �!8�$�?�?�	��Q���a��	!�B��W��
��� �
�	�	�r�__main__)T)r�rr�	itertoolsr�typesr�__all__rr.r	rrrrrrr�r�rCr�r�rrr�<module>r�s���
�
��!��
I��	��
��J���&�P�
	�i2�i2�X�6���7�
��z���F�r

?>