Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/__pycache__/comparison.cpython-311.pyc

�

�܋f��� �v�UddlmZddlmZddlmZddlmZddl	m
ZmZddl
mZddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZdd	lmZdd
lZddl m!Z!m"Z"ddl#m$Z$dd
l%m&Z&ddl'm(Z(m)Z)ddl*m+Z,e-e.e/e0e1e2d
��fZ3dcde-de-de-de-fd�Z4ddd�Z5dedee-deee-effd�Z6dddee-dee-fd�Z7	dfdddee-dee-fd�Z8de9de9dddee-fd �Z:ddde-fd!�Z;	dgdededdd#e<dee-f
d$�Z=dededddee-fd%�Z>de1de1dddee-fd&�Z?de@de@dddee-fd'�ZAed(��ZBd)eeBdeeBfd*�ZC		dhdededdd,ed#e-d-e-d.e<dee-fd/�ZDdeEdeEdddee-fd0�ZFejGd1ejH��ZIeeJd2<d3e-de-fd4�ZKd3e-de-fd5�ZLde-de-ddfd6�ZMde.de.dddee-fd7�ZNdddee-fd8�ZOdededddee-fd9�ZPde-fd:�ZQeeedgee-fZRee2eRfZSe@eAeEeFeTe=e1e?e-eMe.eNe/e5e0e5ee5ee>e)jUeOe,jUeOeVe:eePiZWeSeJd;<d<e2d=eRfd>�ZXd?�ZYe-e.e@fZZGd@�dA��Z[GdB�de\��Z]dC�Z^e"dD��Z_e_e_e_e_d
d
d
d
d"d"dEdEd
dF�
dededGedHed#e-dIe-de-de-dJe<dKe<dLe<dMe<dNeSdOedee-fdP�Z`GdQ�dRe\��ZaGdS�dTea��ZbGdU�dVea��ZcGdW�dXec��ZdGdY�dZec��ZeGd[�d\ea��ZfGd]�d^��ZgGd_�d`��ZhGda�db��Zid
S)i�)�OrderedDict)�Iterable)�Decimal)�unified_diff)�partial�reduce)�__or__)�pformat)�Dict�Any�Optional�Sequence�	Generator�TypeVar�List�Mapping�Pattern�Union�Callabler)�
GeneratorTypeN)�	not_there�	singleton)�resolve)�indent)�parent_name�	mock_call)�call��x�y�x_label�y_labelc	��d�t|�d��|�d��|pd|pdd�����S)z�
    A shorthand function that uses :mod:`difflib` to return a
    string representing the differences between the two string
    arguments.

    Most useful when comparing multi-line strings.
    �
�first�secondr)�lineterm)�joinr�split)rr r!r"s    �h/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/testfixtures/comparison.py�diffr+sY���9�9��
�G�G�D�M�M�
�G�G�D�M�M���w���x��	�	�	�����context�CompareContextc���||kr�t|��}t|��}||kr�t|��t|��urt|||��St|��}t|��}d}|�|�t	||||dd��}|r|Sd|jpd�d|jpd�d|�d	�S|�d|��d
z|�d|��zSdS)zT
    Returns a very simple textual difference between the two supplied objects.
    N�attributes �.%szBoth rz and r z appear as z, but are not equal!� != )�repr�type�compare_with_type�_extract_attrs�_compare_mappingr!r"�label)rr r-�repr_x�repr_y�x_attrs�y_attrs�diff_s        r*�compare_simpler>,s��	�A�v�v��a�����a�����V����A�w�w�d�1�g�g�%�%�(��A�w�7�7�7�$�Q�'�'�G�$�Q�'�'�G��E��O�w��(��'�7�A�)6��?�?���
���
���&�3�&�&���(>�3�(>�(>�����
��}�}�S�&�)�)�F�2�W�]�]�3��5O�5O�O�O�#�vr,�ignore�returnc��	t|�����}t|t��r
|j|d<n#t
$rd}YnwxYwt
|dt��tu}|rxt��}t|��j
D]&}|�t
|dd�����'|r|�i}|D]&}t
||t��}|tur|||<�'|�dS|�|D]}|�|d���|S)N�args�	__slots__�)
�vars�copy�
isinstance�
BaseExceptionrB�	TypeError�getattrr�setr4�__mro__�update�pop)	�objr?�attrs�	has_slots�slots�cls�n�value�attrs	         r*r6r6DsE��%��S�	�	��� � ���c�=�)�)�	%��H�E�&�M���	��������������[�)�4�4�I�E�I��	!�������9�9�$�	8�	8�C��L�L���k�2�6�6�7�7�7�7��	�U�]��E��	!�	!�A��C��I�.�.�E��I�%�%� ��a����}��t�
���	"�	"�D��I�I�d�D�!�!�!�!��Ls�!A�A�A�ignore_attributesc���|�dd��}t|t��r#|�t	|��d��}t|��}|�|��|S)NrWrD)�
get_optionrG�dict�getr4rKrM)r-rWrOr?s    r*�_attrs_to_ignorer\bsh���
�
� 3�R�
8�
8�F��&�$���+����D��I�I�r�*�*��
��[�[�F�
�M�M�#�$�$�$��Mr,rDc�~�t|��t|��ust|t��rt|||��St|t	|||����}t|t	|||����}|�|�|r|st|||��S|js||krt
||||dd��SdS)a�
    Compare the two supplied objects based on their type and attributes.

    :param ignore_attributes:

       Either a sequence of strings containing attribute names to be ignored
       when comparing or a mapping of type to sequence of strings containing
       attribute names to be ignored when comparing that type.

       This may be specified as either a parameter to this function or in the
       ``context``. If specified in both, they will both apply with precedence
       given to whatever is specified is specified as a parameter.
       If specified as a parameter to this function, it may only be a list of
       strings.
    Nr0r1)r4rGr>r6r\�	ignore_eqr7)rr r-rWr;r<s      r*�compare_objectr_ms���$�A�w�w�d�1�g�g����A�t�!4�!4���a��G�,�,�,��Q� 0��:K�Q� O� O�P�P�G��Q� 0��:K�Q� O� O�P�P�G���'�/�'�/�g�/��a��G�,�,�,���6�G�w�.�.����'�1� -�u�6�6�	6�/�.r,c�f�|j|jkrt|||��St|||��S)z^
    Compare the two supplied exceptions based on their message, type and
    attributes.
    )rBr>r_�rr r-s   r*�compare_exceptionrb�s7��	�v������a��G�,�,�,��!�Q��(�(�(r,c
�p�t|��tur0t|j��t|��ur
|j|krdSt��}i}dD]Q}||}|�|d�t
|��t|������||<�Rdjdi|��S)zy
    Return a textual description of the difference between two objects
    including information about their types.
    r)rr z{0} ({1!r})z
{x} != {y}rD)r4�AlreadySeenrO�localsr8�format�_short_repr)rr r-�source�	to_render�namerOs       r*r5r5�s���
�A�w�w�+���$�q�u�+�+��a���"8�"8�Q�U�a�Z�Z��r�
�X�X�F��I��
�
���T�l��!�-�-��� � ��S�!1�!1�4��9�9�=�=�
�
�	�$����<��+�+��+�+�+r,T�prefixc
��t|��}t|��}d}||kr>||kr8|�||||d|z��rn|dz
}||kr||k�8||kr||krdS|rdnddzt|d|���|jpdt||d���|jpd	t||d���fzS)
zb
    Returns a textual description of the differences between the two
    supplied sequences.
    rz[%i]�Nzsequence not as expected:

