Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/unittest/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/unittest/__pycache__/mock.cpython-311.opt-2.pyc
�

�,d����`�dZddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZmZddlmZGd�d	e��Zd
�ee��D��ZdZeZd�Zd
�Zd�Zd�Zd�Z d�Z!dyd�Z"d�Z#d�Z$d�Z%d�Z&dyd�Z'd�Z(d�Z)d�Z*Gd�de+��Z,Gd�de+��Z-e-��Z.e.j/Z/e.j0Z1e.j2Z3hd �Z4d!�Z5Gd"�d#e6��Z7d$�Z8Gd%�d&e+��Z9Gd'�d(e+��Z:Gd)�d*e:��Z;ej<e;j=��Z>Gd+�d,e6��Z?d-�Z@Gd.�d/e:��ZAGd0�d1eAe;��ZBd2�ZCGd3�d4e+��ZDd5�ZEe/dddddfdd6�d7�ZF		dzd8�ZGe/dddddfdd6�d9�ZHGd:�d;e+��ZId<�ZJd=�ZKeFeH_+eIeH_LeGeH_MeKeH_Nd>eH_Od?ZPd@ZQdA�RdB�eQ�S��D����ZTdA�RdC�eQ�S��D����ZUhdD�ZVdE�ZWdF�dA�RePeQeTeUg���S��D��ZXhdG�ZYdHhZZeYeZzZ[eXeVzZ\e\e[zZ]hdI�Z^dJ�dK�dL�dM�dN�Z_e`e`e`e`dOddddPdQddOddR�
ZadS�ZbdT�ZcdU�ZddV�ZeebecedeedW�ZfdX�ZgGdY�dZe:��ZhGd[�d\ehe;��ZiGd]�d^eh��ZjGd_�d`eheB��ZkGda�dbe:��ZlGdc�dde:��ZmGde�dfemejeB��ZnGdg�dhe+��Zoeo��Zpdi�ZqGdj�dker��Zsesd�l��Zt		d{dd6�dm�Zudn�ZvGdo�dpe+��Zwexeu��exepjy��fZzda{da|dq�Z}d|ds�Z~Gdt�dueB��Zdv�Z�Gdw�dx��Z�dS)})�Mock�	MagicMock�patch�sentinel�DEFAULT�ANY�call�create_autospec�	AsyncMock�
FILTER_DIR�NonCallableMock�NonCallableMagicMock�	mock_open�PropertyMock�seal�N)�iscoroutinefunction)�CodeType�
ModuleType�
MethodType)�	safe_repr)�wraps�partial)�RLockc��eZdZdS)�InvalidSpecErrorN��__name__�
__module__�__qualname__���4/opt/alt/python311/lib64/python3.11/unittest/mock.pyrr)s������B�Br!rc�<�h|]}|�d���|��S��_��
startswith)�.0�names  r"�	<setcomp>r*-s)��H�H�H�d�4�?�?�3�3G�3G�H�T�H�H�Hr!Tc���t|��rt|t��sdSt|d��rt	|d��}t|��pt
j|��S)NF�__func__)�_is_instance_mock�
isinstancer
�hasattr�getattrr�inspect�isawaitable��objs r"�
_is_async_objr55sg�������j��i�&@�&@���u��s�J���'��c�:�&�&���s�#�#�?�w�':�3�'?�'?�?r!c�F�t|dd��rt|��SdS)N�__code__F)r0r)�funcs r"�_is_async_funcr9=s)���t�Z��&�&��"�4�(�(�(��ur!c�F�tt|��t��S�N)�
issubclass�typerr3s r"r-r-Ds���d�3�i�i��1�1�1r!c��t|t��p)t|t��ot|t��Sr;)r.�
BaseExceptionr=r<r3s r"�
_is_exceptionr@Js6���3�
�&�&�	A��3����@�*�S�-�"@�"@�r!c�^�t|t��rt|d��r|jS|S�N�mock)r.�
FunctionTypesr/rCr3s r"�
_extract_mockrEQs3���#�}�%�%��'�#�v�*>�*>���x���
r!c��	t|t��r|s
|j}d}n/t|t��s	|j}n#t
$rYdSwxYw|rt
|d��}n|}	|tj|��fS#t$rYdSwxYw�NT)
r.r=�__init__rD�__call__�AttributeErrorrr1�	signature�
ValueError)r8�as_instance�eat_self�sig_funcs    r"�_get_signature_objectrPZs����
�$�����k���}�����
��m�
,�
,��	��=�D�D���	�	�	��4�4�	�������4��&�&�������W�&�x�0�0�0�0�������t�t����s#�A�
A�A�(A>�>
B�BFc���t|||�����dS�\}��fd�}t||��|t|��_�t|��_dS)Nc�"���j|i|��dSr;��bind)�self�args�kwargs�sigs   �r"�checksigz"_check_signature.<locals>.checksig|� ������$�!�&�!�!�!�!�!r!)rP�_copy_func_detailsr=�_mock_check_sig�
__signature__)r8rC�	skipfirst�instancerYrXs     @r"�_check_signaturer`wsr���
��h�	�
:�
:�C�
�{����I�D�#�"�"�"�"�"��t�X�&�&�&�!)�D��J�J��"�D��J�J���r!c	�p�dD]2}	t||t||�����##t$rY�/wxYwdS)N)r�__doc__�__text_signature__r�__defaults__�__kwdefaults__)�setattrr0rJ)r8�funcopy�	attributes   r"r[r[�sa�����	�	��G�Y���i�(@�(@�A�A�A�A���	�	�	��D�	����
�s�&�
3�3c���t|t��rdSt|tttf��rt|j��St|dd���dSdS)NTrIF)r.r=�staticmethod�classmethodr�	_callabler,r0r3s r"rlrl�s^���#�t�����t��#��k�:�>�?�?�'����&�&�&��s�J��%�%�1��t��5r!c�<�t|��ttfvSr;)r=�list�tupler3s r"�_is_listrp�s����9�9��u�
�%�%r!c��	t|t��st|dd��duS|f|jzD]}|j�d���dS� dS)NrITF)r.r=r0�__mro__�__dict__�get)r4�bases  r"�_instance_callablerv�sr��@��c�4� � �:��s�J��-�-�T�9�9�����$�����=���Z�(�(�4��4�4�5��5r!c�0��t|t��}t|||��}|�|S|\}��fd�}t||��|j}|���sd}||d�}d|z}	t
|	|��||}
t|
|���|
S)Nc�"���j|i|��dSr;rS)rVrWrXs  �r"rYz _set_signature.<locals>.checksig�rZr!rg)�
_checksig_rCzYdef %s(*args, **kwargs):
    _checksig_(*args, **kwargs)
    return mock(*args, **kwargs))r.r=rPr[r�isidentifier�exec�_setup_func)rC�originalr_r^�resultr8rYr)�context�srcrgrXs           @r"�_set_signaturer��s����
