AlkantarClanX12

Your IP : 18.118.28.217


Current Path : /proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/filecmp.cpython-311.pyc

�

c��f�'����dZddlZddlZddlmZddlmZgd�ZiZdZ	gd�Z
d�Zdd
�Zd�Z
d�ZGd
�d��Zdd�Zeefd�Zd�Zd�Zedkre��dSdS)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���dS)zClear the filecmp cache.N)�_cache�clear���./opt/alt/python311/lib64/python3.11/filecmp.pyrrs��
�L�L�N�N�N�N�NrTc���ttj|����}ttj|����}|dtjks|dtjkrdS|r||krdS|d|dkrdSt�||||f��}|�Dt
||��}tt��dkrt��|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�N�d)	�_sig�os�stat�S_IFREGr�get�_do_cmp�lenr)�f1�f2�shallow�s1�s2�outcomes      rrrs���.
�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�~���Nrc�N�tj|j��|j|jfS�N)r�S_IFMT�st_mode�st_size�st_mtime)�sts rrrFs%���K��
�#�#��J��K��rc�j�t}t|d��5}t|d��5}	|�|��}|�|��}||kr	ddd��ddd��dS|s	ddd��ddd��dS�e#1swxYwYddd��dS#1swxYwYdS)N�rbTF)�BUFSIZE�open�read)rr �bufsize�fp1�fp2�b1�b2s       rrrKs����G�	
�b�$����3��R�����#�	����'�"�"�B����'�"�"�B��R�x�x�����������������
����������������	��������������������������������sF�B(�3B�B(�4B�7B(�B�B	�B(�B	�B(�(B,�/B,c��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
ee	eeeeeeeeeee�
��Zd�Zee��ZdS)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|_dS||_dSr&)�left�rightr�curdir�pardir�hider	�ignore)�self�a�br=r<s     r�__init__zdircmp.__init__|sI����	���
��<���B�I�.�D�I�I��D�I��>�)�D�K�K�K� �D�K�K�Krc�N�ttj|j��|j|jz��|_ttj|j��|j|jz��|_|j�	��|j�	��dSr&)
�_filterr�listdirr8r<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������������������rc	�r�ttttjj|j��|j����}ttttjj|j��|j����}tt|j	t|j|������|_tt|j	t|j|������|_tt|j	t|j|������|_dSr&)�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�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����rc�V�g|_g|_g|_|jD�]�}tj�|j|��}tj�|j|��}d}	t	j	|��}n#t$rd}YnwxYw	t	j	|��}n#t$rd}YnwxYw|r�tj|j��}tj|j��}||kr|j�
|����tj|��r|j�
|����$tj|��r|j�
|����T|j�
|����p|j�
|�����dS)Nrr)�common_dirs�common_files�common_funnyrTrrN�joinr8r9r�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�8B9c�p�t|j|j|j��}|\|_|_|_dSr&)rr8r9rZ�
same_files�
diff_files�funny_files)r>�xxs  r�phase3z
dircmp.phase3�s3��
�d�i���T�->�
?�
?��=?�:�����$�*:�*:�*:rc��i|_|jD]v}tj�|j|��}tj�|j|��}|�|||j|j	��|j|<�wdSr&)
�subdirsrYrrNr\r8r9�	__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�	Prc��|���|j���D]}|����dSr&)rurq�values�phase4_closure�r>�sds  rrxzdircmp.phase4_closure�sK�����
�
�
��,�%�%�'�'�	 �	 �B��������	 �	 rc�B�td|j|j��|jr5|j���td|jd|j��|jr5|j���td|jd|j��|jr.|j���td|j��|jr.|j���td|j��|jr.|j���td|j��|j	r.|j	���td|j	��|j
r0|j
���td|j
��dSdS)	N�diffzOnly in�:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printr8r9rUrGrVrkrlrmrYr[rHs 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�-=�>�>�>���	=���"�"�$�$�$��(�$�*;�<�<�<�<�<�	=�	=rc��|���|j���D]$}t��|����%dSr&)rrqrwr~rys  r�report_partial_closurezdircmp.report_partial_closure�sN�����
�
�
��,�%�%�'�'�	�	�B��G�G�G��I�I�K�K�K�K�	�	rc��|���|j���D]$}t��|����%dSr&)rrqrwr~�report_full_closurerys  rr�zdircmp.report_full_closure�sT�����
�
�
��,�%�%�'�'�	%�	%�B��G�G�G��"�"�$�$�$�$�	%�	%r)rqrkrlrmrYrZr[rTrUrVrErFc�~�||jvrt|���|j||��t||��Sr&)�	methodmap�AttributeError�getattr)r>�attrs  r�__getattr__zdircmp.__getattr__�sD���t�~�%�%� ��&�&�&����t��T�"�"�"��t�T�"�"�"r)NN)�__name__�
__module__�__qualname__�__doc__rArIrWrirorurxrr�r�rKr�r��classmethodr�__class_getitem__rrrrrXs������!	�!	�F
!�
!�
!�
!����S�S�S�!,�!,�!,�F@�@�@�	P�	P�	P� � � �
=�=�=�2���%�%�%���V� &�6�v�#)��V�"�f��%�&�	:�:�:�I�#�#�#�$��L�1�1���rrc���gggf}|D]l}tj�||��}tj�||��}|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.

    )rrNr\�_cmpr^)r?r@rTr!�resra�ax�bxs        rrrsu���r�2�,�C�
�-�-��
�W�\�\�!�Q�
�
��
�W�\�\�!�Q�
�
���D��R��!�!�"�)�)�!�,�,�,�,��Jrc�T�	|||||����S#t$rYdSwxYw)N�)r])r?r@�sh�absrs     rr�r�sH����3�s�s�1�a��}�}�%�%�%�%�������q�q����s��
'�'c�F�tt|j|����Sr&)rPrrS)�flist�skips  rrCrC&s����D�-�u�5�5�6�6�6rc�H�ddl}ddl}|�|jdd�d��\}}t|��dkr|�dd���t|d|d��}d|vr|���dS|���dS)Nrr�rr�zneed exactly two args)z-r�)�sys�getopt�argvr�GetoptErrorrr�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�rr�	itertoolsr�typesr�__all__rr.r	rrrrrrr�r�rCr�r�rrr�<module>r�sT��
�
�
�	�	�	�����!�!�!�!�!�!�������
I�
I�
I��	��
��J�J�J�����&�&�&�&�P���
	�	�	�g2�g2�g2�g2�g2�g2�g2�g2�T����6������7�7�7�
�
�
��z����D�F�F�F�F�F��r