rzsame:
%s

%s:
%s

%s:
%sr%r&)�len�	differentr
r!r")rr r-rk�l_x�l_y�is       r*�compare_sequencers�s����a�&�&�C�

�a�&�&�C�	�A�
�c�'�'�a�#�g�g����Q�q�T�1�Q�4��!��4�4�	��	�Q����c�'�'�a�#�g�g�
�c�z�z�a�3�h�h���06�
>�
,�
,�B�
�
�"�!�B�Q�B�%�.�.�!�/�4�W�g�a����e�n�n�!�/�5�X�w�q����u�~�~���r,c�~�t|��}t|��}|js||krdSt|||��S)z�
    Returns a textual description of the differences between the two
    supplied generators.

    This is done by first unwinding each of the generators supplied
    into tuples and then passing those tuples to
    :func:`compare_sequence`.
    N)�tupler^rsras   r*�compare_generatorrv�sD��	�a���A�
�a���A�����a������A�q�'�*�*�*r,c	�.�t|dd��}t|dd��}|ra|r_||krHttt||����tt||����||��St	|||��St|||��S)z�
    Returns a textual difference between two tuples or
    :func:`collections.namedtuple` instances.

    The presence of a ``_fields`` attribute on a tuple is used to
    decide whether or not it is a :func:`~collections.namedtuple`.
    �_fieldsN)rJr7rZ�zipr5rs)rr r-�x_fields�y_fieldss     r*�
compare_tupler|�s����q�)�T�*�*�H��q�)�T�*�*�H��4�H�4��x���#�D��X�q�)9�)9�$:�$:�$(��X�q�)9�)9�$:�$:�$+�$%�'�'�
'�
%�Q��7�3�3�3��A�q�'�*�*�*r,c�&�t||||��S)ze
    Returns a textual description of the differences between the two
    supplied dictionaries.
    )r7ras   r*�compare_dictr~�s��
�A�q�'�1�-�-�-r,�Item�sequencec�&�t|d����S)Nc� �t|��S�N)r3)�os r*�<lambda>z sorted_by_repr.<locals>.<lambda>�s��$�q�'�'�r,)�key)�sorted)r�s r*�sorted_by_reprr��s���(� 1� 1�2�2�2�2r,�[%r]�
obj_for_class�
breadcrumb�
check_y_not_xc�V�t|�����}t|�����}||z
}	||z
}
g}g}t|�|����D]�}
|�||
||
||
fz��rl|�|
�d|�dt||
�����d|�dt||
����������|�|
����|	s|r|
s|sdS|turg}nd|j	j
zg}|rI	t|��}n#t$rYnwxYw|�
dd|zt|��f��|jpd}|jpd	}|	r_|�
d|�d
|�d|�d�f��t|	��D]/}
|�|
�dt||
�������0|
r_|�
d|�d
|�d|�d�f��t|
��D]/}
|�|
�dt||
�������0|r1|�
dd
|pdzf��|�
|��d�|��S)N�: rr2r �%s not as expected:rz%ssame:r%r&�in �	 but not �:z	%sdiffer:zvalues r$)rK�keysr��intersectionro�appendr8r
r�	__class__�__name__r�rI�extendr3r!r"r()rr r-r�rkr�r��x_keys�y_keys�x_not_y�y_not_x�same�diffsr��linesr!r"s                 r*r7r7�s��������]�]�F�
������]�]�F��v�o�G��v�o�G�
�D��E��f�1�1�&�9�9�:�:�������Q�s�V�Q�s�V�Z�3�'�-A�B�B�	��L�L�����
�
�c�7�1�S�6�?�?�3�3�3�3��
�
�c�7�1�S�6�?�?�3�3�3��
�
�
�
�
�K�K��������
��'��e�����	�!�!����&��)@�)I�I�J���;�	��$�<�<�D�D���	�	�	��D�	����
���b�)�f�,�d�4�j�j�9�:�:�:��o�(��G��o�)��G���
���b�6�6�6�7�7�7�G�G�G�L�M�N�N�N�!�'�*�*�	�	�C��L�L������#������
�
�
�
���
���b�6�6�6�7�7�7�G�G�G�L�M�N�N�N�!�'�*�*�	�	�C��L�L������#������
�
�
�
�
��
���b�+��)<�9�=�>�?�?�?�
���U�����9�9�U���s�E�
E$�#E$c��||z
}||z
}|s|sdSd|jjzdg}|jpd}|jpd}|r9|�d|�d|�d�tt
|����df��|r9|�d|�d|�d�tt
|����df��d	�|��d	zS)
z]
    Returns a textual description of the differences between the two
    supplied sets.
    Nr�rr%r&r�r�r�r$)r�r�r!r"r�r