�8�T�*�*�I�
"�8�X�y�
A�
A�F�
�~����I�D�#�"�"�"�"�"��t�X�&�&�&���D���������%�t�4�4�G�$�&*�+�C�	�#�w�����d�m�G����s�#�#�#��Nr!c�������_�fd�}�fd�}�fd�}�fd�}�fd�}�fd�}�fd�}	��fd�}
d	�_d
�_d�_t	���_t	���_t	���_�j�_�j	�_	�j
�_
|�_|�_|�_
|	�_|
�_|�_|�_|�_|�_��_dS)Nc����j|i|��Sr;)�assert_called_with�rVrWrCs  �r"r�z'_setup_func.<locals>.assert_called_with�����&�t�&��7��7�7�7r!c����j|i|��Sr;)�
assert_calledr�s  �r"r�z"_setup_func.<locals>.assert_called�s���!�t�!�4�2�6�2�2�2r!c����j|i|��Sr;)�assert_not_calledr�s  �r"r�z&_setup_func.<locals>.assert_not_called�s���%�t�%�t�6�v�6�6�6r!c����j|i|��Sr;)�assert_called_oncer�s  �r"r�z'_setup_func.<locals>.assert_called_once�r�r!c����j|i|��Sr;)�assert_called_once_withr�s  �r"r�z,_setup_func.<locals>.assert_called_once_with�s���+�t�+�T�<�V�<�<�<r!c����j|i|��Sr;)�assert_has_callsr�s  �r"r�z%_setup_func.<locals>.assert_has_calls�s���$�t�$�d�5�f�5�5�5r!c����j|i|��Sr;)�assert_any_callr�s  �r"r�z$_setup_func.<locals>.assert_any_call�s���#�t�#�T�4�V�4�4�4r!c����t���_t���_�����j}t|��r|�ur|���dSdSdSr;)�	_CallList�method_calls�
mock_calls�
reset_mock�return_valuer-)�retrgrCs ��r"r�z_setup_func.<locals>.reset_mock�so���(�{�{���&�[�[����������"���S�!�!�	�#��+�+��N�N������	�	�+�+r!Fr)rC�called�
call_count�	call_argsr��call_args_listr�r�r��side_effect�_mock_childrenr�r�r�r�r�r�r�r�r]�_mock_delegate)rgrCrXr�r�r�r�r�r�r�r�s``         r"r|r|�s������G�L�8�8�8�8�8�3�3�3�3�3�7�7�7�7�7�8�8�8�8�8�=�=�=�=�=�6�6�6�6�6�5�5�5�5�5��������G�N��G���G��&�[�[�G��$�;�;�G��"���G���,�G���*�G��!�0�G��!3�G��&=�G�#�/�G��-�G��#�G��)�G�� 1�G��!3�G���G��!�D���r!c	����tjj�_d�_d�_t���_�fd�}dD]!}t�|t||�����"dS)Nrc�:��t�j|��|i|��Sr;)r0rC)�attrrVrWrCs   �r"�wrapperz"_setup_async_mock.<locals>.wrappers$���'�w�t�y�$�'�'��8��8�8�8r!)�assert_awaited�assert_awaited_once�assert_awaited_with�assert_awaited_once_with�assert_any_await�assert_has_awaits�assert_not_awaited)	�asyncio�
coroutines�
_is_coroutine�await_count�
await_argsr��await_args_listrfr)rCr�rhs`  r"�_setup_async_mockr��s���� �+�9�D���D���D�O�$�;�;�D��
9�9�9�9�9�,�>�>�	�	��i���)�!<�!<�=�=�=�=�>�>r!c�$�d|dd�z|kS)N�__%s__����r �r)s r"�	_is_magicr�s���d�1�R�4�j� �D�(�(r!c�"�eZdZ	d�Zd�Zd�ZdS)�_SentinelObjectc��||_dSr;r��rUr)s  r"rHz_SentinelObject.__init__s
����	�	�	r!c��d|jzS�Nzsentinel.%sr��rUs r"�__repr__z_SentinelObject.__repr__����t�y�(�(r!c��d|jzSr�r�r�s r"�
__reduce__z_SentinelObject.__reduce__"r�r!N)rrrrHr�r�r r!r"r�r�sD������'����)�)�)�)�)�)�)�)r!r�c�"�eZdZ	d�Zd�Zd�ZdS)�	_Sentinelc��i|_dSr;)�
_sentinelsr�s r"rHz_Sentinel.__init__(s
������r!c�l�|dkrt�|j�|t|����S)N�	__bases__)rJr��
setdefaultr�r�s  r"�__getattr__z_Sentinel.__getattr__+s3���;��� � ���)�)�$���0E�0E�F�F�Fr!c��dS)Nrr r�s r"r�z_Sentinel.__reduce__1s���zr!N)rrrrHr�r�r r!r"r�r�&sG������K����G�G�G�����r!r�>�
_mock_namer��_mock_parentr��_mock_new_name�_mock_new_parent�_mock_side_effect�_mock_return_valuec�x�t�|��d|z}||fd�}||fd�}t||��S)N�_mock_c�T�|j}|�t||��St||��Sr;)r�r0)rUr)�	_the_namerXs    r"�_getz"_delegating_property.<locals>._getFs/���!���;��4��+�+�+��s�D�!�!�!r!c�R�|j}|�||j|<dSt|||��dSr;)r�rsrf)rU�valuer)r�rXs     r"�_setz"_delegating_property.<locals>._setKs9���!���;�',�D�M�)�$�$�$��C��u�%�%�%�%�%r!)�_allowed_names�add�property)r)r�r�r�s    r"�_delegating_propertyr�Cse�����t�����4��I��	�"�"�"�"�
 $�y�&�&�&�&��D�$���r!c��eZdZd�Zd�ZdS)r�c��t|t��st�||��St|��}t|��}||krdSt	d||z
dz��D]}||||z�}||krdS�dS)NFr�T)r.rn�__contains__�len�range)rUr��	len_value�len_self�i�sub_lists      r"r�z_CallList.__contains__Xs����%��&�&�	2��$�$�T�5�1�1�1���J�J�	��t�9�9���x����5��q�(�Y�.��2�3�3�	�	�A��A�a�	�k�M�*�H��5� � ��t�t�!��ur!c�D�tjt|����Sr;)�pprint�pformatrnr�s r"r�z_CallList.__repr__fs���~�d�4�j�j�)�)�)r!N)rrrr�r�r r!r"r�r�Vs2���������*�*�*�*�*r!r�c���t|��}t|��sdS|js|js|j�|j�dS|}|�||urdS|j}|�|r||_||_|r||_||_dS)NFT)rEr-r�r�r�r�)�parentr�r)�new_name�_parents     r"�_check_and_set_parentr�js����%� � �E��U�#�#���u�	�	��U�1��	�	�	'�	�	�	+��u��G�
�
��e����5��*���
��(�!'���'���� �#�������4r!c��eZdZd�Zd�ZdS)�	_MockIterc�.�t|��|_dSr;)�iterr4)rUr4s  r"rHz_MockIter.__init__�s����9�9����r!c�*�t|j��Sr;)�nextr4r�s r"�__next__z_MockIter.__next__�s���D�H�~�~�r!N)rrrrHr�r r!r"r�r��s2�������������r!r�c��eZdZeZdZd�ZdS)�BaseNc��dSr;r �rUrVrWs   r"rHz
Base.__init__�s���r!)rrrrr�r�rHr r!r"r�r��s/������ ����
�
�
�
�
r!r�c��eZdZ	e��Zd�Z			d,d�Zd�Zd-d�Z		d.d�Z	d	�Z
d
�ZdZe
e
ee��Ze
d���Zed
��Zed��Zed��Zed��Zed��Zd�Zd�Ze
ee��Zd/ddd�d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d0d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d-d'�Z*d(�Z+d)�Z,d1d+�Z-dS)2rc�z�|f}t|t��s]tj|g|�Ri|��j}|�d|�d����}|�t
|��r	t|f}t|j|d|j	i��}tt|���|��}|S)N�spec_set�specrb)
r<�AsyncMockMixin�	_MOCK_SIG�bind_partial�	argumentsrtr5r=rrb�_safe_superr�__new__)�clsrV�kw�bases�
bound_args�spec_arg�newr_s        r"rzNonCallableMock.__new__�s�������#�~�.�.�	.�"�/��A�d�A�A�A�b�A�A�K�J�!�~�~�j�*�.�.��2H�2H�I�I�H��#�
�h�(?�(?�#�'��-���3�<���C�K�(@�A�A�����4�4�<�<�S�A�A���r!N�Fc��|�|}|j}
||
d<||
d<||
d<||
d<d|
d<|�|}d}|
�|du}
|�|||	|
��i|
d<||
d	<d|
d
<d|
d<d|
d<d
|
d<t��|
d<t��|
d<t��|
d<||
d<|r
|jdi|��t	t
|���||||||��dS)Nr�r�r�r�F�_mock_sealedTr��_mock_wrapsr��_mock_called�_mock_call_argsr�_mock_call_count�_mock_call_args_list�_mock_mock_callsr��_mock_unsafer )rs�_mock_add_specr��configure_mockrrrH)rUr�rr)r�r��_spec_state�	_new_name�_new_parent�_spec_as_instance�	_eat_self�unsaferWrss              r"rHzNonCallableMock.__init__�sV��
�� �K��=��#)��� �!%����%.��!�"�'2��#�$�#(��� ����D��H����d�*�I����D�(�,=�y�I�I�I�%'��!�"�"'����%)��!�"�#(��� �&*��"�#�'(��#�$�+4�;�;��'�(�'0�{�{��#�$�#,�;�;��� �#)��� ��	*��D��)�)�&�)�)�)��O�T�*�*�3�3��%��x���	
�	
�	
�	
�	
r!c��	t|��}d|_d|_d|_d|_t|||��dS�Nr)rEr�r�r�r�rf)rUrCrh�
inner_mocks    r"�attach_mockzNonCallableMock.attach_mock�sO��	C�#�4�(�(�
�"&�
��&*�
�#� "�
��$(�
�!���i��&�&�&�&�&r!c�4�	|�||��dSr;)r�rUr�r�s   r"�
mock_add_speczNonCallableMock.mock_add_spec�s&��	N�
	
���D�(�+�+�+�+�+r!c���t|��rtd|�d����d}d}g}t|��D]5}tt	||d����r|�|���6|�`t
|��sQt|t��r|}nt|��}t|||��}	|	o|	d}t|��}|j
}
||
d<||
d<||
d<||
d<||
d<dS)	Nz#Cannot spec a Mock object. [object=�]r��_spec_class�	_spec_set�_spec_signature�
_mock_methods�_spec_asyncs)r-r�dirrr0�appendrpr.r=rPrs)rUr�r�rrr'r)r+r��resrss           r"rzNonCallableMock._mock_add_spec�s'���T�"�"�	T�"�#R��#R�#R�#R�S�S�S���������I�I�	*�	*�D�"�7�4��t�#<�#<�=�=�
*��#�#�D�)�)�)����H�T�N�N���$��%�%�
)�"���"�4�j�j��'��(9�9�F�F�C�!�n�c�!�f�O��t�9�9�D��=��"-���� (����&5��"�#�$(���!�#/��� � � r!c��|j}|j�|jj}|tur|�|d���}||_|S)N�()�rr)r�r�r�r�_get_child_mock)rUr�s  r"�__get_return_valuez"NonCallableMock.__get_return_valuesU���%����*��%�2�C��'�>�>��&�&� �D�'���C�!$�D���
r!c�b�|j�||j_dS||_t||dd��dS)Nr0)r�r�r�r�)rUr�s  r"�__set_return_valuez"NonCallableMock.__set_return_values>����*�/4�D��,�,�,�&+�D�#�!�$��t�T�:�:�:�:�:r!z1The value to be returned when the mock is called.c�<�|j�t|��S|jSr;)r'r=r�s r"�	__class__zNonCallableMock.__class__+s ����#���:�:����r!r�r�r�r�r�c���|j}|�|jS|j}|�It|��s:t	|t
��s%t
|��st|��}||_|Sr;)r�r�r��callabler.r�r@)rU�	delegated�sfs   r"�__get_side_effectz!NonCallableMock.__get_side_effect8sj���'�	����)�)�
�
"���N�8�B�<�<�N�"�2�y�1�1�
�:G��:K�:K�
��2���B�$&�I�!��	r!c�V�t|��}|j}|�	||_dS||_dSr;)�	_try_iterr�r�r�)rUr�r:s   r"�__set_side_effectz!NonCallableMock.__set_side_effectCs9���%� � ���'�	���%*�D�"�"�"�$)�I�!�!�!r!�r�r�c�P�	|�g}t|��|vrdS|�t|����d|_d|_d|_t��|_t��|_t��|_|rt|_
|rd|_|j�
��D]9}t|t��s	|t ur�!|�|||����:|j
}t%|��r||ur|�|��dSdSdS)NFrr@)�idr-r�r�r�r�r�r�r�rr�r�r��valuesr.�
_SpecState�_deletedr�r-)rU�visitedr�r��childr�s      r"r�zNonCallableMock.reset_mockNs8��7��?��G�
�d�8�8�w����F����r�$�x�x� � � ����������#�+�+���'�k�k���%�K�K����	.�&-�D�#��	*�%)�D�"��(�/�/�1�1�	Z�	Z�E��%��,�,�
���0A�0A�����W�<�[��Y�Y�Y�Y��%���S�!�!�	$�c��o�o��N�N�7�#�#�#�#�#�	$�	$�o�or!c��	t|���d����D]V\}}|�d��}|���}|}|D]}t	||��}�t|||���WdS)Nc�8�|d�d��S)Nr�.)�count)�entrys r"�<lambda>z0NonCallableMock.configure_mock.<locals>.<lambda>ys���q�����1D�1D�r!)�keyrJ)�sorted�items�split�popr0rf)rUrW�arg�valrV�finalr4rLs        r"rzNonCallableMock.configure_mockls���	,��v�|�|�~�~�$E�#D�	F�F�F�
	%�
	%�H�C��
�9�9�S�>�>�D��H�H�J�J�E��C��
*�
*���c�5�)�)����C���$�$�$�$�
	%�
	%r!c
��|dvrt|���|j�%||jvs	|tvrtd|z���nt|��rt|���|js:|jr	||jvr*|�d��rt|�d|�d����tj5|j�	|��}|turt|���|�Cd}|j�t|j|��}|�
|||||���}||j|<n�t|t��rv	t!|j|j|j|j|j��}n>#t,$r1|jdp|}t-d|�d	|�d
|�d|j�d�	���wxYw||j|<ddd��n#1swxYwY|S)
N>rr*zMock object has no attribute %r)�assert�assret�asert�aseert�assrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)r�r)rrrr��Cannot autospec attr �
 from target �, as it has already been mocked out. [target=�, attr=r&)rJr*�_all_magicsr�rr'r�_lockr�rtrErr0r2r.rDr	r�r�r_r�r)rrs)rUr)r~r�target_names     r"r�zNonCallableMock.__getattr__�s����4�4�4� ��&�&�&�
�
�
+��4�-�-�-���1D�1D�$�%F��%M�N�N�N�2E�
�t�_�_�	'� ��&�&�&�� �	N�$�*<�	N��D�L^�@^�@^����O�P�P�
N�$��M�M�'+�M�M�M�N�N�N��
"�	4�	4��(�,�,�T�2�2�F���!�!�$�T�*�*�*������#�/�$�D�$4�d�;�;�E��-�-��d�%�4� $�.����.4��#�D�)�)��F�J�/�/�
4�
D�,���V�_�f�o��
�v�{���F�F��(�D�D�D�"&�-��"=�"E��K�*�C��C�C�&�C�C�#'�C�C�28�+�C�C�C�D�D�D�D����.4��#�D�)�;	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�>�
s+�+B
F:�9,E&�%F:�&;F!�!
F:�:F>�F>c�n�|jg}|j}|}d}|dgkrd}|�7|}|�|j|z��d}|jdkrd}|j}|�7tt	|����}|jpd}t
|��dkr|ddvr|dz
}||d<d�|��S)NrJr0rrCr�)r0z().r)r�r�r-rn�reversedr�r��join)rU�
_name_listr��last�dot�_firsts      r"�_extract_mock_namez"NonCallableMock._extract_mock_name�s����)�*�
��'�������$�����C��!��D����g�4�s�:�;�;�;��C��%��-�-����.�G��!��(�:�.�.�/�/�
���*�F���z�?�?�Q����!�}�M�1�1��#�
���
�1�
��w�w�z�"�"�"r!c���|���}d}|dvrd|z}d}|j�d}|jrd}||jjz}dt	|��j�|�|�dt|���d�S)	Nr)rCzmock.z name=%rz spec=%rz spec_set=%r�<z id='z'>)rjr'r(rr=rB)rUr)�name_string�spec_strings    r"r�zNonCallableMock.__repr__�s����&�&�(�(�����(�(�(�$�t�+�K�����'�$�K��~�
-�,��%��(8�(A�A�K����J�J����K��K�K��t�H�H�H�H�	
�	
r!c�x�	tst�|��S|jpg}t	t|����}t
|j��}d�|j�	��D��}d�|D��}d�|D��}tt||z|z|z����S)Nc�*�g|]\}}|tu�|��Sr )rE)r(�m_name�m_values   r"�
<listcomp>z+NonCallableMock.__dir__.<locals>.<listcomp>�s1��(�(�(�&�v�w��h�&�&�
�&�&�&r!c�<�g|]}|�d���|��Sr$r&�r(�es  r"rsz+NonCallableMock.__dir__.<locals>.<listcomp>�s)��C�C�C�1����c�1B�1B�C�Q�C�C�Cr!c�Z�g|](}|�d��rt|���&|��)Sr$)r'r�rus  r"rsz+NonCallableMock.__dir__.<locals>.<listcomp>�sE��#�#�#�1����c�1B�1B�#��q�\�\�#�Q�#�#�#r!)r�object�__dir__r*r,r=rnrsr�rPrO�set)rU�extras�	from_type�	from_dict�from_child_mockss     r"ryzNonCallableMock.__dir__�s���F��	(��>�>�$�'�'�'��#�)�r����T�
�
�O�O�	����'�'�	�(�(�*.�*=�*C�*C�*E�*E�(�(�(��D�C�	�C�C�C�	�#�#�	�#�#�#�	��c�&�9�,�y�8�;K�K�L�L�M�M�Mr!c�T���|tvrt��||��S�jr+�j�$|�jvr|�jvrt
d|z���|tvrd|z}t
|���|tvr��j�|�jvrt
d|z���t|��s5tt���|t||����|���fd�}nft�|d|��tt���||��|�j|<n+|dkr	|�_dSt�|||��r
|�j|<�jr;t#�|��s+�����d|��}t
d|�����t��||��S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.c�����g|�Ri|��Sr;r )rVrr}rUs  ��r"rMz-NonCallableMock.__setattr__.<locals>.<lambda>s!���H�H�T�,G�D�,G�,G�,G�B�,G�,G�r!r7rJzCannot set )r�rx�__setattr__r(r*rsrJ�_unsupported_magicsr`r-rfr=�_get_methodr�r�r'rr/rj)rUr)r��msg�	mock_namer}s`    @r"r�zNonCallableMock.__setattr__�s������>�!�!��%�%�d�D�%�8�8�8��n�	2��!3�!?���*�*�*���
�%�%� �!D�t�!K�L�L�L�
�(�
(�
(�B�T�I�C� ��%�%�%�
�[�
 �
 ��!�-�$�d�>P�2P�2P�$�%H�4�%O�P�P�P�$�U�+�+�	
2���T�
�
�D�+�d�E�*B�*B�C�C�C� ��G�G�G�G�G���&�d�E�4��>�>�>���T�
�
�D�%�0�0�0�,1��#�D�)�)�
�[�
 �
 �$�D���F�$�T�5�$��=�=�
2�,1��#�D�)���	<�W�T�4�%8�%8�	<��2�2�4�4�=�=�t�=�=�I� �!:�y�!:�!:�;�;�;��!�!�$��e�4�4�4r!c��|tvr>|t|��jvr(tt|��|��||jvrdS|j�|t��}||jvr)tt|���	|��n|turt|���|tur|j|=t|j|<dSr;)r`r=rs�delattrr�rt�_missingrr�__delattr__rErJ)rUr)r4s   r"r�zNonCallableMock.__delattr__s����;���4�4��:�:�+>�#>�#>��D��J�J��%�%�%��4�=�(�(����!�%�%�d�H�5�5���4�=� � ����.�.�:�:�4�@�@�@�@�
�H�_�_� ��&�&�&��h����#�D�)�$,���D�!�!�!r!c�6�|jpd}t|||��SrB)r��_format_call_signature�rUrVrWr)s    r"�_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature-s ����(�&��%�d�D�&�9�9�9r!rc�d�d}|�||��}|j}|j|�}||||fzS)Nz.expected %s not found.
Expected: %s
Actual: %s)r�r�)rUrVrW�action�message�expected_stringr��
actual_strings        r"�_format_mock_failure_messagez,NonCallableMock._format_mock_failure_message2sD��D���:�:�4��H�H���N�	�8��8�)�D�
��&�/�=�A�A�Ar!c��	|s|jSd}|�dd���d��}|j}|D]M}|�|��}|�t|t��rnt|��}|j}|j}�N|S)Nr0rrJ)r)�replacerQr�rtr.rDrE)rUr)rX�names�childrenrGs      r"�_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_name:s���		��	(��'�'������T�2�&�&�,�,�S�1�1���&���
	,�
	,�D��L�L��&�&�E��}�
�5�*� =� =�}���
&�e�,�,�� �/���+����
r!c��	t|t��r/t|��dkr|�|d��}n|j}|�vt|��dkrd}|\}}n|\}}}	|j|i|��}t
||j|j��S#t$r}|�
d��cYd}~Sd}~wwxYw|S)Nr�rr)r.ror�r�r)rTrrVrW�	TypeError�with_traceback)rU�_callrXr)rVrW�
bound_callrvs        r"�
_call_matcherzNonCallableMock._call_matcher[s���	��e�U�#�#�	'��E�
�
�Q����4�4�U�1�X�>�>�C�C��&�C��?��5�z�z�Q�����$���f�f�%*�"��d�F�
.�%�S�X�t�6�v�6�6�
��D�*�/�:�3D�E�E�E���
.�
.�
.��'�'��-�-�-�-�-�-�-�-�����
.�����Ls�1'B�
C�#B=�7C�=Cc��	|jdkr8d|jpd�d|j�d|�����}t|���dS)Nr�
Expected 'rCz"' to not have been called. Called � times.�r�r��_calls_repr�AssertionError�rUr�s  r"r�z!NonCallableMock.assert_not_calledvsa��	��?�a�����o�/��/�/��o�o�o��&�&�(�(�(�*�C�!��%�%�%� �r!c�T�	|jdkrd|jpdz}t|���dS)Nrz"Expected '%s' to have been called.rC)r�r�r�r�s  r"r�zNonCallableMock.assert_called�s>��	��?�a���7��O�-�v�/�C� ��%�%�%� �r!c��	|jdks8d|jpd�d|j�d|�����}t|���dS)Nr�r�rCz#' to have been called once. Called r�r�r�s  r"r�z"NonCallableMock.assert_called_once�sa��	���!�#�#�#��o�/��/�/��o�o�o��&�&�(�(�(�*�C�!��%�%�%�$�#r!c�v����	�j�/������}d}d|�d|��}t|������fd�}��t	��fd�����}���j��}||kr1t|t��r|nd}t|����|�dS)Nznot called.z#expected call not found.
Expected: �	
Actual: c�4��������}|Sr;�r��r�rVrWrUs ���r"�_error_messagez:NonCallableMock.assert_called_with.<locals>._error_message�s����3�3�D�&�A�A�C��Jr!T��two)r�r�r�r��_Callr.�	Exception)rUrVrW�expected�actual�
error_messager��causes```     r"r�z"NonCallableMock.assert_called_with�s������	3��>�!��7�7��f�E�E�H�"�F�F��x�x���)�M� ��/�/�/�	�	�	�	�	�	�	��%�%�e�T�6�N��&E�&E�&E�F�F���#�#�D�N�3�3���X��� *�8�Y� ?� ?�I�H�H�T�E� ���!1�!1�2�2��=��r!c��	|jdks8d|jpd�d|j�d|�����}t|���|j|i|��S)Nr�r�rCz' to be called once. Called r�)r�r�r�r�r��rUrVrWr�s    r"r�z'NonCallableMock.assert_called_once_with�sq��	)���!�#�#�#��o�/��/�/��o�o�o��&�&�(�(�(�*�C�!��%�%�%�&�t�&��7��7�7�7r!c���	�fd�|D��}td�|D��d��}t�fd��jD����}|su||vro|�d}nd�d�|D����}t	|�dt|�����d�	���d
������|�dSt|��}g}|D]=}	|�|���#t$r|�
|��Y�:wxYw|r-t	�jpd�dt|���d
|�d���|�dS)Nc�:��g|]}��|����Sr �r��r(�crUs  �r"rsz4NonCallableMock.assert_has_calls.<locals>.<listcomp>��'���9�9�9�a�D�&�&�q�)�)�9�9�9r!c3�DK�|]}t|t���|V��dSr;�r.r�rus  r"�	<genexpr>z3NonCallableMock.assert_has_calls.<locals>.<genexpr>��1����F�F�A�Z��9�-E�-E�F�a�F�F�F�F�F�Fr!c3�B�K�|]}��|��V��dSr;r�r�s  �r"r�z3NonCallableMock.assert_has_calls.<locals>.<genexpr>�s1�����M�M��d�0�0��3�3�M�M�M�M�M�Mr!zCalls not found.z+Error processing expected calls.
Errors: {}c�@�g|]}t|t��r|nd��Sr;r�rus  r"rsz4NonCallableMock.assert_has_calls.<locals>.<listcomp>��;��$7�$7�$7�()�*4�A�y�)A�)A�$K�A�A�t�$7�$7�$7r!�
Expected: �Actual)�prefixrJrCz does not contain all of z in its call list, found z instead)
r�r�r��formatr�r��rstriprn�removerLr-r�ro)	rU�calls�	any_orderr�r��	all_calls�problem�	not_found�kalls	`        r"r�z NonCallableMock.assert_has_calls�s����	1�:�9�9�9�5�9�9�9���F�F��F�F�F��M�M���M�M�M�M�T�_�M�M�M�M�M�	��	��y�(�(��=�0�G�G� ,�-3�V�$7�$7�-5�$7�$7�$7�.8�.8��%��G�G�!*�5�!1�!1�G��'�'�x�'�8�8�?�?��D�D�G�G����	�

�F���O�O�	��	��	'�	'�D�
'�� � ��&�&�&�&���
'�
'�
'�� � ��&�&�&�&�&�
'�����	� �&*�o�&?��&?�&?�&+�I�&6�&6�&6�&6�	�	�	�C����	
�	�	s�C.�.D�Dc�&��	��t||fd�����}t|t��r|nd}�fd��jD��}|s|t|��vr)��||��}td|z��|�dS)NTr�c�:��g|]}��|����Sr r�r�s  �r"rsz3NonCallableMock.assert_any_call.<locals>.<listcomp>�s'���E�E�E�A�$�$�$�Q�'�'�E�E�Er!z%s call not found)r�r�r.r�r��_AnyComparerr�r��rUrVrWr�r�r�r�s`      r"r�zNonCallableMock.assert_any_call�s����	,�
�%�%�e�T�6�N��&E�&E�&E�F�F��&�x��;�;�E�����E�E�E�E��1D�E�E�E���	�H�L��$8�$8�8�8�"�>�>�t�V�L�L�O� �#�o�5����
�9�8r!c��	|jr7d|vrd|d��nd}|���|z}t|���|�d��}||jdvrtdi|��St
|��}t|t��r|tvrt
}n�t|t��r)|tvs|jr||jvrt}ndt
}n\t|t��s:t|t��rt}n*t|t��rt }n
|jd}|di|��S)Nr)rJr0rr+r�r )rrjrJrtrsr
r=r<r�_async_method_magicsr�_all_sync_magicsr*�
CallableMixinr
rrrr)rUrrhr�r�_type�klasss       r"r2zNonCallableMock._get_child_mock�s`��	!���	,�,2�b�L�L�(�B�v�J�(�(�(�d�I��/�/�1�1�I�=�I� ��+�+�+��F�F�;�'�'�	���
�n�5�5�5��?�?�r�?�?�"��T�
�
���e�Y�'�'�	%�I�9M�,M�,M��E�E�
��~�
.�
.�
	%��-�-�-��&�.�+4��8J�+J�+J�!���!����E�=�1�1�	%��%�!5�6�6�
�!����E�?�3�3�
�����M�!�$�E��u�{�{�r�{�{�r!�Callsc�L�	|jsdSd|�dt|j���d�S)Nr�
z: rJ)r�r)rUr�s  r"r�zNonCallableMock._calls_reprs;��	���	��2�;�F�;�;�i���8�8�;�;�;�;r!)NNNNNNrNFNF�F)FFr;)r)r�).rrrrrarrHr!r$r�"_NonCallableMock__get_return_value�"_NonCallableMock__set_return_value�"_NonCallableMock__return_value_docr�r�r7r�r�r�r�r�r��!_NonCallableMock__get_side_effect�!_NonCallableMock__set_side_effectr�r�rr�rjr�ryr�r�r�r�r�r�r�r�r�r�r�r�r�r2r�r r!r"rr�s�������*�
�E�G�G�E�
�
�
�">B�EI�<A�*
�*
�*
�*
�Z'�'�'�,�,�,�,�@E�!&�0�0�0�0�>
�
�
�;�;�;�M���8�.�0B�.�0�0�L�� � ��X� �
"�
!�(�
+�
+�F�%�%�l�3�3�J�$�$�[�1�1�I�)�)�*:�;�;�N�%�%�l�3�3�J�	�	�	�*�*�*��(�,�.?�@�@�K�$�u�%�$�$�$�$�$�<%�%�%�,-�-�-�`#�#�#�6
�
�
�*N�N�N�$$5�$5�$5�N-�-�-�$:�:�:�
B�B�B�B����B���6&�&�&�&�&�&�&�&�&�>�>�>�,	8�	8�	8�*�*�*�*�Z
�
�
� #�#�#�L
<�
<�
<�
<�
<�
<r!rc��eZdZ	d�ZdS)r�c�d�|D],}td�t||��D����rdS�-dS)Nc� �g|]\}}||k��Sr r )r(r�r�s   r"rsz-_AnyComparer.__contains__.<locals>.<listcomp>/s1�����$�H�f��F�"���r!TF)�all�zip)rU�itemr�s   r"r�z_AnyComparer.__contains__,s^���	�	�E����(+�D�%�(8�(8������
��t�t�	
�
�ur!N)rrrr�r r!r"r�r�'s(�����������r!r�c��|�|St|��r|St|��r|S	t|��S#t$r|cYSwxYwr;)r@rlr�r�r3s r"r>r>7sk��
�{��
��S�����
���~�~���
���C�y�y��������
�
�
����s�7�A�Ac
�H�eZdZddedddddddf
d�Zd�Zd�Zd�Zd�Zd�Z	dS)	r�Nrc
�x�||jd<tt|��j|||||||	|
fi|��||_dS)Nr�)rsrr�rHr�)rUr�r�r�rr)r�r�rrrrWs            r"rHzCallableMixin.__init__Hsa��/;��
�*�+�1��M�4�(�(�1��%��x����K�	
�	
�39�	
�	
�	
�
'����r!c��dSr;r r�s   r"r\zCallableMixin._mock_check_sigTs���r!c�P�|j|i|��|j|i|��|j|i|��Sr;)r\�_increment_mock_call�
_mock_callr�s   r"rIzCallableMixin.__call__YsK��	���d�-�f�-�-�-�!��!�4�2�6�2�2�2��t���/��/�/�/r!c��|j|i|��Sr;)�_execute_mock_callr�s   r"r�zCallableMixin._mock_callas��&�t�&��7��7�7�7r!c�~�d|_|xjdz
c_t||fd���}||_|j�|��|jdu}|j}|j}|dk}|j	�td||f����|j
}|��|rB|j�t|||f����|jdu}|r
|jdz|z}t|||f��}	|j	�|	��|jr|rd}
nd}
|jdk}|j|
z|z}|j
}|��dSdS)NTr�r�r0rrJ)r�r�r�r�r�r-r�r�r�r�r�r�)rUrVrWr��do_method_calls�method_call_name�mock_call_name�	is_a_callr�this_mock_callrhs           r"r�z"CallableMixin._increment_mock_callds���������1����
�t�V�n�$�/�/�/�������"�"�5�)�)�)��+�4�7���?���,��"�d�*�	�����u�b�$��%7�8�8�9�9�9��+���%��
W��(�/�/��7G��v�6V�0W�0W�X�X�X�"-�":�$�"F��"�W�'2�'=��'C�FV�'V�$�#�N�D�&�#A�B�B�N��"�)�)�.�9�9�9��)�
S����C�C��C�'�6�$�>�	�!,�!;�c�!A�N�!R��&�6�K�-�%�%�%�%�%r!c��|j}|�Tt|��r|�t|��s!t|��}t|��r|�n||i|��}|tur|S|jtur|jS|j�
|j|i|��S|jSr;)r�r@rlr�rr�r�r)rUrVrW�effectr~s     r"r�z CallableMixin._execute_mock_call�s����!�����V�$�$�
1����v�&�&�
1��f���� ��(�(�!� �L�!� ���0��0�0���W�$�$��
��"�'�1�1��$�$���'�#�4�#�T�4�V�4�4�4�� � r!)
rrrrrHr\rIr�r�r�r r!r"r�r�Fs������� �d���$��d�!�R�T�	'�	'�	'�	'�
�
�
�
0�0�0�8�8�8�,7�,7�,7�\!�!�!�!�!r!r�c��eZdZdS)rNrr r!r"rr�s������5�5r!rc�@�d}|D]}||vrt|�d�����dS)N)�	autospect�	auto_spec�set_specz5 might be a typo; use unsafe=True if this is intended)�RuntimeError)�kwargs_to_check�typos�typos   r"�_check_spec_arg_typosr�sN��2�E������?�"�"���P�P�P���
�#��r!c�~�eZdZdZgZdd�d�Zd�Zd�Zd�Ze	j
d���Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZdS)�_patchNF�rc
��|�)|turtd���|�td���|
st|	��t|��rt	d|�d|�d����t|��rt	d|�d|�d����||_||_||_||_||_	||_
d|_||_||_
|	|_g|_dS)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=r&z? as the spec_set target has already been mocked out. [spec_set=F)rrLrr-r�getterrhr�new_callabler��create�	has_localr��autospecrW�additional_patchers)rUr	rhrr�rr�r
r
rWrs           r"rHz_patch.__init__�sV���#��'�!�!� �B�����#� �G�����	*�!�&�)�)�)��T�"�"�	A�"�@�I�@�@�6:�@�@�@�A�A�
A��X�&�&�	P�"�O�I�O�O�AI�O�O�O�P�P�
P����"������(�����	������� ��
� ��
����#%�� � � r!c���t|j|j|j|j|j|j|j|j|j	�	�	}|j
|_
d�|jD��|_|S)Nc�6�g|]}|�����Sr )�copy)r(�ps  r"rsz_patch.copy.<locals>.<listcomp>#s-��'
�'
�'
��A�F�F�H�H�'
�'
�'
r!)rr	rhrr�rr�r
r
rW�attribute_namer)rU�patchers  r"rz_patch.copysq����K�����4�9��K����M�4�,�d�k�
�
��
"&�!4���'
�'
�"�6�'
�'
�'
��#��r!c���t|t��r|�|��Stj|��r|�|��S|�|��Sr;�r.r=�decorate_classr1r�decorate_async_callable�decorate_callable)rUr8s  r"rIz_patch.__call__)sc���d�D�!�!�	-��&�&�t�,�,�,��&�t�,�,�	6��/�/��5�5�5��%�%�d�+�+�+r!c��t|��D]q}|�tj��s�"t	||��}t|d��s�C|���}t||||�����r|S�NrI)r,r'r�TEST_PREFIXr0r/rrf)rUr�r��
attr_valuers     r"rz_patch.decorate_class1s�����J�J�		6�		6�D��?�?�5�#4�5�5�
�� ���-�-�J��:�z�2�2�
���i�i�k�k�G��E�4����!4�!4�5�5�5�5��r!c#�TK�g}tj��5}|jD]W}|�|��}|j�|�|���4|jtur|�|���X|t|��z
}||fV�ddd��dS#1swxYwYdSr;)
�
contextlib�	ExitStack�	patchings�
enter_contextr�updaterrr-ro)rU�patchedrV�keywargs�
extra_args�
exit_stack�patchingrSs        r"�decoration_helperz_patch.decoration_helper?s�����
�
�
!�
#�
#�		#�z�#�-�
+�
+�� �.�.�x�8�8���*�6��O�O�C�(�(�(�(��\�W�,�,��%�%�c�*�*�*���E�*�%�%�%�D���"�"�"�"�		#�		#�		#�		#�		#�		#�		#�		#�		#�		#�		#�		#����		#�		#�		#�		#�		#�		#s�A8B�B!�$B!c�����t�d��r�j�����St������fd�����g�_�S)Nr!c�|�����||��5\}}�|i|��cddd��S#1swxYwYdSr;�r)�rVr%�newargs�newkeywargsr8r$rUs    ���r"r$z)_patch.decorate_callable.<locals>.patchedTs�����'�'��(,�(0�2�2�
5�5K�g�{��t�W�4��4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5�
5�
5s�1�5�5�r/r!r-r�rUr8r$s``@r"rz_patch.decorate_callableNsv������4��%�%�	��N�!�!�$�'�'�'��K�	�t���	5�	5�	5�	5�	5�	5�
��	5�"�F����r!c�����t�d��r�j�����St������fd�����g�_�S)Nr!c���K����||��5\}}�|i|���d{V��cddd��S#1swxYwYdSr;r,r-s    ���r"r$z/_patch.decorate_async_callable.<locals>.patchedes�������'�'��(,�(0�2�2�
;�5K�g�{�!�T�7�:�k�:�:�:�:�:�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�
;�
;s
�9�=�=r0r1s``@r"rz_patch.decorate_async_callable_sv������4��%�%�	��N�!�!�$�'�'�'��K�	�t���	;�	;�	;�	;�	;�	;�
��	;�"�F����r!c�`�|���}|j}t}d}	|j|}d}n-#tt
f$rt
||t��}YnwxYw|tvrt|t��rd|_
|j
s|turt	|�d|�����||fS)NFTz does not have the attribute )r	rhrrsrJ�KeyErrorr0�	_builtinsr.rr)rU�targetr)r}�locals     r"�get_originalz_patch.get_originalps����������~������	���t�,�H��E�E����)�	6�	6�	6��v�t�W�5�5�H�H�H�	6����
�9����F�J�!?�!?���D�K��{�	�x�7�2�2� �7=�v�v�t�t�D���
����s�
6�'A �A c��	|j|j|j}}}|j|j}}|j}|���|_|durd}|durd}|durd}|�|�td���|�|�|dvrtd���|�	��\}}|tu�r�|���d}	|dur|}|dur|}d}n|�	|dur|}d}n|dur|}|�|�/|turtd���t|t��rd}	|�t|��rt}
nt}
i}|�|}
nN|�|�J|}|�|}t!|��rd|v}
nt#|��}
t|��rt}
n	|
rt$}
|�||d<|�||d	<t|
t��r&t'|
t(��r|jr
|j|d
<|�|��|
di|��}|	r_t/|��rP|}|�|}t!|��st1|��st$}
|�d
��|
d|dd�|��|_n�|��|turtd
���|turtd���t7|��}|dur|}t/|j��r#t9d|j�d|j�d|�d����t/|��rAt;|jd|j��}t9d|j�d|�d|j�d|�d�	���t=|f||jd�|��}n|rtd���|}||_||_ tCj"��|_#	tI|j|j|��|j%�ci}|jtur
|||j%<|j&D]?}|j#�'|��}|jtur|�|���@|S|S#|j(tSj*���s�YdSxYw)NFzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerIr�r�r)r0r1zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truer\z: as the patch target has already been mocked out. [target=r_r&rr]r^)r��_namez.Can't pass kwargs to a mock we aren't creatingr )+rr�r�r
rWr
r	r7r�r9rr.r=r5r
rrpr9r
r<rrhr#r-rvrRr��boolrr0r	�
temp_original�is_localrr �_exit_stackrfrrr"�__exit__�sys�exc_info)rUrr�r�r
rWr
r}r8�inherit�Klass�_kwargs�	this_spec�not_callablerb�new_attrr&r(rSs                   r"�	__enter__z_patch.__enter__�s��� �"�h��	�4�=�8�T���=�$�+�&���(���k�k�m�m����5�=�=��D��u����H��u����H���� 4��=�>�>�>�
�
��!5��L�(�(��T�U�U�U��+�+�-�-���%��'�>�>�h�.��G��t�|�|����t�#�#�'�H��D���!��t�#�#�#�H��D���T�!�!�#����8�#7��w�&�&�#�$G�H�H�H��h��-�-�#�"�G��|�
�h� 7� 7�|�!���!���G��'�$����!�X�%9� �	��'� (�I��I�&�&�;�#-�Y�#>�L�L�'/�	�':�':�#:�L� ��+�+�1�%�E�E�!�1�0�E���"&�����#�&.��
�#��5�$�'�'�
1��5�/�2�2�
1�7;�~�
1�"&�.�����N�N�6�"�"�"��%�"�"�'�"�"�C��
4�,�S�1�1�
4�!�	��'� (�I� ��+�+�1�&�y�1�1�1�0�E����F�#�#�#�#(�5�$4�S�D�$4�$4�+2�$4�$4�� ��
�
!��'�!�!��(�����7�"�"�� G�H�H�H��H�~�~�H��4���#�� ���-�-�
D�&�C�D�N�C�C�#�{�C�C�5=�C�C�C�D�D�D�!��*�*�
D�%�d�k�:�t�{�K�K��&�C�D�N�C�C�"�C�C�#�{�C�C�5=�C�C�C�D�D�D�
"�(�B�X�(,��B�B�:@�B�B�C�C�
�	N��L�M�M�M���%�����
�%�/�1�1���	��D�K����:�:�:��"�.��
��8�w�&�&�7:�J�t�2�3� $� 8�/�/�H��*�8�8��B�B�C��|�w�.�.�"�)�)�#�.�.�.��!�!��J��	� �4�=�#�,�.�.�1�
��
�
�
���s�BO�O�O=c�j�	|jr/|jtur!t|j|j|j��ndt
|j|j��|jsCt|j|j��r	|jdvr t|j|j|j��|`|`|`|j	}|`	|j
|�S)N)rbrrd�__annotations__re)r>r=rrfr7rhr�rr/r?r@)rUrBr's   r"r@z_patch.__exit__s�����=�		I�T�/�w�>�>��D�K����1C�D�D�D�D��D�K���0�0�0��;�
I����T�^�(L�(L�
I���+=�=�=����T�^�T�5G�H�H�H����M��K��%�
���"�z�"�H�-�-r!c�d�	|���}|j�|��|Sr;)rI�_active_patchesr-�rUr~s  r"�startz_patch.start/s0��;����!�!����#�#�D�)�)�)��
r!c��		|j�|��n#t$rYdSwxYw|�ddd��Sr;)rMr�rLr@r�s r"�stopz_patch.stop6s^��#�	�� �'�'��-�-�-�-���	�	�	��4�4�	�����}�}�T�4��.�.�.s��
,�,)rrrrrMrHrrIrr�contextmanagerr)rrr9rIr@rOrQr r!r"rr�s��������N��O�AF�"&�"&�"&�"&�"&�J
�
�
�,�,�,������#�#���#����"���"���0P�P�P�d.�.�.�*���/�/�/�/�/r!rc���	|�dd��\}}n-#tttf$rtd|�����wxYwt	t
j|��|fS)NrJr�z,Need a valid target to patch. You supplied: )�rsplitr�rLrJr�pkgutil�resolve_name)r7rhs  r"�_get_targetrWBs���G�"�M�M�#�q�1�1���	�	���z�>�2�G�G�G��E�6�E�E�G�G�	G�G�����7�'��0�0�)�;�;s	��*Arc���	t���turt��d�����fd�}
t|
||||||||	|��
�
S)Nz3 must be the actual object to be patched, not a strc����Sr;r �r7s�r"rMz_patch_object.<locals>.<lambda>as���V�r!r)r=�strr�r)r7rhrr�rr�r
r
rrWr	s`          r"�
_patch_objectr\Kss���
��F�|�|�s�����L�L�L�
�
�	
��^�^�^�F���	�3��f��(�L�&�����r!c���	t���turttj���}n�fd�}|std���t
|�����}|d\}	}
t||	|
|||||i�	�	}|	|_	|dd�D]=\}	}
t||	|
|||||i�	�	}|	|_	|j
�|���>|S)Nc����Sr;r rZs�r"rMz!_patch_multiple.<locals>.<lambda>�s����r!z=Must supply at least one keyword argument with patch.multiplerr�)r=r[rrUrVrLrnrPrrrr-)
r7r�rr�r
r
rWr	rPrhrr�this_patchers
`            r"�_patch_multipler`hs����(�F�|�|�s�����-�v�6�6���������
��K�
�
�	
�
������ � �E��1�X�N�I�s���	�3��f�h��,����G�'�G������)�9�9��	�3���I�s�D�&�(��l�B�
�
��'0��#��#�*�*�<�8�8�8�8��Nr!c�Z�	t|��\}	}
t|	|
||||||||��
�
S)Nr)rWr)r7rr�rr�r
r
rrWr	rhs           r"rr�sJ��F�N$�F�+�+��F�I���	�3��f��(�L�&�����r!c�T�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
dS)�_patch_dictr Fc��||_t|��|_|j�|��||_d|_dSr;)�in_dict�dictrCr#�clear�	_original)rUrerCrgrWs     r"rHz_patch_dict.__init__s>������6�l�l�������6�"�"�"���
�����r!c���t|t��r|�|��Stj|��r|�|��S|�|��Sr;r)rU�fs  r"rIz_patch_dict.__call__sc���a����	*��&�&�q�)�)�)��&�q�)�)�	3��/�/��2�2�2��%�%�a�(�(�(r!c�@���t�����fd���}|S)Nc�������	�|i|������S#����wxYwr;�rc�
_unpatch_dict�rVrrjrUs  ��r"�_innerz-_patch_dict.decorate_callable.<locals>._innersV���������
%��q�$�~�"�~�~��"�"�$�$�$�$���"�"�$�$�$�$���s	�3�A	�r�rUrjrps`` r"rz_patch_dict.decorate_callable�9����	�q���	%�	%�	%�	%�	%�
��	%��
r!c�@���t�����fd���}|S)Nc���K�����	�|i|���d{V��	����S#����wxYwr;rmros  ��r"rpz3_patch_dict.decorate_async_callable.<locals>._inner&so�����������
%��Q��^��^�^�+�+�+�+�+�+�+��"�"�$�$�$�$���"�"�$�$�$�$���s	�
<�Arqrrs`` r"rz#_patch_dict.decorate_async_callable%rsr!c� �t|��D]}}t||��}|�tj��rLt|d��r<t
|j|j|j	��}||��}t|||���~|Sr)r,r0r'rrr/rcrerCrgrf)rUr�r�r�	decorator�	decorateds      r"rz_patch_dict.decorate_class1s�����J�J�	0�	0�D� ���-�-�J����� 1�2�2�
0���Z�0�0�
0�'���d�k�4�:�N�N�	�%�I�j�1�1�	���t�Y�/�/�/���r!c�:�	|���|jSr;)rcrer�s r"rIz_patch_dict.__enter__<s����������|�r!c��|j}t|jt��rt	j|j��|_|j}|j}	|���}n"#t$ri}|D]
}||||<�YnwxYw||_	|rt|��	|�|��dS#t$r|D]
}||||<�YdSwxYwr;)rCr.rer[rUrVrgrrJrh�_clear_dictr#)rUrCrergr}rNs      r"rcz_patch_dict._patch_dictBs!������d�l�C�(�(�	>�"�/���=�=�D�L��,���
��	-��|�|�~�~�H�H���	-�	-�	-��H��
-�
-�� '�����
�
�
-�
-�		-����"����	!��� � � �	+��N�N�6�"�"�"�"�"���	+�	+�	+��
+�
+��%�c�{�����
+�
+�
+�	+���s$�A$�$B�B�B6�6C�Cc��|j}|j}t|��	|�|��dS#t$r|D]
}||||<�YdSwxYwr;)rerhr{r#rJ)rUrer}rNs    r"rnz_patch_dict._unpatch_dict^s����,���>���G����	-��N�N�8�$�$�$�$�$���	-�	-�	-��
-�
-��'��}�����
-�
-�
-�	-���s�6�A�Ac�>�	|j�|���dS�NF)rhrn)rUrVs  r"r@z_patch_dict.__exit__ks$����>�%���� � � ��ur!c�n�	|���}tj�|��|Sr;)rIrrMr-rNs  r"rOz_patch_dict.startrs0��;����!�!����%�%�d�+�+�+��
r!c��		tj�|��n#t$rYdSwxYw|�ddd��Sr;)rrMr�rLr@r�s r"rQz_patch_dict.stopys^��#�	��"�)�)�$�/�/�/�/���	�	�	��4�4�	�����}�}�T�4��.�.�.s�#�
1�1N)r F)rrrrHrIrrrrIrcrnr@rOrQr r!r"rcrc�s��������8����)�)�)�	�	�	�	�	�	�������+�+�+�8
-�
-�
-�������/�/�/�/�/r!rcc��	|���dS#t$rt|��}|D]}||=�YdSwxYwr;)rgrJrn)re�keysrNs   r"r{r{�se����
�
������������G�}�}���	�	�C�����	�	�	����s��!=�=c�h�	ttj��D]}|����dSr;)rdrrMrQ)rs r"�_patch_stopallr��s8��A��&�0�1�1����
�
�
������r!�testz�lt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow� c#� K�|]	}d|zV��
dS)zi%sNr �r(�ns  r"r�r��s&����7�7��5�1�9�7�7�7�7�7�7r!c#� K�|]	}d|zV��
dS)zr%sNr r�s  r"r�r��s&����5�5�q����5�5�5�5�5�5r!>ry�__get__�__set__r��
__delete__�
__format__r��__missing__�__getstate__�__reversed__�__setstate__�
__getformat__�
__reduce_ex__�__getnewargs__�__subclasses__�__getinitargs__�__getnewargs_ex__c�"��	�fd�}||_|S)Nc����|g|�Ri|��Sr;r )rUrVrr8s   �r"�methodz_get_method.<locals>.method�s#����t�D�&�4�&�&�&�2�&�&�&r!)r)r)r8r�s ` r"r�r��s+���@�'�'�'�'�'��F�O��Mr!c��h|]}d|z��S)r�r )r(r�s  r"r*r*�s*����� �H�v����r!>�	__aexit__�	__anext__�
__aenter__�	__aiter__>�__del__rrHr��__prepare__r��__instancecheck__�__subclasscheck__c�6�t�|��Sr;)rx�__hash__r�s r"rMrM�s��V�_�_�T�2�2�r!c�6�t�|��Sr;)rx�__str__r�s r"rMrM�s��F�N�N�4�0�0�r!c�6�t�|��Sr;)rx�
__sizeof__r�s r"rMrM�s��v�0�0��6�6�r!c�x�t|��j�d|����dt|����S)N�/)r=rrjrBr�s r"rMrM�s;��$�t�*�*�"5�^�^��8O�8O�8Q�8Q�^�^�TV�W[�T\�T\�^�^�r!)r�r�r��
__fspath__r�y�?g�?)
�__lt__�__gt__�__le__�__ge__�__int__r��__len__r@�__complex__�	__float__�__bool__�	__index__r�c����fd�}|S)Nc�L���jj}|tur|S�|urdStSrG)�__eq__r�r�NotImplemented)�other�ret_valrUs  �r"r�z_get_eq.<locals>.__eq__�s1����+�0���'�!�!��N��5�=�=��4��r!r )rUr�s` r"�_get_eqr��s#���������Mr!c����fd�}|S)Nc�R���jjturtS�|urdStSr~)�__ne__r�rr�)r�rUs �r"r�z_get_ne.<locals>.__ne__�s,����;�)��8�8��N��5�=�=��5��r!r )rUr�s` r"�_get_ner��s#���������Mr!c����fd�}|S)Nc�j���jj}|turtg��St|��Sr;)�__iter__r�rr��r�rUs �r"r�z_get_iter.<locals>.__iter__s1����-�2���g�����8�8�O��G�}�}�r!r )rUr�s` r"�	_get_iterr�s#���������Or!c����fd�}|S)Nc����jj}|turtt	g����Stt	|����Sr;)r�r�r�_AsyncIteratorr�r�s �r"r�z"_get_async_iter.<locals>.__aiter__s@����.�3���g���!�$�r�(�(�+�+�+��d�7�m�m�,�,�,r!r )rUr�s` r"�_get_async_iterr�s$���-�-�-�-�-�
�r!)r�r�r�r�c�&�t�|t��}|tur	||_dSt�|��}|�||��}||_dSt
�|��}|�||��|_dSdSr;)�_return_valuesrtrr��_calculate_return_value�_side_effect_methodsr�)rCr�r)�fixed�return_calculatorr��
side_effectors       r"�_set_return_valuer�s������t�W�-�-�E��G���#�����/�3�3�D�9�9���$�(�(��.�.��*�����(�,�,�T�2�2�M�� �*�]�4�0�0�����!� r!c��eZdZd�Zd�ZdS)�
MagicMixinc��|���tt|��j|i|��|���dSr;)�_mock_set_magicsrr�rH�rUrVrs   r"rHzMagicMixin.__init__2sN��������.��J��%�%�.��;��;�;�;��������r!c	��ttz}|}t|dd���X|�|j��}t��}||z
}|D](}|t
|��jvrt||���)|tt
|��j��z
}t
|��}|D]!}t||t||�����"dS)Nr*)�_magicsr�r0�intersectionr*rzr=rsr�rf�
MagicProxy)rU�orig_magics�these_magics�
remove_magicsrLr�s      r"r�zMagicMixin._mock_set_magics8s���� 4�4��"���4��$�/�/�;�&�3�3�D�4F�G�G�L��E�E�M�'�,�6�M�&�
)�
)���D��J�J�/�/�/��D�%�(�(�(��$�c�$�t�*�*�*=�&>�&>�>���T�
�
��!�	;�	;�E��E�5�*�U�D�"9�"9�:�:�:�:�	;�	;r!N)rrrrHr�r r!r"r�r�1s2������ � � �;�;�;�;�;r!r�c��eZdZ	dd�ZdS)r
Fc�\�	|�||��|���dSr;�rr�r#s   r"r$z"NonCallableMagicMock.mock_add_specR�8��	N�
	
���D�(�+�+�+��������r!Nr��rrrr$r r!r"r
r
Ps+������7� � � � � � r!r
c��eZdZd�ZdS)�AsyncMagicMixinc��|���tt|��j|i|��|���dSr;)r�rr�rHr�s   r"rHzAsyncMagicMixin.__init__]sN��������3��O�T�*�*�3�T�@�R�@�@�@��������r!N�rrrrHr r!r"r�r�\s#������ � � � � r!r�c��eZdZ	dd�ZdS)rFc�\�	|�||��|���dSr;r�r#s   r"r$zMagicMock.mock_add_specmr�r!Nr�r�r r!r"rrbs-������	� � � � � � r!rc�"�eZdZd�Zd�Zdd�ZdS)r�c�"�||_||_dSr;�r)r�)rUr)r�s   r"rHzMagicProxy.__init__ys����	�����r!c��|j}|j}|�|||���}t|||��t	|||��|S)N)r)rr)r)r�r2rfr�)rUrLr��ms    r"�create_mockzMagicProxy.create_mock}sZ���	������"�"���/5�
#�
7�
7�����q�!�!�!��&�!�U�+�+�+��r!Nc�*�|���Sr;)r�)rUr4r�s   r"r�zMagicProxy.__get__�s�����!�!�!r!r;)rrrrHr�r�r r!r"r�r�xsF������������"�"�"�"�"�"r!r�c���eZdZed��Zed��Zed��Z�fd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zd
�Z�fd�Z�xZS)rr�r�r�c����t��j|i|��tjj|jd<d|jd<d|jd<t
��|jd<tt���}tj
tjztjz|_
d|_d|_d|_d|_||jd<d	|jd
<t%��|jd<i|jd<d|jd
<dS)Nr�r�_mock_await_count�_mock_await_args�_mock_await_args_list�r�)rVrWr7r
rrdrerK)�superrHr�r�r�rsr�rrr1�CO_COROUTINE�
CO_VARARGS�CO_VARKEYWORDS�co_flags�co_argcount�co_varnames�co_posonlyargcount�co_kwonlyargcountro)rUrVrW�	code_mockr7s    �r"rHzAsyncMockMixin.__init__�s���������$�)�&�)�)�)�*1�);�)I��
�o�&�-.��
�)�*�,0��
�(�)�1:����
�-�.�#�X�6�6�6�	�� �� �
!��$�
%�	��
!"�	�� 2�	��'(�	�$�&'�	�#�$-��
�j�!�$/��
�j�!�(-����
�n�%�*,��
�&�'�+/��
�'�(�(�(r!c��`K�t||fd���}|xjdz
c_||_|j�|��|j}|��t
|��r|�t|��s8	t|��}n#t$rt�wxYwt
|��r|�n&t|��r||i|���d{V��}n||i|��}|tur|S|j
tur|jS|j�4t|j��r|j|i|���d{V��S|j|i|��S|jS)NTr�r�)r�r�r�r�r-r�r@rlr��
StopIteration�StopAsyncIterationrrr�r�r)rUrVrWr�r�r~s      r"r�z!AsyncMockMixin._execute_mock_call�s������t�V�n�$�/�/�/�����A���������#�#�E�*�*�*��!�����V�$�$�
1����v�&�&�
1�-�!�&�\�\�F�F��$�-�-�-�-�,�-����!��(�(�!� �L�!�$�V�,�,�
1�%�v�t�6�v�6�6�6�6�6�6�6�6������0��0�0���W�$�$��
��"�'�1�1��$�$���'�"�4�#3�4�4�
?�-�T�-�t�>�v�>�>�>�>�>�>�>�>�>�#�4�#�T�4�V�4�4�4�� � s�1B�Bc�V�	|jdkrd|jpd�d�}t|���dS)Nr�	Expected rCz to have been awaited.�r�r�r�r�s  r"r�zAsyncMockMixin.assert_awaited�sD��	���q� � �O�d�o�7��O�O�O�C� ��%�%�%�!� r!c�f�	|jdks$d|jpd�d|j�d�}t|���dS�Nr�rrCz$ to have been awaited once. Awaited r�rr�s  r"r�z"AsyncMockMixin.assert_awaited_once�s\��	���1�$�$�9�t��8�&�9�9�#�/�9�9�9�C� ��%�%�%�%�$r!c�j����	�j�)������}td|�d�������fd�}��t	��fd�����}���j��}||kr1t|t��r|nd}t|����|�dS)NzExpected await: z
Not awaitedc�8������d���}|S)N�await)r�r�r�s ���r"r�z:AsyncMockMixin.assert_awaited_with.<locals>._error_message�s"����3�3�D�&��3�Q�Q�C��Jr!Tr�)r�r�r�r�r�r.r�)rUrVrWr�r�r�r�s```    r"r�z"AsyncMockMixin.assert_awaited_with�s������	��?�"��7�7��f�E�E�H� �!K�H�!K�!K�!K�L�L�L�	�	�	�	�	�	�	��%�%�e�T�6�N��&E�&E�&E�F�F���#�#�D�O�4�4���X��� *�8�Y� ?� ?�I�H�H�T�E� ���!1�!1�2�2��=��r!c�|�	|jdks$d|jpd�d|j�d�}t|���|j|i|��Sr	)r�r�r�r�r�s    r"r�z'AsyncMockMixin.assert_awaited_once_with�sl��	���1�$�$�9�t��8�&�9�9�#�/�9�9�9�C� ��%�%�%�'�t�'��8��8�8�8r!c�&��	��t||fd�����}t|t��r|nd}�fd��jD��}|s|t|��vr)��||��}td|z��|�dS)NTr�c�:��g|]}��|����Sr r�r�s  �r"rsz3AsyncMockMixin.assert_any_await.<locals>.<listcomp>	s'���F�F�F�A�$�$�$�Q�'�'�F�F�Fr!z%s await not found)r�r�r.r�r�r�r�r�r�s`      r"r�zAsyncMockMixin.assert_any_await	s����	��%�%�e�T�6�N��&E�&E�&E�F�F��&�x��;�;�E�����F�F�F�F��1E�F�F�F���	�H�L��$8�$8�8�8�"�>�>�t�V�L�L�O� �$��6����
�9�8r!Fc�,��	�fd�|D��}td�|D��d��}t�fd��jD����}|sT||vrN|�d}nd�d�|D����}t	|�dt|���d�j����|�dSt|��}g}|D]=}	|�|���#t$r|�|��Y�:wxYw|r t	t|���d	���|�dS)
Nc�:��g|]}��|����Sr r�r�s  �r"rsz4AsyncMockMixin.assert_has_awaits.<locals>.<listcomp>	r�r!c3�DK�|]}t|t���|V��dSr;r�rus  r"r�z3AsyncMockMixin.assert_has_awaits.<locals>.<genexpr>	r�r!c3�B�K�|]}��|��V��dSr;r�r�s  �r"r�z3AsyncMockMixin.assert_has_awaits.<locals>.<genexpr>	s1�����S�S��t�1�1�!�4�4�S�S�S�S�S�Sr!zAwaits not found.z,Error processing expected awaits.
Errors: {}c�@�g|]}t|t��r|nd��Sr;r�rus  r"rsz4AsyncMockMixin.assert_has_awaits.<locals>.<listcomp>$	r�r!r�r�z not all found in await list)
r�r�r�r�r�rnr�rLr-ro)	rUr�r�r�r��
all_awaitsr�r�r�s	`        r"r�z AsyncMockMixin.assert_has_awaits	s����
	�:�9�9�9�5�9�9�9���F�F��F�F�F��M�M���S�S�S�S�d�>R�S�S�S�S�S�
��	��z�)�)��=�1�G�G� ,�-3�V�$7�$7�-5�$7�$7�$7�.8�.8��%��6�6�!*�5�!1�!1�6�6�#�3�6�6����	�

�F��*�%�%�
��	��	'�	'�D�
'��!�!�$�'�'�'�'���
'�
'�
'�� � ��&�&�&�&�&�
'�����	� �49�)�4D�4D�4D�4D�F����
�	�	s�7C
�
C/�.C/c�f�	|jdkr$d|jpd�d|j�d�}t|���dS)NrrrCz# to not have been awaited. Awaited r�rr�s  r"r�z!AsyncMockMixin.assert_not_awaited:	s\��	���q� � �9�t��8�&�9�9�#�/�9�9�9�C� ��%�%�%�!� r!c�~��	t��j|i|��d|_d|_t	��|_dS�Nr)r�r�r�r�r�r�)rUrVrWr7s   �r"r�zAsyncMockMixin.reset_mockC	sG���	�	�����D�+�F�+�+�+�������(�{�{����r!r�)rrrr�r�r�r�rHr�r�r�r�r�r�r�r�r��
__classcell__)r7s@r"rr�s�������&�&�}�5�5�K�%�%�l�3�3�J�*�*�+<�=�=�O�0�0�0�0�0�8&!�&!�&!�P&�&�&�&�&�&�>�>�>�$	9�	9�	9����*�*�*�*�X&�&�&�+�+�+�+�+�+�+�+�+r!rc��eZdZdS)r
Nrr r!r"r
r
M	s������'�'r!r
c�"�eZdZ	d�Zd�Zd�ZdS)�_ANYc��dSrGr �rUr�s  r"r�z_ANY.__eq__{	s���tr!c��dSr~r rs  r"r�z_ANY.__ne__~	s���ur!c��dS)Nz<ANY>r r�s r"r�z
_ANY.__repr__�	s���wr!N)rrrr�r�r�r r!r"rrx	sD������8�����������r!rc���d|z}d}d�d�|D����}d�d�|���D����}|r|}|r|r|dz
}||z
}||zS)Nz%s(%%s)rz, c�,�g|]}t|����Sr )�repr)r(rSs  r"rsz*_format_call_signature.<locals>.<listcomp>�	s��7�7�7�3�T�#�Y�Y�7�7�7r!c�"�g|]\}}|�d|����
S)�=r )r(rNr�s   r"rsz*_format_call_signature.<locals>.<listcomp>�	s4�����#-�3��3�3�3������r!)rerP)r)rVrWr��formatted_args�args_string�
kwargs_strings       r"r�r��	s����$��G��N��)�)�7�7�$�7�7�7�8�8�K��I�I���17����������M��%�$���(��	#��d�"�N��-�'���^�#�#r!c��eZdZ			dd�Z		dd�Zd�ZejZd	�Zd
�Z	d�Z
d�Zed
���Z
ed���Zd�Zd�ZdS)r�r rNFTc��d}i}t|��}|dkr|\}}}n~|dkr<|\}	}
t|	t��r|	}t|
t��r|
}nD|
}nA|	|
}}n<|dkr6|\}t|t��r|}nt|t��r|}n|}|rt�|||f��St�||||f��S)Nr �r�r�)r�r.r[ror)rr�r)r�r��	from_kallrVrW�_len�first�seconds           r"rz
_Call.__new__�	s�������5�z�z���1�9�9�!&��D�$���
�Q�Y�Y�!�M�E�6��%��%�%�
-����f�e�,�,�$�!�D�D�#�F�F�$�f�f���
�Q�Y�Y��F�E��%��%�%�
�����E�5�)�)�
�������	6��=�=��t�V�n�5�5�5��}�}�S�4��v�"6�7�7�7r!c�0�||_||_||_dSr;)r�r��_mock_from_kall)rUr�r)r�r�r,s      r"rHz_Call.__init__�	s�����"���(����r!c�r�	t|��}n#t$r
tcYSwxYwd}t|��dkr|\}}n|\}}}t|dd��r#t|dd��r|j|jkrdSd}|dkrdi}}n�|dkr|\}}}n�|dkr?|\}	t|	t��r|	}i}nit|	t��r|	}di}}nMd}|	}nH|dkr@|\}
}t|
t��r!|
}t|t��r|i}}nd|}}n|
|}}ndS|r||krdS||f||fkS)	Nrr�r�Frr r+r�)r�r�r�r0r�r.ror[)rUr��	len_other�	self_name�	self_args�self_kwargs�
other_name�
other_args�other_kwargsr�r.r/s            r"r�z_Call.__eq__�	s���	"��E�
�
�I�I���	"�	"�	"�!�!�!�!�	"�����	��t�9�9��>�>�%)�"�I�{�{�04�-�I�y�+��D�.�$�/�/�	�G�E�>�SW�4X�4X�	��%��);�;�;��5��
���>�>�')�2��J�J�
�!�^�^�38�0�J�
�L�L�
�!�^�^��F�E��%��'�'�
%�"�
�!����E�3�'�'�
%�"�
�+-�r�L�
�
��
�$���
�!�^�^�!�M�E�6��%��%�%�
9�"�
��f�e�,�,�:�/5�r��J�J�/1�6��J�J�+0�&�L�
�
��5��	��y�0�0��5��L�)�i��-E�E�Es��&�&c��|j�td||fd���S|jdz}t|j||f||���S)Nrr0r�r��r�r�r�s    r"rIz_Call.__call__
sN���?�"��"�d�F�+�$�7�7�7�7����%���d�o�t�V�4�4��M�M�M�Mr!c�n�|j�t|d���S|j�d|��}t||d���S)NF)r)r,rJ)r)r�r,r;)rUr�r)s   r"r�z_Call.__getattr__
sD���?�"��d�e�4�4�4�4��/�/�/�4�4�0���$�t�u�=�=�=�=r!c�b�|tjvrt�t�||��Sr;)rorsrJ�__getattribute__)rUr�s  r"r>z_Call.__getattribute__
s+���5�>�!�!� � ��%�%�d�D�1�1�1r!c�H�t|��dkr|\}}n|\}}}||fS)Nr�)r�r�s    r"�_get_call_argumentsz_Call._get_call_arguments!
s2���t�9�9��>�>��L�D�&�&�!%��D�$���V�|�r!c�6�|���dSr�r@r�s r"rVz
_Call.args)
����'�'�)�)�!�,�,r!c�6�|���dS)Nr�rBr�s r"rWz_Call.kwargs-
rCr!c��|js%|jpd}|�d��rd|z}|St|��dkrd}|\}}n+|\}}}|sd}n |�d��sd|z}nd|z}t	|||��S)Nrr0zcall%sr�zcall.%s)r1r�r'r�r�)rUr)rVrWs    r"r�z_Call.__repr__1
s����#�	��?�,�f�D����t�$�$�
'��$����K��t�9�9��>�>��D��L�D�&�&�!%��D�$���
'�����_�_�T�*�*�
'� �4�'����$���%�d�D�&�9�9�9r!c��	g}|}|�%|jr|�|��|j}|�%tt	|����Sr;)r1r-r�r�rd)rU�vals�things   r"�	call_listz_Call.call_listF
s\��	��������$�
#����E�"�"�"��&�E�����$���(�(�(r!)r rNFT)r NNFT)rrrrrHr�rxr�rIr�r>r@r�rVrWr�rIr r!r"r�r��	s�������$:?��8�8�8�8�@>C��)�)�)�)�2F�2F�2F�j�]�F�N�N�N�>�>�>�2�2�2�����-�-��X�-��-�-��X�-�:�:�:�*
)�
)�
)�
)�
)r!r�)r,c	��	t|��rt|��}t|t��}t|��rt	d|�d����t|��}d|i}	|rd|i}	n|�i}	|	r|rd|	d<|st
|��|	�|��t}
tj
|��ri}	nL|r|rtd���t}
n1t|��st}
n|r|rt|��st}
|	�d|��}|}|�d	}|
d||||d
�|	��}t|t"��r"t%||��}|rt'|��nt)||||��|�|s
||j|<|r|sd|vrt-||dd|�
��|_t1|��D�]}
t3|
��r�	t5||
��}n#t6$rY�1wxYwd|i}|rd|i}t|t"��st9||||
|��}||j|
<n{|}t|t"��r|j}t=||
|��}||d<t?|��rt}nt}|d||
|
|d�|��}||j|
<t)|||���t|t"��rtA||
|����|S)Nz'Cannot autospec a Mock object. [object=r&r�r�TrzJInstance can not be True when create_autospec is mocking an async functionr)r)r�rrr)r�r0)r_r;r�r)r�r)rr)r^r )!rpr=r.r-rr9rr#rr1�isdatadescriptorrr
rlr
rvrRrDr�r�r`r�r	r�r,r�r0rJrDrC�
_must_skiprrf)r�r�r_r�r;rrW�is_type�
is_async_funcrErDrrCrLr}rr�r^�child_klasss                   r"r	r	V
s���,�*��~�~���D�z�z����t�$�$�G�����5�� 4�*.� 4� 4� 4�5�5�	5�"�4�(�(�M��t�n�G����t�$���	
�����,�8�,�'+��#�$��&��f�%�%�%��N�N�6�����E����%�%�%����	�%��	?�� >�?�?�
?����
�t�_�_�%�$���	�%�X�%�&8��&>�&>�%�$���K�K���&�&�E��I����	��5�(��W�	��(�(�&�(�(�D��$�
�&�&�8��d�D�)�)���	$��d�#�#�#����t�W�h�7�7�7���8��(,���u�%��F�x�F�N�&�$@�$@�+�D�(�T�26��F�F�F����T���0&�0&���U���	��	��t�U�+�+�H�H���	�	�	��H�	�����(�#���	,� �(�+�F��(�M�2�2�	A��X�x��u�h�G�G�C�),�D���&�&��F��$�
�.�.�
#����"�4���8�8�I�"+�F�;��"�8�,�,�
(�'���'���+�(�V�%�5�*0�(�(� &�(�(�C�*-�D���&��X�s�i�@�@�@�@��c�=�)�)�	&��D�%��%�%�%���Ks�G#�#
G0�/G0c�F�	t|t��s|t|di��vrdS|j}|jD]f}|j�|t��}|tur�,t|ttf��rdSt|t��r|cSdS|S)NrsF)r.r=r0r7rrrsrtrrjrkrD)r�rLrMr�r~s     r"rLrL�
s�����d�D�!�!���G�D�*�b�1�1�1�1��5��~���������#�#�E�7�3�3���W�����f�|�[�9�:�:�	��5�5�
��
�
.�
.�	��N�N�N��5�5��Nr!c��eZdZ		dd�ZdS)rDFNc�Z�||_||_||_||_||_||_dSr;)r��idsr�r�r_r))rUr�r�r�r)rSr_s       r"rHz_SpecState.__init__s0����	���� ��
���� ��
���	�	�	r!)FNNNFr�r r!r"rDrD�
s.������48�/4������r!rDc�|�t|t��rtj|��Stj|��Sr;)r.�bytes�io�BytesIO�StringIO)�	read_datas r"�
_to_streamrZs4���)�U�#�#�&��z�)�$�$�$��{�9�%�%�%r!rc	�X���	�
��	t���}|dg�
�
�fd�}�
�fd�}��
fd��	�
�fd���
�fd�}t�dddl}tt	t|j�����t	t|j��������at�2ddl}tt	t|j
������a	|�tdt���}tt�	�����j_
d�j_
d�j_
d�j_
d�j_
|�j_�	���
d
<�
d
�j_|�j_��j_|�j_�	�
��fd�}||_�|_
|S)Nc�Z���jj��jjS�dj|i|��Sr)�	readlinesr��rVrW�_state�handles  ��r"�_readlines_side_effectz)mock_open.<locals>._readlines_side_effect,s7�����(�4��#�0�0�"�v�a�y�"�D�3�F�3�3�3r!c�Z���jj��jjS�dj|i|��Sr)�readr�r^s  ��r"�_read_side_effectz$mock_open.<locals>._read_side_effect1s4����;�#�/��;�+�+��v�a�y�~�t�.�v�.�.�.r!c?�V�K����Ed{V��	�dj|i|��V���NTr)�readline)rVrW�_iter_side_effectr_s  ��r"�_readline_side_effectz(mock_open.<locals>._readline_side_effect6sT�����$�$�&�&�&�&�&�&�&�&�&�	6�$�&��)�$�d�5�f�5�5�5�5�5�	6r!c3�b�K��jj�	�jjV���dD]}|V��dSrf)rgr�)�liner_r`s ��r"rhz$mock_open.<locals>._iter_side_effect;sU������?�'�3�
3��o�2�2�2�2�
3��1�I�	�	�D��J�J�J�J�	�	r!c�^���jj��jjSt�d��Sr)rgr�r�)r_r`s��r"�_next_side_effectz$mock_open.<locals>._next_side_effectBs)����?�'�3��?�/�/��F�1�I���r!r�open)r)r�)r�r�c���t����d<�jj�dkr����d<�d�j_tS)Nrr�)rZrgr�r)rVrWrir_r`rYs  ����r"�
reset_datazmock_open.<locals>.reset_databsM����y�)�)��q�	��?�&�&��)�3�3�-�-�/�/�F�1�I�*0��)�F�O�'��r!)rZ�	file_spec�_iornrzr,�
TextIOWrapper�unionrW�	open_specrnrrIr��writercrgr]r�r�r�)rCrY�
_read_datarardrmrrrprhrir_r`s `      @@@@r"rrs�������
��I�&�&�J��$�
�F�4�4�4�4�4�4�
/�/�/�/�/�/�
6�6�6�6�6�6�
���������������
�
�
���S��!2�3�3�4�4�:�:�3�s�3�;�?O�?O�;P�;P�Q�Q�R�R�	����
�
�
���S���]�]�+�+�,�,�	��|��f�9�5�5�5��
�I�
&�
&�
&�F�$*�F��!� $�F�L��#�F�K��#'�F�O� �$(�F��!�/�F�K��%�%�'�'�F�1�I�"(��)�F�O��#9�F�� �"3�F�O��"3�F�O����������"�D���D���Kr!c�$�eZdZ	d�Zdd�Zd�ZdS)rc��tdi|��S)Nr )r)rUrWs  r"r2zPropertyMock._get_child_mockxs���"�"�6�"�"�"r!Nc��|��Sr;r )rUr4�obj_types   r"r�zPropertyMock.__get__{s
���t�v�v�
r!c��||��dSr;r )rUr4rTs   r"r�zPropertyMock.__set__}s����S�	�	�	�	�	r!r;)rrrr2r�r�r r!r"rrosK�������#�#�#���������r!rc�6�	d|_t|��D]�}	t||��}n#t$rY� wxYwt	|t
��s�:t	|j�|��t��r�h|j	|urt|����dSrG)rr,r0rJr.rr�rtrDr�r)rCr�r�s   r"rr�s�����D���D�	�	�
�
��	���d�#�#�A�A���	�	�	��H�	�����!�_�-�-�	���a�&�*�*�4�0�0�*�=�=�	�����%�%���G�G�G��
�
s�,�
9�9c��eZdZ	d�Zd�ZdS)r�c�t�||_tt���}tj|_||jd<dS)Nr�r7)�iteratorrrr1�CO_ITERABLE_COROUTINEr�rs)rUr�rs   r"rHz_AsyncIterator.__init__�s6�� ��
�#�X�6�6�6�	�$�:�	��$-��
�j�!�!�!r!c��^K�	t|j��S#t$rYnwxYwt�r;)r�r�rrr�s r"r�z_AsyncIterator.__anext__�sA����	���
�&�&�&���	�	�	��D�	���� � s��
%�%N)rrrrHr�r r!r"r�r��s7�������.�.�.�!�!�!�!�!r!r�r�)NFNNN)FFNNr)��__all__r�rrVr1r�rA�builtinsrUr�typesrrr�
unittest.utilr�	functoolsrr�	threadingrr�rr,r6rr�rr5r9r-r@rErPr`r[rlrprvr�r|r�r�rxr�r�rr�MISSINGr��DELETEDrEr�r�rnr�r�r�r�rrKrHrr�r>r�rrrrWr\r`rrcr{r�rf�multiple�stopallr�
magic_methods�numericsrerQ�inplace�right�
_non_defaultsr�r�r��_sync_async_magics�
_async_magicsr�r`r�r�r�r�r�r�r�r�r�r�r�r
r�rr�rr
rrr�ror�rr	rLrDr=r�rDrqrurZrrrr�r r!r"�<module>r�s4
����&��������	�	�	�	�����
�
�
�
�
�
�
�
���������'�'�'�'�'�'�2�2�2�2�2�2�2�2�2�2�#�#�#�#�#�#�$�$�$�$�$�$�$�$�������C�C�C�C�C�y�C�C�C�
I�H�c�c�(�m�m�H�H�H�	�
�
���@�@�@����2�2�2����������:	#�	#�	#�	#�
�
�
����&�&�&��������6."�."�."�b>�>�>�6)�)�)�	)�	)�	)�	)�	)�f�	)�	)�	)�����������9�;�;��
�
������������ � � �&*�*�*�*�*��*�*�*�(���6���������
�
�
�
�
�6�
�
�
�N
<�N
<�N
<�N
<�N
<�d�N
<�N
<�N
<�b
�G��o�6�7�7�	�
�
�
�
�
�4�
�
�
� ���d!�d!�d!�d!�d!�D�d!�d!�d!�P6�6�6�6�6�=�/�6�6�6�v���L/�L/�L/�L/�L/�V�L/�L/�L/�`
<�<�<� '�T��t�d���&+������:?C�04�.�.�.�.�d�$�u���4�O�CH�O�O�O�O�O�dV/�V/�V/�V/�V/�&�V/�V/�V/�r���������
��
� �����
����
��"K�	��(�(�7�7�h�n�n�&6�&6�7�7�7�
7�
7�����5�5�H�N�N�$4�$4�5�5�5�5�5�����
�������H�H�m�X�w��
6�7�7�=�=�?�?�����@�?�?��!�]��$�'9�9�
��]�*����.������3�2�0�0�6�6�^�^�	�������������������"��������������� �	���1�1�1�$;�;�;�;�;��;�;�;�>	 �	 �	 �	 �	 �:��	 �	 �	 � � � � � �j� � � � � � � � �
�D� � � �,"�"�"�"�"��"�"�"�$@+�@+�@+�@+�@+�T�@+�@+�@+�F(�(�(�(�(����(�(�(�V
�
�
�
�
�6�
�
�
��d�f�f��$�$�$�$v)�v)�v)�v)�v)�E�v)�v)�v)�r
�u�u�����CG��I�*/�I�I�I�I�I�X���8	�	�	�	�	��	�	�	�	�D�����D�����	�
�
�	��	�&�&�&�O�O�O�O�d�����4����$���0!�!�!�!�!�!�!�!�!�!r!

ZeroDay Forums Mini