r�r()rr r-r�r�r�r!r"s        r*�compare_setr�5s��
�!�e�G��!�e�G���w����
"�Q�[�%9�
9�2�>�E��o�(��G��o�)��G���
����#*�7�7�G�G�G�4��N�7�+�+�,�,���	�	�	�
��
����#*�7�7�G�G�G�4��N�7�+�+�,�,���	�	�	�
�9�9�U���D� � r,z\s+$�trailing_whitespace_re�textc��g}|�d��D]-}|r)|���s|�|���.d�|��S)Nr$)r)�isspacer�r()r��result�lines   r*�strip_blank_linesr�Ss^��
�F��
�
�4� � � � ���	 ������	 ��M�M�$������9�9�V���r,c���|�d��}t|dd���D]\}}t|dz��||<�t|d��|d<d�|��S)Nr$���)r)�	enumerater3r()r��partsrr�parts    r*�
split_reprr�[sr���J�J�t���E��U�3�B�3�Z�(�(�%�%���4���t��$�$��a����U�2�Y���E�"�I��9�9�U���r,c���|�dd��}|�dd��}|�dd��}|s6t�d|��}t�d|��}|st|��}t|��}||krdS|�dt|����}|�d	t|����}t
|��d
kst
|��d
krQd|vsd|vr@|rt|��}t|��}dt|||j	|j
��z}nd|�d|��}n|d
z|z}|S)a�
    Returns an informative string describing the differences between the two
    supplied strings. The way in which this comparison is performed
    can be controlled using the following parameters:

    :param blanklines: If `False`, then when comparing multi-line
                       strings, any blank lines in either argument
                       will be ignored.

    :param trailing_whitespace: If `False`, then when comparing
                                multi-line strings, trailing
                                whilespace on lines will be ignored.

    :param show_whitespace: If `True`, then whitespace characters in
                            multi-line strings will be replaced with their
                            representations.
    �
blanklinesT�trailing_whitespace�show_whitespaceFrNrr �
r$�
!=
r2)rYr��subr�r8r3rnr�r+r!r")	rr r-r�r�r��
labelled_x�
labelled_y�messages	         r*�compare_textr�csq��$�#�#�L�$�7�7�J�!�,�,�-B�D�I�I���(�(�):�E�B�B�O��.�"�&�&�r�1�-�-��"�&�&�r�1�-�-���!��a� � ���a� � ���A�v�v������s�D��G�G�,�,�J����s�D��G�G�,�,�J�
�1�v�v��{�{�c�!�f�f�r�k�k��1�9�9���	�	��
"��q�M�M���q�M�M���T�!�Q�����I�I�I�G�G�	"�)3�
�
�J�J�?�G�G��V�#�J�.���Nr,c��||krdS|�dt|����}|�dt|����}d|�d|��S)Nrr r$r�)r8r3)rr r-r�r�s     r*�
compare_bytesr��sU���A�v�v������s�D��G�G�,�,�J����s�D��G�G�,�,�J�J�'�Z�Z���4�4r,c��||krdSd�}||��\}}}||��\}}}	||krC||kr=||	kr7tt|t��t|t��|��St|��t|��kr+t	t|��t|��|��S|�||d��p-|�||d��p|�||	d��}
|
sdSdS)Nc�J�	|\}}}n#t$r
d}|\}}YnwxYw|||fSr�)�
ValueError)rrjrB�kwargss    r*�extractzcompare_call.<locals>.extract�sQ��	 �!%��D�$�����	 �	 �	 ��D��L�D�&�&�&�	 �����T�6�!�!s�	��z function namez argsz kwzmock.call not as expected:)�compare_callrJrr3r�ro)rr r-r��x_name�x_args�x_kw�y_name�y_args�y_kwros           r*r�r��s'���A�v�v���"�"�"�#�7�1�:�:��F�F�D�"�7�1�:�:��F�F�D�
����F�f�,�,������G�A�{�3�3�W�Q��5L�5L�g�V�V�V��A�w�w�$�q�'�'����D��G�G�T�!�W�W�g�6�6�6�	���&�&�*:�;�;�	-����&�&�'�2�2�	-����$��e�,�,��
����'�'r,c��t|j|j|j���}t|j|j|j���}||krt	||||dd��SdS)N)�funcrB�keywordsr0r1)rZr�rBr�r7)rr r-r;r<s     r*�compare_partialr��sh�����Q�V�a�j�A�A�A�G����Q�V�a�j�A�A�A�G��'������'�1� -�u�6�6�	6��r,c�d�t|��}t|��dkr
|dd�dz}|S)N�z...)r3rn)rO�repr_s  r*rgrg�s3����I�I�E�
�5�z�z�B����c�r�c�
�U�"���Lr,�	_registry�type_�comparerc��|t|<dS)z�
    Register the supplied comparer for the specified type.
    This registration is global and will be in effect from the point
    this function is called until the end of the current process.
    N)r�)r�r�s  r*�registerr��s�� �I�e���r,c#�K�tt|��j��}t|��jD]
}||vr|V��dSr�)rKr4rL)rr �y_mro�class_s    r*�_shared_mror��sO������Q���� � �E��q�'�'�/�����U�?�?��L�L�L���r,c� �eZdZd�Zd�Zd�ZdS)rdc�0�||_||_||_dSr�)�idrOr�)�self�id_rOr�s    r*�__init__zAlreadySeen.__init__�s��������$����r,c�8�d|j�d|j�d|j�d�S)Nz<AlreadySeen for z at z	 with id �>)rOr�r��r�s r*�__repr__zAlreadySeen.__repr__�s)��W�4�8�W�W�4�?�W�W�T�W�W�W�W�Wr,c�b�t|t��r|j|jkS|j|kSr�)rGrdr�rO�r��others  r*�__eq__zAlreadySeen.__eq__�s1���e�[�)�)�	%��?�e�&6�6�6��8�u�$�$r,N)r��
__module__�__qualname__r�r�r�rDr,r*rdrd�sD������%�%�%�
X�X�X�%�%�%�%�%r,rdc��eZdZdZ					ddeedeededed	ed
edeee	ffd�Z
d
ede	de	de	de	defd�Z
ddefd�Zdede	defd�Zde	de	defd�Zdefd�Zd�Zde	de	dedeeeeffd�ZdS) r.zt
    Stores the context of the current comparison in process during a call to
    :func:`testfixtures.compare`.
    TFNr!r"�	recursive�strictr^�	comparers�optionsc��g|_|r|j�|��|j�t��||_||_||_||_||_|pi|_d|_	g|_
i|_dS)Nr)�
registriesr�r�r!r"r�r�r^r�r��breadcrumbs�_seen)r�r!r"r�r�r^r�r�s        r*r�zCompareContext.__init__s�������	.��O�"�"�9�-�-�-�����y�)�)�)�������(���"���(���'.�}�"������&(�����
�
�
r,rBrr �expected�actualr@c�\��g��fd�}||����|��||��||��||��t���dkrOd}�r|d����z
}|jr|d�|j��z
}t	|����S)Nc�H��|tur��|��dSdSr�)�unspecifiedr�)rh�possibles �r*�append_if_specifiedz8CompareContext.extract_args.<locals>.append_if_specified#s.����[�(�(�����'�'�'�'�'�)�(r,�z)Exactly two objects needed, you supplied:z {})r�rnrfr�rI)	r�rBrr r�r�r�r�r�s	        @r*�extract_argszCompareContext.extract_argss������	(�	(�	(�	(�	(�	��H�%�%�%����������F�#�#�#���A������A�����x�=�=�A���A�G��
2��5�<�<��1�1�1���|�
6��5�<�<���5�5�5���G�$�$�$��r,rjc�8�|j�||��Sr�)r�r[)r�rj�defaults   r*rYzCompareContext.get_option7s���|����g�.�.�.r,�siderUc�d�t|��}t||dz��}|r|d|zdzz
}|S)N�_labelz (�))�strrJ)r�r�rU�rr8s     r*r8zCompareContext.label:s?����J�J����d�8�m�,�,���	 �
��e��C���A��r,c���|jr%t|��t|��urtSt||��D])}|jD]}|�|��}|r|ccS� �*t
|t��rFt
|t��r1t
|t��st
|t��stSt
|t��st
|t��rtStSr�)
r�r4r5r�r�r[rG�IterableABC�_unsafe_iterablesrv�
Comparisonr>r_)r�rr r��registryr�s      r*�_lookupzCompareContext._lookupAs���;�	%�4��7�7�$�q�'�'�1�1�$�$�!�!�Q�'�'�	$�	$�F� �O�
$�
$��#�<�<��/�/���$�#�O�O�O�O�O�$�
$���;�
'�
'�	%�J�q�+�,F�,F�	%�
��,�
-�
-�	%�
��,�
-�
-�	%�%�$��a��$�$�	"�
�1�j�(A�(A�	"�!�!��r,c�L�dd�|jdd���zS)Nz

While comparing %s: rrm)r(r�r�s r*�
_separatorzCompareContext._separatorWs%��)�B�G�G�D�4D�Q�R�R�4H�,I�,I�I�Ir,c��t|t��r|St|��}|j�|��}|�t|||��S||j|<|Sr�)rG�IMMUTABLE_TYPEsr�r�r[rd)r�rOr�r��breadcrumb_s     r*�_break_loopszCompareContext._break_loopsZs_���c�?�+�+�	��J���g�g���j�n�n�S�)�)���"��s�C��5�5�5�(�D�J�s�O��Jr,r�c��|�||��}|�||��}t|j��}|j�|��|j}d|_d}	t|��tus|jsE|js>	||kr&	||z|_|j�	��dSn#t$rYnwxYw|�||��}||||��}|tu}	|r2|	r|r|�
��}|	s|s||z
}|jr
||jz
}|||z|_|j�	��S#||z|_|j�	��wxYw)NrF)r
�boolr�r�r�r4rdr�r^rN�RecursionErrorrr>r	r�)
r�rr r��recursed�existing_message�current_messager�r��specific_comparers
          r*rozCompareContext.differentgs������a��,�,�����a��,�,����(�)�)������
�+�+�+��<�������	#��A�w�w�+�%�%�d�k�%�T�^�%���A�v�v�$�.,�o�=�D�L��� � �"�"�"�"�"�3��%�����D�����"&���a��!3�!3�H��X�a��D�)�)�F� (�� >���	
8�$�8��8�&*�o�o�&7�&7�O�$�8�H�8�#�v�-�O��~�8�'�4�<�7���,�o�=�D�L��� � �"�"�"�"��,�o�=�D�L��� � �"�"�"�"���s1�,$E�B>�=E�>
C�E�
C�A$E�%E8)TFFNNr�)r�r�r��__doc__r
rr�Registryrrr�rurr�rYr8�Comparerrr	r
rrorDr,r*r.r.s���������#� �#�"&�&*����c�]���c�]���	�
���
� ���#�s�(�^�����2���3��3��#��s��W[�����0/�/�s�/�/�/�/��#��c��c���������������,J�C�J�J�J�J����'#�3�'#�3�'#�C�'#�E�$��QT�
�BU�<V�'#�'#�'#�'#�'#�'#r,c�R�tt|��r
|��n|��Sr�)r�callable)rhs r*�
_resolve_lazyr�s'���8�F�+�+�7�v�v�x�x�x��8�8�8r,r�F)
rr r�r�rk�suffixr!r"�raisesr�r�r^r�r�r�rrr�r�r^r�r�c
	�^�d}|tur	|tus|pd}|pd}t|||	|
|||��}|�|
||||��\}}|�||d��sdS|j}|rt|��dz|z}|r|dt|��zz
}|rt
|���|S)a�
    Compare two objects, raising an :class:`AssertionError` if they are not
    the same. The :class:`AssertionError` raised will attempt to provide
    descriptions of the differences found.

    The two objects to compare can be passed either positionally or using
    explicit keyword arguments named ``x`` and ``y``, or ``expected`` and
    ``actual``, or a mixture of these.

    :param prefix: If provided, in the event of an :class:`AssertionError`
                   being raised, the prefix supplied will be prepended to the
                   message in the :class:`AssertionError`. This may be a
                   callable, in which case it will only be resolved if needed.

    :param suffix: If provided, in the event of an :class:`AssertionError`
                   being raised, the suffix supplied will be appended to the
                   message in the :class:`AssertionError`. This may be a
                   callable, in which case it will only be resolved if needed.

    :param x_label: If provided, in the event of an :class:`AssertionError`
                    being raised, the object passed as the first positional
                    argument, or ``x`` keyword argument, will be labelled
                    with this string in the message in the
                    :class:`AssertionError`.

    :param y_label: If provided, in the event of an :class:`AssertionError`
                    being raised, the object passed as the second positional
                    argument, or ``y`` keyword argument, will be labelled
                    with this string in the message in the
                    :class:`AssertionError`.

    :param raises: If ``False``, the message that would be raised in the
                   :class:`AssertionError` will be returned instead of the
                   exception being raised.

    :param recursive: If ``True``, when a difference is found in a
                      nested data structure, attempt to highlight the location
                      of the difference.

    :param strict: If ``True``, objects will only compare equal if they are
                   of the same type as well as being equal.

    :param ignore_eq: If ``True``, object equality, which relies on ``__eq__``
                      being correctly implemented, will not be used.
                      Instead, comparers will be looked up and used
                      and, if no suitable comparer is found, objects will
                      be considered equal if their hash is equal.

    :param comparers: If supplied, should be a dictionary mapping
                      types to comparer functions for those types. These will
                      be added to the comparer registry for the duration
                      of this call.

    Any other keyword parameters supplied will be passed to the functions
    that end up doing the comparison. See the
    :mod:`API documentation below <testfixtures.comparison>`
    for details of these.
    Tr�r�rNr�r$)r�r.r�ror�r�AssertionError)rr r�r�rkrr!r"rr�r�r^r�rBr��__tracebackhide__r-r�s                  r*�comparer �s���X����#�#��+�(=�(=��'�Z���%�X���W�g�y�&�)�Y�X_�`�`�G�����a��H�f�=�=�D�A�q����Q��2�&�&�����o�G�
�9���'�'�$�.��8��
�0��4�-��/�/�/�/��
�&��W�%�%�%��Nr,c�t�eZdZUdZdZeed<dZeed<dZ	e
eed<d�Zd	efd
�Zd	efd�Z
d	efd�ZdS)
�StatefulComparisonz7
    A base class for stateful comparison objects.
    r�failedNr�rD�
name_attrsc��||kSr�rDr�s  r*r�zStatefulComparison.__eq__s���5�=�!�!r,r@c���t���j}�jr,|dd��fd��jD����zz
}|S)Nz(%s)�, c3�B�K�|]}|�dt�|����V��dS)�=N)rJ)�.0rTr�s  �r*�	<genexpr>z*StatefulComparison.name.<locals>.<genexpr>	s9�����&`�&`�1�!�!�!�W�T�1�5E�5E�5E�'F�&`�&`�&`�&`�&`�&`r,)r4r�r$r()r�rjs` r*rjzStatefulComparison.namesU����D�z�z�"���?�	a��F�T�Y�Y�&`�&`�&`�&`�PT�P_�&`�&`�&`�`�`�`�`�D��r,c�:�t|j��dd�S)Nrmr�)r
r�r�s r*�bodyzStatefulComparison.bodys���t�}�%�%�a��d�+�+r,c���|���}|jp|���}d|�|jrdpd�d�}d|vr'd|zdz|�d��zdzd|zzS|r||zdzS|S)N�<z(failed)rr�r$z</%s>z</>)rjr#r-�strip)r�rjr-rks    r*r�zStatefulComparison.__repr__s����y�y�{�{���{�)�d�i�i�k�k���!�T�4�;�#=�:�#C��#C�#C�D���4�<�<���;�t�#�D�J�J�t�$4�$4�4�T�9�'�D�.�H�H�
�	)��D�=�5�(�(��
r,)r�r�r�rr#r�__annotations__r�rr$rr�rjr-r�rDr,r*r"r"�s�����������F�C�����H�c���� "�J���
�"�"�"�"�"�"��c�����,�c�,�,�,�,��#������r,r"c�d�eZdZdZ		d
deeefdedefd�Zded	efd
�Z	d	efd�Z
d	efd�ZdS)ra�
    These are used when you need to compare an object's type, a subset of its attributes
    or make equality checks with objects that do not natively support comparison.

    :param object_or_type: The object or class from which to create the
                           :class:`Comparison`.

    :param attribute_dict: An optional dictionary containing attributes
                           to place on the :class:`Comparison`.

    :param partial:
      If true, only the specified attributes will be checked and any extra attributes
      of the object being compared with will be ignored.

    :param attributes: Any other keyword parameters passed will placed
                       as attributes on the :class:`Comparison`.

    NF�attribute_dictr�
attributesc�R�||_|r|�|}n|�|��t|t��r0t	|��j}|turtd|z���n0t|t��r|}n|j	}|�t|��}||_||_dS)Nz%r could not be resolved)
rrMrGrr�foundr�AttributeErrorr4r�r6�
expected_type�expected_attributes)r��object_or_typer3rr4�cs      r*r�zComparison.__init__.s���
����	2��%�!+����%�%�j�1�1�1��n�c�*�*�	@���'�'�-�A��I�~�~�$�.��?��������
-�
-�	@��A�A��(�A��%�!/��!?�!?�����#1�� � � r,r�r@c	���|j|jur	d|_dS|j�dSt	|j�����}|jri}n!t|��}|t	|��z}|D]&}	t||��||<�#t$rY�#wxYwtdd���}t|j||tdd|j�	��|_t|j��S)
Nz
wrong typeTFrr�)r!r"r0r1)r�rkr�r�)r8r�r#r9rKr�rr6rJr7r.r7rr)r�r��attribute_names�actual_attributesrjr-s      r*�__ne__zComparison.__ne__Hs#����U�_�4�4�&�D�K��4��#�+��5��d�6�;�;�=�=�>�>���<�	6� "��� .�u� 5� 5���s�#4�5�5�5�O�#�	�	�D�
�*1�%��*>�*>�!�$�'�'��!�
�
�
���
����!��x�H�H�H��&�t�'?�'8�'.�5>�.;�27�9=��5E�
G�G�G����D�K� � � s�7B�
B�Bc��d}t|jdd��}|r||zdz}|t|jdd��pt|j��z
}|S)NzC:r��.r�)rJr8r3)r�rj�modules   r*rjzComparison.namegs_������+�\�4�@�@���	'��&�=�3�&�D����+�Z��>�>�Z�$�t�GY�BZ�BZ�[���r,c��|jrg}t|j�����D]A\}}t|��}d|vrt	|��}|�|�d|�����Bd�|��SdS)Nr$r�r)r9r��itemsr3rr�r()r�r��k�v�rvs     r*r-zComparison.bodyos����#�	$��E��t�7�=�=�?�?�@�@�
1�
1���1��!�W�W���2�:�:�����B�������B�B�/�0�0�0�0��9�9�U�#�#�#��rr,)NF)r�r�r�rrrrrr�r?rjr-rDr,r*rrs���������*37�!&�2�2�!%�c�3�h��2��2� #�	2�2�2�2�4!�C�!�D�!�!�!�!�>�c�����
�c�
�
�
�
�
�
r,rc�@�eZdZdZdZdddd�dededefd	�Zd
efd�ZdS)
�SequenceComparisonar
    An object that can be used in comparisons of expected and actual
    sequences.

    :param expected: The items expected to be in the sequence.
    :param ordered:
      If ``True``, then the items are expected to be in the order specified.
      If ``False``, they may be in any order.
      Defaults to ``True``.
    :param partial:
      If ``True``, then any keys not expected will be ignored.
      Defaults to ``False``.
    :param recursive:
      If a difference is found, recursively compare the item where
      the difference was found to highlight exactly what was different.
      Defaults to ``False``.
    ��orderedrTF)rKrr�rKrr�c�d�||_||_||_||_t	��|_dSr�)r�rKrr�rK�checked_indices)r�rKrr�r�s     r*r�zSequenceComparison.__init__�s2��!��
�������"���"�u�u����r,r@c	������	t|��x}�n#t$rd�_YdSwxYwt�j��}t|��}g}g}g}|}tt	t|������x}}	g}
g}d}t
|��D]�\}
}	|�||��}|	�|��}|�	|�|����|�	|
��|�	|���j
�|���jr|}��#t$r-|
�	|��|�	|
��Y��wxYw|t|��k}|
p|}�jo|
}|s�js|s|rdS||z}|}	�jrR�jrF�jr?|r=|	�	|�d����|�d��|}d}n|	|z
}	d}g��fd�}|d|���jrx��	t#�fd�t|��D���fd�t|	��D���jd�	���d
d��d��n$|d|��|d
|
��|d|��d
�����_dS)N�bad typeTrFc�`��|r*��|dzt|��z��dSdS)Nz:
)r�r
)rj�contentr�s  �r*�add_sectionz.SequenceComparison.__ne__.<locals>.add_section�s>����
<����t�E�z�'�'�*:�*:�:�;�;�;�;�;�
<�
<r,�ignoredc�*��g|]}�j|��SrD)r�)r*rrr�s  �r*�
<listcomp>z-SequenceComparison.__ne__.<locals>.<listcomp>�s ���M�M�M�q�$�-��*�M�M�Mr,c� ��g|]
}�|��SrDrD)r*rr�original_actuals  �r*rUz-SequenceComparison.__ne__.<locals>.<listcomp>�s���K�K�K�q���*�K�K�Kr,�r�r�r�r�

rmr�zin expected but not actualzin actual but not expected)�listrIr#r��rangernr��indexrNr�rM�addrKr�r�rr�r r)r()r�r�r�r��matched�matched_expected_indices�matched_actual_indices�missing_from_expected�missing_from_expected_indices�actual_indices�missing_from_actual�missing_from_actual_indices�start�e_i�err�a_i�matches_in_order�all_matched�
partial_match�expected_indicesrSrRr�rWs`                      @@r*r?zSequenceComparison.__ne__�s������	�'+�E�{�{�2�F�_�_���	�	�	�$�D�K��4�4�	������
�&�&���f������#%� �!#�� &��9=�e�C��K�K�>P�>P�9Q�9Q�Q�%�� ��&(�#�����)�)�
	�
	�F�C��
��L�L��E�*�*��$�(�(��+�+��
���4�8�8��;�;�<�<�<�(�/�/��4�4�4�&�-�-�c�2�2�2��$�(�(��-�-�-��<���E����
8�
8�
8�#�*�*�1�-�-�-�+�2�2�3�7�7�7�7�7�
8����2�V�<R�5S�5S�S��.�G�2G�H����@�-@�)@�
��	�D�L�	�{�	�m�	��5�3�4O�O��/���<�
	��~�
-�$�,�
-�3H�
-��%�%�&C�&G�&G��&J�&J�K�K�K�%�)�)�!�,�,�,�+�G�$(�!�!��;�;�N��G���	<�	<�	<�	<�	<�	��I�w�'�'�'��<�
	M��N�N�7�M�M�M�M�F�;K�4L�4L�M�M�M�K�K�K�K�F�>�4J�4J�K�K�K��.��	���
�e�F�A���q�"�
#�
#�
#�
#�
�K���(�(�(��K�4�6I�J�J�J��K�4�6K�L�L�L��k�k�'�*�*����ts��,�,� +E�4E8�7E8N)r�r�r�rr$rr�r?rDr,r*rIrI|s���������$(�J�.2�5�\a�%�%�%�&*�%�<@�%�UY�%�%�%�%�N�t�N�N�N�N�N�Nr,rIc�&��eZdZdZdZ�fd�Z�xZS)�Subsetzx
    A shortcut for :class:`SequenceComparison` that checks if the
    specified items are present in the sequence.
    rDc�J��tt|��j|ddd��dS)NFTrJ)�superror��r�r�r�s  �r*r�zSubset.__init__�s-���$��f�d���$�h��t�L�L�L�L�L�Lr,)r�r�r�rr$r��
__classcell__�r�s@r*roro�sR���������
�J�M�M�M�M�M�M�M�M�Mr,roc�"��eZdZdZ�fd�Z�xZS)�Permutationz�
    A shortcut for :class:`SequenceComparison` that checks if the set of items
    in the sequence is as expected, but without checking ordering.
    c�J��tt|��j|ddd��dS)NFrJ)rqrvr�rrs  �r*r�zPermutation.__init__�s-���)��k�4� � �)�8�U�E�R�R�R�R�R�Rr,)r�r�r�rr�rsrts@r*rvrv�sK���������
S�S�S�S�S�S�S�S�Sr,rvc�4�eZdZdZdZd�Zdefd�Zdefd�Z	dS)�MappingComparisona�
    An object that can be used in comparisons of expected and actual
    mappings.

    :param expected_mapping:
      The mapping that should be matched expressed as either a sequence of
      ``(key, value)`` tuples or a mapping.
    :param expected_items: The items that should be matched.
    :param ordered:
      If ``True``, then the keys in the mapping are expected to be in the order specified.
      Defaults to ``False``.
    :param partial:
      If ``True``, then any keys not expected will be ignored.
      Defaults to ``False``.
    :param recursive:
      If a difference is found, recursively compare the value where
      the difference was found to highlight exactly what was different.
      Defaults to ``False``.
    rJc�8�|�dd��|_|�dd��|_|�dd��|_t	|��dkr
t|�}nt|��}|�|��||_dS)NrKFrr�rm)rNrKrr�rnrrMr�)r��expected_mapping�expected_itemsr�s    r*r�zMappingComparison.__init__s���%�)�)�)�U�;�;���%�)�)�)�U�;�;���'�+�+�K��?�?����� � �A�%�%�"�$4�5�H�H�"�#3�4�4�H�����'�'�'� ��
�
�
r,r@c��g}d}|j���D]N\}}t|��dzt|��z}|t	|��z
}|�|���O|dkrd}nd}|�|��S)Nrr��<z,
r')r�rDr3r
rnr�r()r�r��text_lengthr�rUr��seps       r*r-zMappingComparison.body&s��������-�-�-�/�/�	�	�J�C����9�9�T�>�'�%�.�.�0�D��3�t�9�9�$�K��L�L�����������C�C��C��x�x����r,c��
�	|���}t|�����}n#t$rd|_YdSwxYw|j���}|j}|jr6t|��t|��z
�
�
D]}||=��
fd�|D��}nd�
t|||j	d���}|j
r3tt|��t|��|j	d���}nd}|s|r�g}	�
r2|	�dtt�
����z��|r/|	�|�dd��d��|r2|	�d	|�dd��dz��d�|	��|_dSdS)
NrOTc���g|]}|�v�|��	SrDrD)r*rE�ignored_keyss  �r*rUz,MappingComparison.__ne__.<locals>.<listcomp>Ds#���K�K�K��Q�l�5J�5J�1�5J�5J�5Jr,FrXz	ignored:
rYrmzwrong key order:

)r�rZrDr7r#r�rrKr r�rKrZr�r
r�r)r()r�r��actual_keys�actual_mapping�
expected_keysr{r��mapping_differences�key_differencesr�r�s          @r*r?zMappingComparison.__ne__4s���	��*�*�,�,�K�!�%�+�+�-�-�0�0�N�N���	�	�	�$�D�K��4�4�	�����
�*�*�,�,�
��=���<�	 ��{�+�+�c�-�.@�.@�@�L�#�
(�
(��"�3�'�'�K�K�K�K�k�K�K�K�K�K��L�%�%�!��n��	
�
�
���<�	#�%��m�,�,��K�(�(��.��	���O�O�#�O��	�1�	��G��
K����|�G�F�<�4H�4H�,I�,I�I�J�J�J�"�
H����2�8�8���C�C�A�F�G�G�G��
[����5�o�6K�6K�F�TU�6V�6V�WX�6Y�Y�Z�Z�Z� �+�+�g�.�.�D�K��4��us�59�A�
AN)
r�r�r�rr$r�rr-rr?rDr,r*ryrysj��������((�J�!�!�!��c�����5�t�5�5�5�5�5�5r,ryc�d�eZdZdZd
dededefd�Zdefd�Zdefd	�Z	defd
�Z
defd�Zdefd�ZdS)�StringComparisona,
    An object that can be used in comparisons of expected and actual
    strings where the string expected matches a pattern rather than a
    specific concrete string.

    :param regex_source: A string containing the source for a regular
                         expression that will be used whenever this
                         :class:`StringComparison` is compared with
                         any :class:`str` instance.

    :param flags: Flags passed to :func:`re.compile`.

    :param flag_names: See the :ref:`examples <stringcomparison>`.
    N�regex_source�flags�
flag_namesc��|g}g}|r|�|��|�d�|D����|r(|�tt|����t	j|�|_dS)Nc3�dK�|]+}tt|�����V��,dSr�)rJ�re�upper)r*�fs  r*r+z,StringComparison.__init__.<locals>.<genexpr>�s4����A�A��g�b�!�'�'�)�)�,�,�A�A�A�A�A�Ar,)r�r�rr	r��compile)r�r�r�r�rB�flags_s      r*r�zStringComparison.__init__{s���~�����	!��M�M�%� � � ��
�
�A�A�j�A�A�A�A�A�A��	0��K�K��v�v�.�.�/�/�/��*�d�#����r,r@c�l�t|t��sdS|j�|��rdSdS)NFT)rGrr��matchr�s  r*r�zStringComparison.__eq__�s9���%��%�%�	��5��7�=�=����	��4��ur,c��||kSr�rDr�s  r*r?zStringComparison.__ne__�����5�=� � r,c� �d|jjzS)Nz<S:%s>�r��patternr�s r*r�zStringComparison.__repr__�s���$�'�/�)�)r,c�"�|jj|kSr�r�r�s  r*�__lt__zStringComparison.__lt__�����w���&�&r,c�"�|jj|kSr�r�r�s  r*�__gt__zStringComparison.__gt__�r�r,r�)
r�r�r�rr�intr�rr�r?r�r�r�rDr,r*r�r�ls�������
�
�
$�
$�S�
$��
$�3�
$�
$�
$�
$��t�����!�t�!�!�!�!�*�#�*�*�*�*�'�t�'�'�'�'�'�t�'�'�'�'�'�'r,r�c�F�eZdZdZdedefd�Zdefd�Zdefd�Z	de
fd�Zd	S)
�RoundComparisona
    An object that can be used in comparisons of expected and actual
    numerics to a specified precision.

    :param value: numeric to be compared.

    :param precision: Number of decimal places to round to in order
                      to perform the comparison.
    rU�	precisionc�>�t||��|_||_dSr�)�round�roundedr�)r�rUr�s   r*r�zRoundComparison.__init__�s���U�I�.�.���"����r,r@c���t||j��}t|j��t|��ur"t	d|�dt|�������|j|kS)NzCannot compare z with )r�r�r4r�rI)r�r��
other_roundeds   r*r�zRoundComparison.__eq__�s^���e�T�^�4�4�
������T�-�%8�%8�8�8��)�4�4�4��e����M�N�N�N��|�}�,�,r,c��||kSr�rDr�s  r*r?zRoundComparison.__ne__�r�r,c�$�d|j|jfzS)Nz<R:%s to %i digits>)r�r�r�s r*r�zRoundComparison.__repr__�s��$���d�n�'E�E�Er,N)r�r�r�r�floatr�r�rr�r?rr�rDr,r*r�r��s���������#�e�#��#�#�#�#�-�t�-�-�-�-�!�t�!�!�!�!�F�#�F�F�F�F�F�Fr,r�c�<�eZdZdZd�Zdefd�Zdefd�Zdefd�Z	dS)�RangeComparisona
    An object that can be used in comparisons of orderable types to
    check that a value specified within the given range.

    :param lower_bound: the inclusive lower bound for the acceptable range.

    :param upper_bound: the inclusive upper bound for the acceptable range.
    c�"�||_||_dSr���lower_bound�upper_bound)r�r�r�s   r*r�zRangeComparison.__init__�s��&���&����r,r@c�6�|j|cxko
|jkncSr�r�r�s  r*r�zRangeComparison.__eq__�s*����5�<�<�<�<�D�,<�<�<�<�<�<r,c��||kSr�rDr�s  r*r?zRangeComparison.__ne__�r�r,c�(�d|j�d|j�d�S)Nz	<Range: [r'z]>r�r�s r*r�zRangeComparison.__repr__�s!���&*�&6�&6�&6��8H�8H�8H�I�Ir,N)
r�r�r�rr�rr�r?rr�rDr,r*r�r��s���������'�'�'�=�t�=�=�=�=�!�t�!�!�!�!�J�#�J�J�J�J�J�Jr,r�)rr)r-r.r�)rD)T)rr�T)j�collectionsr�collections.abcrr�decimalr�difflibr�	functoolsr�partial_typer�operatorr	�pprintr
�typingrrr
rrrrrrrr�typesrr��testfixturesrr�testfixtures.resolver�testfixtures.utilsr�testfixtures.mockrr�
unittest.mockr�unittest_mock_callr�bytesr�r�rur4rr+r>r6r\r_�	Exceptionrbr5rrsrvr|rZr~rr�r7rKr�r��	MULTILINEr�r1r�r�r�r�r�r�rgrrrZr�rHr�r�r�rrd�objectr.rr�r r"rrIrorvryr�r�r�rDr,r*�<module>r�s
��#�#�#�#�#�#�#�3�3�3�3�3�3������� � � � � � �5�5�5�5�5�5�5�5����������������������������������������� ������	�	�	�	�-�-�-�-�-�-�-�-�(�(�(�(�(�(�%�%�%�%�%�%�4�4�4�4�4�4�4�4�4�4�4�4�4�4��u�c�5�%���d���;����C��C��#��S�����$P�P�P�P�0����
���$�s�C�x�.�9Q�����<�!��6>�s�m��
�c�]�����MO�6�6�'�6�<D�S�M�6�
�c�]�6�6�6�6�:	)��	)�"�	)�-=�	)�
�c�]�	)�	)�	)�	)�,�%5�,�#�,�,�,�,�&MQ����� ��+;��EI��
�c�]�����6+��+�y�+�;K�+�PX�Y\�P]�+�+�+�+�$+�U�+�u�+�/?�+�H�S�M�+�+�+�+�*.�D�.�T�.�,<�.��#��.�.�.�.��w�v����3�X�d�^�3��T�
�3�3�3�3�-3�"�9�9��9��9�)9�9�JM�9��9�&)�9��9��c�]�	9�9�9�9�x!�3�!�3�!�)9�!�h�s�m�!�!�!�!�6#-�"�*�W�b�l�"C�"C���C�C�C��C��C������S��S�����*�C�*�C�*�*:�*�*�*�*�Z5�U�5�u�5�/?�5�H�S�M�5�5�5�5�(� 0�(�X�c�]�(�(�(�(�@6�|�6��6�?O�6�T\�]`�Ta�6�6�6�6��������S�#�/�0�(�3�-�?�@����h����	�,����
�	�=���	�=���	�>��^��$�
���� �,��$��/��	�8����$ �D� �H� � � � �������$��%�%�%�%�%�%�%�%�"N#�N#�N#�N#�N#�V�N#�N#�N#�b9�9�9��i�
�&�&��
��#�!���������"�_�_�_��_��_��	_�
�_��
_��_��_��_��_��_��_��_��_��_� �c�]�!_�_�_�_�D���������@_�_�_�_�_�#�_�_�_�Dl�l�l�l�l�+�l�l�l�^	M�	M�	M�	M�	M�
�	M�	M�	M�S�S�S�S�S�$�S�S�S�h�h�h�h�h�*�h�h�h�V,'�,'�,'�,'�,'�,'�,'�,'�^F�F�F�F�F�F�F�F�6J�J�J�J�J�J�J�J�J�Jr,

Hacked By AnonymousFox1.0, Coded By AnonymousFox