§
    åžyjH— ã                   ó`  — d Z ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZmZmZ ddlmZ ddlmZmZ ddlmZ  G d„ d	e¦  «        Zd
„  ee¦  «        D ¦   «         ZdZeZd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!dyd„Z"d„ Z#d„ Z$d„ Z%d„ Z&dyd„Z'd„ Z(d„ Z)d„ Z* G d„ de+¦  «        Z, G d„ de+¦  «        Z- e-¦   «         Z.e.j/        Z/e.j0        Z1e.j2        Z3h d £Z4d!„ Z5 G d"„ d#e6¦  «        Z7d$„ Z8 G d%„ d&e+¦  «        Z9 G d'„ d(e+¦  «        Z: G d)„ d*e:¦  «        Z; ej<        e;j=        ¦  «        Z> G d+„ d,e6¦  «        Z?d-„ Z@ G d.„ d/e:¦  «        ZA G d0„ d1eAe;¦  «        ZBd2„ ZC G d3„ d4e+¦  «        ZDd5„ ZEe/dddddfdd6œd7„ZF	 	 dzd8„ZGe/dddddfdd6œd9„ZH G d:„ d;e+¦  «        ZId<„ ZJd=„ ZKeFeH_+        eIeH_L        eGeH_M        eKeH_N        d>eH_O        d?ZPd@ZQdA R                    dB„ eQ S                    ¦   «         D ¦   «         ¦  «        ZTdA R                    dC„ eQ S                    ¦   «         D ¦   «         ¦  «        ZUh dD£ZVdE„ ZWdF„ dA R                    ePeQeTeUg¦  «         S                    ¦   «         D ¦   «         ZXh dG£ZYdHhZZeYeZz  Z[eXeVz  Z\e\e[z  Z]h dI£Z^dJ„ dK„ dL„ dM„ dNœZ_e`e`e`e`dOddddPdQddOddRœZadS„ ZbdT„ ZcdU„ ZddV„ ZeebecedeedWœZfdX„ Zg G dY„ dZe:¦  «        Zh G d[„ d\ehe;¦  «        Zi G d]„ d^eh¦  «        Zj G d_„ d`eheB¦  «        Zk G da„ dbe:¦  «        Zl G dc„ dde:¦  «        Zm G de„ dfemejeB¦  «        Zn G dg„ dhe+¦  «        Zo eo¦   «         Zpdi„ Zq G dj„ dker¦  «        Zs esd¬l¦  «        Zt	 	 d{dd6œdm„Zudn„ Zv G do„ dpe+¦  «        Zw exeu¦  «         exepjy        ¦  «        fZzda{da|dq„ Z}d|ds„Z~ G dt„ dueB¦  «        Zdv„ Z€ G dw„ dx¦  «        Z�dS )})Ú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                   ó   — e Zd ZdZdS )ÚInvalidSpecErrorz8Indicates that an invalid value was used as a mock spec.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úe/home/ragecks/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/unittest/mock.pyr   r   )   s   € € € € € ØBÐBÐBÐBr"   r   c                 ó<   — 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          | ¦  «        rt          | t          ¦  «        sdS t          | d¦  «        rt	          | d¦  «        } t          | ¦  «        pt          j        | ¦  «        S )NFÚ__func__)Ú_is_instance_mockÚ
isinstancer
   ÚhasattrÚgetattrr   ÚinspectÚisawaitable©Úobjs    r#   Ú_is_async_objr6   5   sg   € Ý˜ÑÔð ¥j°µiÑ&@Ô&@ð ØˆuÝˆs�JÑÔð 'Ý�c˜:Ñ&Ô&ˆÝ˜sÑ#Ô#Ð?¥wÔ':¸3Ñ'?Ô'?Ð?r"   c                 óF   — t          | dd ¦  «        rt          | ¦  «        S dS )NÚ__code__F)r1   r   )Úfuncs    r#   Ú_is_async_funcr:   =   s)   € Ýˆt�Z Ñ&Ô&ð Ý" 4Ñ(Ô(Ð(àˆur"   c                 óF   — t          t          | ¦  «        t          ¦  «        S ©N)Ú
issubclassÚtyper   r4   s    r#   r.   r.   D   s   € õ •d˜3‘i”i¥Ñ1Ô1Ð1r"   c                 ó€   — t          | t          ¦  «        p)t          | t          ¦  «        ot          | t          ¦  «        S r<   )r/   ÚBaseExceptionr>   r=   r4   s    r#   Ú_is_exceptionrA   J   s6   € å�3�Ñ&Ô&ð 	AÝ�3�ÑÔÐ@¥*¨Sµ-Ñ"@Ô"@ðr"   c                 ó^   — t          | t          ¦  «        rt          | d¦  «        r| j        S | S ©NÚmock)r/   ÚFunctionTypesr0   rD   r4   s    r#   Ú_extract_mockrF   Q   s3   € õ �#•}Ñ%Ô%ð ­'°#°vÑ*>Ô*>ð ØŒxˆàˆ
r"   c                 ó’  — t          | t          ¦  «        r|s
| j        } d}njt          | t          t          f¦  «        rt          | t          ¦  «        rd}| j        } n/t          | t          ¦  «        s	 | j        } n# t          $ r Y dS w xY w|rt          | d¦  «        }n| }	 | t          j        |¦  «        fS # t          $ r Y dS w xY w)z�
    Given an arbitrary, possibly callable object, try to create a suitable
    signature object.
    Return a (reduced func, signature) tuple, or None.
    TN)r/   r>   Ú__init__ÚclassmethodÚstaticmethodr-   rE   Ú__call__ÚAttributeErrorr   r2   Ú	signatureÚ
ValueError)r9   Úas_instanceÚeat_selfÚsig_funcs       r#   Ú_get_signature_objectrR   Z   sÿ   € õ �$�ÑÔð  kð àŒ}ˆàˆˆÝ	�D�;­Ð5Ñ	6Ô	6ð Ý�d�KÑ(Ô(ð 	àˆHàŒ}ˆˆÝ˜�mÑ,Ô,ð ð	Ø”=ˆDˆDøÝð 	ð 	ð 	Ø�4�4ð	øøøàð Ý˜4 Ñ&Ô&ˆˆàˆðØ•WÔ& xÑ0Ô0Ð0Ð0øÝð ð ð àˆtˆtðøøøs$   Á3A; Á;
B	ÂB	Â"B8 Â8
CÃCFc                 ó¶   ‡— t          | ||¦  «        Š‰€d S ‰\  } Šˆfd„}t          | |¦  «         |t          |¦  «        _        ‰t          |¦  «        _        d S )Nc                ó"   •—  ‰j         |i |¤Ž d S r<   ©Úbind)ÚselfÚargsÚkwargsÚsigs      €r#   Úchecksigz"_check_signature.<locals>.checksig‚   ó    ø€ ØˆŒ�$Ð!˜&Ð!Ð!Ð!Ð!Ð!r"   )rR   Ú_copy_func_detailsr>   Ú_mock_check_sigÚ__signature__)r9   rD   Ú	skipfirstÚinstancer[   rZ   s        @r#   Ú_check_signaturerb   }   sr   ø€ Ý
  h°	Ñ
:Ô
:€CØ
€{ØˆØ�I€Dˆ#ð"ð "ð "ð "ð "å�t˜XÑ&Ô&Ð&Ø!)…Dˆ�J„JÔØ"…Dˆ�J„JÔÐÐr"   c           	      óp   — dD ]2}	 t          ||t          | |¦  «        ¦  «         Œ## t          $ r Y Œ/w xY wd S )N)r   r    Ú__text_signature__r   Ú__defaults__Ú__kwdefaults__)Úsetattrr1   rL   )r9   ÚfuncopyÚ	attributes      r#   r]   r]   ‰   sa   € ðð ð ˆ	ð	Ý�G˜Y­°°iÑ(@Ô(@ÑAÔAÐAÐAøÝð 	ð 	ð 	ØˆDð	øøøðð s   †&¦
3²3c                 óÆ   — t          | t          ¦  «        rdS t          | t          t          t          f¦  «        rt          | j        ¦  «        S t          | dd ¦  «        �dS dS )NTrK   F)r/   r>   rJ   rI   r   Ú	_callabler-   r1   r4   s    r#   rk   rk   –   s^   € Ý�#•tÑÔð ØˆtÝ�#�¥kµ:Ð>Ñ?Ô?ð 'Ý˜œÑ&Ô&Ð&Ýˆs�J Ñ%Ô%Ð1ØˆtØˆ5r"   c                 ó<   — t          | ¦  «        t          t          fv S r<   )r>   ÚlistÚtupler4   s    r#   Ú_is_listro       s   € õ �‰9Œ9��u˜Ð%Ð%r"   c                 ó¬   — t          | t          ¦  «        st          | dd¦  «        duS | f| j        z   D ]}|j                             d¦  «        � dS Œ dS )ztGiven an object, return True if the object is callable.
    For classes, return True if instances would be callable.rK   NTF)r/   r>   r1   Ú__mro__Ú__dict__Úget)r5   Úbases     r#   Ú_instance_callableru   ¦   sn   € õ �c�4Ñ Ô ð :å�s˜J¨Ñ-Ô-°TÐ9Ð9ð �˜œÑ$ð ð ˆØŒ=×Ò˜ZÑ(Ô(Ð4Ø�4�4ð 5àˆ5r"   c                 ó0  ‡— t          |t          ¦  «        }t          |||¦  «        }|€| S |\  }Šˆfd„}t          ||¦  «         |j        }|                     ¦   «         sd}|| dœ}d|z  }	t          |	|¦  «         ||         }
t          |
| ‰¦  «         |
S )Nc                  ó"   •—  ‰j         | i |¤Ž d S r<   rU   )rX   rY   rZ   s     €r#   r[   z _set_signature.<locals>.checksig¿   r\   r"   rh   )Ú
_checksig_rD   zYdef %s(*args, **kwargs):
    _checksig_(*args, **kwargs)
    return mock(*args, **kwargs))r/   r>   rR   r]   r   ÚisidentifierÚexecÚ_setup_func)rD   Úoriginalra   r`   Úresultr9   r[   r*   ÚcontextÚsrcrh   rZ   s              @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                 óÚ  ‡ ‡— ‰‰ _         ˆfd„}ˆfd„}ˆfd„}ˆfd„}ˆfd„}ˆfd„}ˆfd„}	ˆ ˆfd„}
d	‰ _        d
‰ _        d ‰ _        t	          ¦   «         ‰ _        t	          ¦   «         ‰ _        t	          ¦   «         ‰ _        ‰j        ‰ _        ‰j	        ‰ _	        ‰j
        ‰ _
        |‰ _        |‰ _        |‰ _        |	‰ _        |
‰ _        |‰ _        |‰ _        |‰ _        |‰ _        ‰ ‰_        d S )Nc                  ó   •—  ‰j         | i |¤ŽS r<   )Úassert_called_with©rX   rY   rD   s     €r#   rƒ   z'_setup_func.<locals>.assert_called_withÓ   ó   ø€ Ø&ˆtÔ&¨Ð7°Ð7Ð7Ð7r"   c                  ó   •—  ‰j         | i |¤ŽS r<   )Úassert_calledr„   s     €r#   r‡   z"_setup_func.<locals>.assert_calledÕ   s   ø€ Ø!ˆtÔ! 4Ð2¨6Ð2Ð2Ð2r"   c                  ó   •—  ‰j         | i |¤ŽS r<   )Úassert_not_calledr„   s     €r#   r‰   z&_setup_func.<locals>.assert_not_called×   s   ø€ Ø%ˆtÔ% tÐ6¨vÐ6Ð6Ð6r"   c                  ó   •—  ‰j         | i |¤ŽS r<   )Úassert_called_oncer„   s     €r#   r‹   z'_setup_func.<locals>.assert_called_onceÙ   r…   r"   c                  ó   •—  ‰j         | i |¤ŽS r<   )Úassert_called_once_withr„   s     €r#   r�   z,_setup_func.<locals>.assert_called_once_withÛ   s   ø€ Ø+ˆtÔ+¨TÐ<°VÐ<Ð<Ð<r"   c                  ó   •—  ‰j         | i |¤ŽS r<   )Úassert_has_callsr„   s     €r#   r�   z%_setup_func.<locals>.assert_has_callsÝ   s   ø€ Ø$ˆtÔ$ dÐ5¨fÐ5Ð5Ð5r"   c                  ó   •—  ‰j         | i |¤ŽS r<   )Ú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| ‰ur|                      ¦   «          d S d S d S r<   )Ú	_CallListÚmethod_callsÚ
mock_callsÚ
reset_mockÚreturn_valuer.   )Úretrh   rD   s    €€r#   r–   z_setup_func.<locals>.reset_mocká   so   ø€ Ý(™{œ{ˆÔÝ&™[œ[ˆÔØ�ŠÑÔÐØÔ"ˆÝ˜SÑ!Ô!ð 	¨#°¨+¨+Ø�NŠNÑÔÐÐÐð	ð 	¨+¨+r"   Fr   )rD   ÚcalledÚ
call_countÚ	call_argsr“   Úcall_args_listr”   r•   r—   Úside_effectÚ_mock_childrenrƒ   r�   r�   r‘   r–   r‡   r‰   r‹   r_   Ú_mock_delegate)rh   rD   rZ   rƒ   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           	      óÈ   ‡ — t           j        j        ‰ _        d‰ _        d ‰ _        t          ¦   «         ‰ _        ˆ fd„}dD ]!}t          ‰ |t          ||¦  «        ¦  «         Œ"d S )Nr   c                ó:   •—  t          ‰j        | ¦  «        |i |¤ŽS r<   )r1   rD   )ÚattrrX   rY   rD   s      €r#   Úwrapperz"_setup_async_mock.<locals>.wrapper
  s$   ø€ Ø'�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_listrg   r   )rD   r£   ri   s   `  r#   Ú_setup_async_mockr±     s�   ø€ Ý Ô+Ô9€DÔØ€DÔØ€D„OÝ$™;œ;€DÔð
9ð 9ð 9ð 9ð 9ð,ð >ð >ˆ	õ 	��i¥¨°)Ñ!<Ô!<Ñ=Ô=Ð=Ð=ð>ð >r"   c                 ó$   — d| dd…         z  | k    S )Nú__%s__é   éþÿÿÿr!   ©r*   s    r#   Ú	_is_magicr·     s   € Ø�d˜1˜R˜4”jÑ  DÒ(Ð(r"   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )Ú_SentinelObjectz!A unique, named, sentinel object.c                 ó   — || _         d S r<   r¶   ©rW   r*   s     r#   rH   z_SentinelObject.__init__"  s   € ØˆŒ	ˆ	ˆ	r"   c                 ó   — d| j         z  S ©Nzsentinel.%sr¶   ©rW   s    r#   Ú__repr__z_SentinelObject.__repr__%  ó   € Ø˜tœyÑ(Ð(r"   c                 ó   — d| j         z  S r½   r¶   r¾   s    r#   Ú
__reduce__z_SentinelObject.__reduce__(  rÀ   r"   N)r   r   r   r    rH   r¿   rÂ   r!   r"   r#   r¹   r¹      sG   € € € € € Ø'Ð'ðð ð ð)ð )ð )ð)ð )ð )ð )ð )r"   r¹   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )Ú	_SentinelzAAccess attributes to return a named object, usable as a sentinel.c                 ó   — i | _         d S r<   )Ú
_sentinelsr¾   s    r#   rH   z_Sentinel.__init__.  s   € ØˆŒˆˆr"   c                 ól   — |dk    rt           ‚| j                             |t          |¦  «        ¦  «        S )NÚ	__bases__)rL   rÆ   Ú
setdefaultr¹   r»   s     r#   Ú__getattr__z_Sentinel.__getattr__1  s3   € Ø�;ÒÐå Ð ØŒ×)Ò)¨$µÀÑ0EÔ0EÑFÔFÐFr"   c                 ó   — dS )Nr   r!   r¾   s    r#   rÂ   z_Sentinel.__reduce__7  s   € Øˆzr"   N)r   r   r   r    rH   rÊ   rÂ   r!   r"   r#   rÄ   rÄ   ,  sJ   € € € € € ØKÐ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   }| |fd„}| |fd„}t          ||¦  «        S )NÚ_mock_c                 óT   — | j         }|€t          | |¦  «        S t          ||¦  «        S r<   )rŸ   r1   )rW   r*   Ú	_the_namerZ   s       r#   Ú_getz"_delegating_property.<locals>._getL  s/   € ØÔ!ˆØˆ;Ý˜4 Ñ+Ô+Ð+Ý�s˜DÑ!Ô!Ð!r"   c                 óR   — | j         }|€|| j        |<   d S t          |||¦  «         d S r<   )rŸ   rr   rg   )rW   Úvaluer*   rÕ   rZ   s        r#   Ú_setz"_delegating_property.<locals>._setQ  s9   € ØÔ!ˆØˆ;Ø',ˆDŒM˜)Ñ$Ð$Ð$å�C˜˜uÑ%Ô%Ð%Ð%Ð%r"   )Ú_allowed_namesÚaddÚproperty)r*   rÕ   rÖ   rÙ   s       r#   Ú_delegating_propertyrÝ   I  se   € Ý×Ò�tÑÔÐØ˜4‘€IØ¨	ð "ð "ð "ð "ð
  $¨yð &ð &ð &ð &õ �D˜$ÑÔÐr"   c                   ó   — e Zd Zd„ Zd„ ZdS )r“   c                 ó  — t          |t          ¦  «        st                               | |¦  «        S t          |¦  «        }t          | ¦  «        }||k    rdS t	          d||z
  dz   ¦  «        D ]}| |||z   …         }||k    r dS ŒdS )NFr   é   T)r/   rm   Ú__contains__ÚlenÚrange)rW   rØ   Ú	len_valueÚlen_selfÚiÚsub_lists         r#   rá   z_CallList.__contains__^  s¡   € Ý˜%¥Ñ&Ô&ð 	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   — t          j        t          | ¦  «        ¦  «        S r<   )ÚpprintÚpformatrm   r¾   s    r#   r¿   z_CallList.__repr__l  s   € ÝŒ~�d 4™jœjÑ)Ô)Ð)r"   N)r   r   r   rá   r¿   r!   r"   r#   r“   r“   \  s2   € € € € € ðð ð ð*ð *ð *ð *ð *r"   r“   c                 óè   — t          |¦  «        }t          |¦  «        sdS |j        s|j        s|j        €|j        �dS | }|�||u rdS |j        }|­|r| |_        ||_        |r| |_        ||_        dS )NFT)rF   r.   rÌ   rÎ   rÍ   rÏ   )ÚparentrØ   r*   Únew_nameÚ_parents        r#   Ú_check_and_set_parentrï   p  s´   € Ý˜%Ñ Ô €Eå˜UÑ#Ô#ð ØˆuØ	Ô	ð ˜UÔ1ð Ø	Ô	Ð	'Ø	Ô	Ð	+Øˆuà€GØ
Ð
ð �eÐÐØ�5ØÔ*ˆð Ð
ð ð (Ø!'ˆÔØ'ˆÔØð  Ø#ˆÔØˆÔØˆ4r"   c                   ó   — e Zd Zd„ Zd„ ZdS )Ú	_MockIterc                 ó.   — t          |¦  «        | _        d S r<   )Úiterr5   )rW   r5   s     r#   rH   z_MockIter.__init__Œ  s   € Ý˜‘9”9ˆŒˆˆr"   c                 ó*   — t          | j        ¦  «        S r<   )Únextr5   r¾   s    r#   Ú__next__z_MockIter.__next__Ž  s   € Ý�D”H‰~Œ~Ðr"   N)r   r   r   rH   rö   r!   r"   r#   rñ   rñ   ‹  s2   € € € € € ðð ð ðð ð ð ð r"   rñ   c                   ó   — e Zd ZeZdZd„ ZdS )ÚBaseNc                ó   — d S r<   r!   ©rW   rX   rY   s      r#   rH   zBase.__init__”  s   € Øˆr"   )r   r   r   r   rÑ   rÐ   rH   r!   r"   r#   rø   rø   ‘  s/   € € € € € Ø ÐØÐðð ð ð ð r"   rø   c                   ó´  — e Zd ZdZ e¦   «         Zd„ Z	 	 	 d-d„Zd„ Zd.d„Z		 	 d/d	„Z
d
„ Zd„ ZdZ eeee¦  «        Zed„ ¦   «         Z ed¦  «        Z ed¦  «        Z ed¦  «        Z ed¦  «        Z ed¦  «        Zd„ Zd„ Z eee¦  «        Zd0dddœd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d1d „Z#d!„ Z$d"„ Z%d#„ Z&d$„ Z'd%„ Z(d&„ Z)d'„ Z*d.d(„Z+d)„ Z,d*„ Z-d2d,„Z.dS )3r   z A non-callable version of `Mock`c                óz  — | f}t          | t          ¦  «        s]t          j        | g|¢R i |¤Žj        }|                     d|                     d¦  «        ¦  «        }|�t          |¦  «        r	t          | f}t          | j        |d| j	        i¦  «        }t          t          | ¦  «                             |¦  «        }|S )NÚspec_setÚspecr    )r=   ÚAsyncMockMixinÚ	_MOCK_SIGÚbind_partialÚ	argumentsrs   r6   r>   r   r    Ú_safe_superr   Ú__new__)ÚclsrX   ÚkwÚbasesÚ
bound_argsÚspec_argÚnewra   s           r#   r  zNonCallableMock.__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}|
€|d u}
|                      |||	|
¦  «         i |d<   ||d	<   d |d
<   d|d<   d |d<   d|d<   t          ¦   «         |d<   t          ¦   «         |d<   t          ¦   «         |d<   ||d<   |r | j        di |¤Ž t	          t
          | ¦  «                             ||||||¦  «         d S )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!   )rr   Ú_mock_add_specr“   Úconfigure_mockr  r   rH   )rW   rþ   r   r*   rý   rì   Ú_spec_stateÚ	_new_nameÚ_new_parentÚ_spec_as_instanceÚ	_eat_selfÚunsaferY   rr   s                 r#   rH   zNonCallableMock.__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          | ||¦  «         dS )zÍ
        Attach a mock as an attribute of this one, replacing its name and
        parent. Calls to the attached mock will be recorded in the
        `method_calls` and `mock_calls` attributes of this one.Nr  )rF   rÍ   rÏ   rÌ   rÎ   rg   )rW   rD   ri   Ú
inner_mocks       r#   Úattach_mockzNonCallableMock.attach_mocká  sI   € õ
 # 4Ñ(Ô(ˆ
à"&ˆ
ÔØ&*ˆ
Ô#Ø "ˆ
ÔØ$(ˆ
Ô!å��i Ñ&Ô&Ð&Ð&Ð&r"   c                 ó2   — |                       ||¦  «         dS ©zðAdd a spec to a mock. `spec` can either be an object or a
        list of strings. Only attributes on the `spec` can be fetched as
        attributes from the mock.

        If `spec_set` is True then only attributes on the spec can be set.N)r  ©rW   rþ   rý   s      r#   Úmock_add_speczNonCallableMock.mock_add_specð  s    € ð 	×Ò˜D (Ñ+Ô+Ð+Ð+Ð+r"   c                 óä  — t          |¦  «        rt          d|›d�¦  «        ‚d }d }g }t          |¦  «        D ]5}t          t	          ||d ¦  «        ¦  «        r|                     |¦  «         Œ6|�`t          |¦  «        sQt          |t          ¦  «        r|}nt          |¦  «        }t          |||¦  «        }	|	o|	d         }t          |¦  «        }| j
        }
||
d<   ||
d<   ||
d<   ||
d<   ||
d<   d S )	Nz#Cannot spec a Mock object. [object=Ú]rà   Ú_spec_classÚ	_spec_setÚ_spec_signatureÚ_mock_methodsÚ_spec_asyncs)r.   r   Údirr   r1   Úappendro   r/   r>   rR   rr   )rW   rþ   rý   r  r  r&  r(  r*  r¢   Úresrr   s              r#   r  zNonCallableMock._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        �| j        j        }|t          u r%| j        €|                      | d¬¦  «        }|| _        |S )Nú()©r  r  )rÑ   rŸ   r—   r   r  Ú_get_child_mock)rW   r˜   s     r#   Ú__get_return_valuez"NonCallableMock.__get_return_value  s]   € ØÔ%ˆØÔÐ*ØÔ%Ô2ˆCà•'ˆ>ˆ>˜dÔ.Ð6Ø×&Ò&Ø ¨Dð 'ñ ô ˆCð !$ˆDÔØˆ
r"   c                 ób   — | j         �|| j         _        d S || _        t          | |d d¦  «         d S )Nr/  )rŸ   r—   rÑ   rï   )rW   rØ   s     r#   Ú__set_return_valuez"NonCallableMock.__set_return_value%  s>   € ØÔÐ*Ø/4ˆDÔÔ,Ð,Ð,à&+ˆDÔ#Ý! $¨¨t°TÑ:Ô:Ð:Ð:Ð:r"   z1The value to be returned when the mock is called.c                 ó<   — | j         €t          | ¦  «        S | j         S r<   )r&  r>   r¾   s    r#   Ú	__class__zNonCallableMock.__class__1  s    € àÔÐ#Ý˜‘:”:ÐØÔÐr"   r™   rš   r›   rœ   r•   c                 óÊ   — | j         }|€| j        S |j        }|�It          |¦  «        s:t	          |t
          ¦  «        s%t          |¦  «        st          |¦  «        }||_        |S r<   )rŸ   rÐ   r�   Úcallabler/   rñ   rA   )rW   Ú	delegatedÚsfs      r#   Ú__get_side_effectz!NonCallableMock.__get_side_effect>  sj   € ØÔ'ˆ	ØÐØÔ)Ð)ØÔ"ˆØˆN¥8¨B¡<¤<ˆNÝ" 2¥yÑ1Ô1ð Ý:GÈÑ:KÔ:Kð å˜2‘”ˆBØ$&ˆIÔ!Øˆ	r"   c                 óV   — t          |¦  «        }| j        }|€	|| _        d S ||_        d S r<   )Ú	_try_iterrŸ   rÐ   r�   )rW   rØ   r9  s      r#   Ú__set_side_effectz!NonCallableMock.__set_side_effectI  s9   € Ý˜%Ñ Ô ˆØÔ'ˆ	ØÐØ%*ˆDÔ"Ð"Ð"à$)ˆIÔ!Ð!Ð!r"   ©r—   r�   c                óN  — |€g }t          | ¦  «        |v rdS |                     t          | ¦  «        ¦  «         d| _        d| _        d| _        t          ¦   «         | _        t          ¦   «         | _        t          ¦   «         | _        |rt          | _
        |rd| _        | j                             ¦   «         D ]9}t          |t          ¦  «        s	|t           u rŒ!|                     |||¬¦  «         Œ:| j
        }t%          |¦  «        r|| ur|                     |¦  «         dS dS dS )z-Restore the mock object to its initial state.NFr   r?  )Úidr,  r™   r›   rš   r“   r•   rœ   r”   r   rÑ   rÐ   rž   Úvaluesr/   Ú
_SpecStateÚ_deletedr–   r.   )rW   Úvisitedr—   r�   Úchildr˜   s         r#   r–   zNonCallableMock.reset_mockT  s5  € àˆ?Øˆ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          |||¦  «         ŒWdS )aZ  Set attributes on the mock through keyword arguments.

        Attributes plus return values and side effects can be set on child
        mocks using standard dot notation and unpacking a dictionary in the
        method call:

        >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
        >>> mock.configure_mock(**attrs)c                 ó8   — | d                               d¦  «        S )Nr   ú.)Úcount)Úentrys    r#   ú<lambda>z0NonCallableMock.configure_mock.<locals>.<lambda>  s   € °°q´·²ÀÑ1DÔ1D€ r"   )ÚkeyrI  N)ÚsortedÚitemsÚsplitÚpopr1   rg   )rW   rY   ÚargÚvalrX   Úfinalr5   rK  s           r#   r  zNonCallableMock.configure_mockr  sž   € õ ˜vŸ|š|™~œ~ð $EÐ#Dð	Fñ Fô Fð 
	%ð 
	%‰HˆC�ð
 —9’9˜S‘>”>ˆDØ—H’H‘J”JˆEØˆCØð *ð *�Ý˜c 5Ñ)Ô)��Ý�C˜ Ñ$Ô$Ð$Ð$ð
	%ð 
	%r"   c                 óŽ  — |dv rt          |¦  «        ‚| j        �%|| j        vs	|t          v rt          d|z  ¦  «        ‚nt          |¦  «        rt          |¦  «        ‚| j        s:| j        r	|| j        vr*|                     d¦  «        rt          |›d|›d�¦  «        ‚t          j        5  | j         	                    |¦  «        }|t          u rt          |¦  «        ‚|€Cd }| j        �t          | j        |¦  «        }|                      | |||| ¬¦  «        }|| j        |<   n‹t          |t          ¦  «        rv	 t!          |j        |j        |j        |j        |j        ¦  «        }n># t,          $ r1 | j        d         p| }t-          d|›d	|›d
| ›d|j        ›d�	¦  «        ‚w xY w|| j        |<   d d d ¦  «         n# 1 swxY w Y   |S )N>   r  r)  zMock 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*   r   r  r  rÌ   úCannot autospec attr ú from target ú, as it has already been mocked out. [target=ú, attr=r%  )rL   r)  Ú_all_magicsr·   r  r(   r   Ú_lockrž   rs   rD  r  r1   r1  r/   rC  r	   rþ   rý   ra   rì   r*   r   rr   )rW   r*   r}   r   Útarget_names        r#   rÊ   zNonCallableMock.__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  — | j         g}| j        }| }d}|dgk    rd}|�7|}|                     |j         |z   ¦  «         d}|j         dk    rd}|j        }|­7t          t	          |¦  «        ¦  «        }|j        pd}t          |¦  «        dk    r|d         dvr|dz  }||d<   d                     |¦  «        S )NrI  r/  r  rD   rà   )r/  z().r   )rÎ   rÏ   r,  rm   ÚreversedrÌ   râ   Újoin)rW   Ú
_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}|dvrd|z  }d}| j        �d}| j        rd}|| j        j        z  }dt	          | ¦  «        j        ›|›|›dt          | ¦  «        ›d�S )	Nr  )rD   zmock.z name=%rz spec=%rz spec_set=%rÚ<z id='z'>)ri  r&  r'  r   r>   rA  )rW   r*   Úname_stringÚspec_strings       r#   r¿   zNonCallableMock.__repr__Ó  s“   € Ø×&Ò&Ñ(Ô(ˆàˆØÐ(Ð(Ð(Ø$ tÑ+ˆKàˆØÔÐ'Ø$ˆKØŒ~ð -Ø,�Ø%¨Ô(8Ô(AÑAˆKøå�‰JŒJÔÐØˆKØˆKˆKÝˆt‰HŒHˆHˆHð	
ð 	
r"   c                 óv  — t           st                               | ¦  «        S | j        pg }t	          t          | ¦  «        ¦  «        }t          | j        ¦  «        }d„ | j         	                    ¦   «         D ¦   «         }d„ |D ¦   «         }d„ |D ¦   «         }t          t          ||z   |z   |z   ¦  «        ¦  «        S )z8Filter the output of `dir(mock)` to only useful members.c                 ó*   — g | ]\  }}|t           u¯|‘ŒS r!   )rD  )r)   Úm_nameÚm_values      r#   ú
<listcomp>z+NonCallableMock.__dir__.<locals>.<listcomp>ð  s1   € ð (ð (ð (Ù&�v˜wØ�hÐ&Ð&ð Ø&Ð&Ð&r"   c                 ó<   — g | ]}|                      d ¦  «        °|‘ŒS r%   r'   ©r)   Úes     r#   rr  z+NonCallableMock.__dir__.<locals>.<listcomp>ô  s)   € ÐCÐCÐC˜1°·²¸cÑ1BÔ1BÐC�QÐCÐCÐCr"   c                 óZ   — g | ](}|                      d ¦  «        rt          |¦  «        ¯&|‘Œ)S r%   )r(   r·   rt  s     r#   rr  z+NonCallableMock.__dir__.<locals>.<listcomp>õ  sE   € ð #ð #ð #˜1°·²¸cÑ1BÔ1Bð #Ý˜q‘\”\ð#�Qð #ð #ð #r"   )r   ÚobjectÚ__dir__r)  r+  r>   rm   rr   rž   rO  rN  Úset)rW   ÚextrasÚ	from_typeÚ	from_dictÚfrom_child_mockss        r#   rx  zNonCallableMock.__dir__è  sÐ   € åð 	(Ý—>’> $Ñ'Ô'Ð'àÔ#Ð) 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  ‡ ‡— |t           v rt                               ‰ ||¦  «        S ‰ j        r+‰ j        �$|‰ j        vr|‰ j        vrt          d|z  ¦  «        ‚|t          v rd|z  }t          |¦  «        ‚|t          v r¡‰ j        �|‰ j        vrt          d|z  ¦  «        ‚t          |¦  «        s5t          t          ‰ ¦  «        |t          ||¦  «        ¦  «         |Šˆˆ fd„}nft          ‰ |d |¦  «         t          t          ‰ ¦  «        ||¦  «         |‰ j        |<   n+|dk    r	|‰ _        d S t          ‰ |||¦  «        r
|‰ j        |<   ‰ j        r;t#          ‰ |¦  «        s+‰                      ¦   «         › d|› �}t          d|› �¦  «        ‚t                               ‰ ||¦  «        S )Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.c                  ó   •—  ‰‰g| ¢R i |¤ŽS r<   r!   )rX   r  r|   rW   s     €€r#   rL  z-NonCallableMock.__setattr__.<locals>.<lambda>  s!   ø€ ¨H¨H°TÐ,G¸DÐ,GÐ,GÐ,GÀBÐ,GÐ,G€ r"   r6  rI  zCannot set )rÚ   rw  Ú__setattr__r'  r)  rr   rL   Ú_unsupported_magicsr_  r.   rg   r>   Ú_get_methodrï   rž   r&  r  r0   ri  )rW   r*   rØ   ÚmsgÚ	mock_namer|   s   `    @r#   r€  zNonCallableMock.__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                 ó¨  — |t           v r>|t          | ¦  «        j        v r(t          t          | ¦  «        |¦  «         || j        vrd S | j                             |t          ¦  «        }|| j        v r)t          t          | ¦  «         	                    |¦  «         n|t          u rt          |¦  «        ‚|t          ur| j        |= t          | j        |<   d S r<   )r_  r>   rr   Údelattrrž   rs   Ú_missingr  r   Ú__delattr__rD  rL   )rW   r*   r5   s      r#   rˆ  zNonCallableMock.__delattr__!  sÐ   € Ø•;ÐÐ 4­4°©:¬:Ô+>Ð#>Ð#>Ý•D˜‘J”J Ñ%Ô%Ð%Ø˜4œ=Ð(Ð(ð �àÔ!×%Ò% d­HÑ5Ô5ˆØ�4”=Ð Ð Ý�¨Ñ.Ô.×:Ò:¸4Ñ@Ô@Ð@Ð@Ø•Hˆ_ˆ_Ý  Ñ&Ô&Ð&Ø•hÐÐØÔ# DÐ)Ý$,ˆÔ˜DÑ!Ð!Ð!r"   c                 ó6   — | j         pd}t          |||¦  «        S rC   )rÌ   Ú_format_call_signature©rW   rX   rY   r*   s       r#   Ú_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature3  s    € ØŒÐ( &ˆÝ% d¨D°&Ñ9Ô9Ð9r"   r   c                 ód   — d}|                       ||¦  «        }| j        } | j         |Ž }||||fz  S )Nz0expected %s not found.
Expected: %s
  Actual: %s)rŒ  r›   )rW   rX   rY   ÚactionÚmessageÚexpected_stringr›   Úactual_strings           r#   Ú_format_mock_failure_messagez,NonCallableMock._format_mock_failure_message8  sD   € ØFˆØ×:Ò:¸4ÀÑHÔHˆØ”Nˆ	Ø8˜Ô8¸)ÐDˆØ˜& /°=ÐAÑAÐAr"   c                 ó  — |s| j         S d}|                     dd¦  «                             d¦  «        }| j        }|D ]M}|                     |¦  «        }|�t          |t          ¦  «        r nt          |¦  «        }|j        }|j         }ŒN|S )aH  
        * If call objects are asserted against a method/function like obj.meth1
        then there could be no name for the call object to lookup. Hence just
        return the spec_signature of the method/function being asserted against.
        * If the name is not empty then remove () and split by '.' to get
        list of names to iterate through the children until a potential
        match is found. A child mock is created only during attribute access
        so if we get a _SpecState then no attributes of the spec were accessed
        and can be safely exited.
        Nr/  r  rI  )r(  ÚreplacerP  rž   rs   r/   rC  rF   )rW   r*   rZ   ÚnamesÚchildrenrF  s         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          |¦  «        dk    r|                      |d         ¦  «        }n| j        }|�vt          |¦  «        dk    rd}|\  }}n|\  }}}	  |j        |i |¤Ž}t          ||j        |j        ¦  «        S # t          $ r}| 
                    d¦  «        cY d}~S d}~ww xY w|S )a  
        Given a call (or simply an (args, kwargs) tuple), return a
        comparison key suitable for matching with other calls.
        This is a best effort method which relies on the spec's signature,
        if available, or falls back on the arguments themselves.
        r´   r   Nr  )r/   rn   râ   r—  r(  rV   r   rX   rY   Ú	TypeErrorÚwith_traceback)rW   Ú_callrZ   r*   rX   rY   Ú
bound_callru  s           r#   Ú_call_matcherzNonCallableMock._call_matchera  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   Á0'B Â
CÂ"B<Â6CÂ<Cc                 óŒ   — | j         dk    r8d| j        pd›d| j         ›d|                      ¦   «         ›�}t          |¦  «        ‚dS )z/assert that the mock was never called.
        r   ú
Expected 'rD   z"' to not have been called. Called ú times.N©rš   rÌ   Ú_calls_reprÚAssertionError©rW   rƒ  s     r#   r‰   z!NonCallableMock.assert_not_called|  s^   € ð Œ?˜aÒÐÐà”oÐ/¨Ð/Ð/Ø”o�o�oØ×&Ò&Ñ(Ô(Ð(ð*ˆCõ ! Ñ%Ô%Ð%ð  Ðr"   c                 óR   — | j         dk    rd| j        pdz  }t          |¦  «        ‚dS )z6assert that the mock was called at least once
        r   z"Expected '%s' to have been called.rD   N)rš   rÌ   r£  r¤  s     r#   r‡   zNonCallableMock.assert_called†  s;   € ð Œ?˜aÒÐØ7Ø”OÐ- vñ/ˆCå  Ñ%Ô%Ð%ð  Ðr"   c                 óŒ   — | j         dk    s8d| j        pd›d| j         ›d|                      ¦   «         ›�}t          |¦  «        ‚dS )z3assert that the mock was called only once.
        rà   rŸ  rD   z#' to have been called once. Called r   Nr¡  r¤  s     r#   r‹   z"NonCallableMock.assert_called_onceŽ  s^   € ð Œ !Ò#Ð#Ð#à”oÐ/¨Ð/Ð/Ø”o�o�oØ×&Ò&Ñ(Ô(Ð(ð*ˆCõ ! Ñ%Ô%Ð%ð $Ð#r"   c                ót  ‡ ‡‡— ‰ j         €/‰                      ‰‰¦  «        }d}d|›d|›�}t          |¦  «        ‚ˆˆˆ fd„}‰                      t	          ‰‰fd¬¦  «        ¦  «        }‰                      ‰ j         ¦  «        }||k    r1t          |t          ¦  «        r|nd}t           |¦   «         ¦  «        |‚dS )z½assert that the last call was made with the specified arguments.

        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock.Nznot called.z#expected call not found.
Expected: z
  Actual: c                  ó4   •— ‰                      ‰‰¦  «        } | S r<   ©r’  ©rƒ  rX   rY   rW   s    €€€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)rW   rX   rY   ÚexpectedÚactualÚerror_messager«  Úcauses   ```     r#   rƒ   z"NonCallableMock.assert_called_with˜  sì   øøø€ ð
 Œ>Ð!Ø×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                ó¢   — | j         dk    s8d| j        pd›d| j         ›d|                      ¦   «         ›�}t          |¦  «        ‚ | j        |i |¤ŽS )ziassert that the mock was called exactly once and that that call was
        with the specified arguments.rà   rŸ  rD   z' to be called once. Called r   )rš   rÌ   r¢  r£  rƒ   ©rW   rX   rY   rƒ  s       r#   r�   z'NonCallableMock.assert_called_once_with®  sn   € ð Œ !Ò#Ð#Ð#à”oÐ/¨Ð/Ð/Ø”o�o�oØ×&Ò&Ñ(Ô(Ð(ð*ˆCõ ! Ñ%Ô%Ð%Ø&ˆtÔ&¨Ð7°Ð7Ð7Ð7r"   c                 ó†  ‡ — ˆ fd„|D ¦   «         }t          d„ |D ¦   «         d¦  «        }t          ˆ fd„‰ j        D ¦   «         ¦  «        }|su||vro|€d}nd                     d„ |D ¦   «         ¦  «        }t	          |› dt          |¦  «        › ‰                      d	¬
¦  «                             d¦  «        › �¦  «        |‚dS t          |¦  «        }g }|D ]=}	 |                     |¦  «         Œ# t          $ r | 
                    |¦  «         Y Œ:w xY w|r-t	          ‰ j        pd›dt          |¦  «        ›d|›d�¦  «        |‚dS )a‡  assert the mock has been called with the specified calls.
        The `mock_calls` list is checked for the calls.

        If `any_order` is False (the default) then the calls must be
        sequential. There can be extra calls before or after the
        specified calls.

        If `any_order` is True then the calls can be in any order, but
        they must all appear in `mock_calls`.c                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r!   ©r�  ©r)   ÚcrW   s     €r#   rr  z4NonCallableMock.assert_has_calls.<locals>.<listcomp>Ä  ó'   ø€ Ð9Ð9Ð9¨a�D×&Ò& qÑ)Ô)Ð9Ð9Ð9r"   c              3   óD   K  — | ]}t          |t          ¦  «        ¯|V — Œd S r<   ©r/   r¯  rt  s     r#   ú	<genexpr>z3NonCallableMock.assert_has_calls.<locals>.<genexpr>Å  ó1   è è € ÐFÐF˜A­Z¸½9Ñ-EÔ-EÐF�aÐFÐFÐFÐFÐFÐFr"   Nc              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S r<   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"   zCalls not found.z+Error processing expected calls.
Errors: {}c                 ó@   — g | ]}t          |t          ¦  «        r|nd ‘ŒS r<   r½  rt  s     r#   rr  z4NonCallableMock.assert_has_calls.<locals>.<listcomp>Î  ó;   € ð $7ð $7ð $7Ø()õ *4°AµyÑ)AÔ)AÐ$K A AÀtð $7ð $7ð $7r"   ú
Expected: z  Actual)ÚprefixrI  rD   z does not contain all of z in its call list, found z instead)rõ   r“   r•   Úformatr£  r¢  Úrstriprm   ÚremoverN   r,  rÌ   rn   )	rW   ÚcallsÚ	any_orderr°  r³  Ú	all_callsÚproblemÚ	not_foundÚkalls	   `        r#   r�   z NonCallableMock.assert_has_callsº  sè  ø€ ð :Ð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ð õ %Øð Ið IÝ!*¨5Ñ!1Ô!1ðIà×'Ò'¨zÐ'Ñ:Ô:×AÒAÀ#ÑFÔFðIð Iñô ð ð	ð
 ˆFå˜‘O”Oˆ	àˆ	Øð 	'ð 	'ˆDð'Ø× Ò  Ñ&Ô&Ð&Ð&øÝð 'ð 'ð 'Ø× Ò  Ñ&Ô&Ð&Ð&Ð&ð'øøøàð 	Ý à&*¤oÐ&?¸Ð&?Ð&?Ý&+¨IÑ&6Ô&6Ð&6Ð&6¸	¸	¸	ðCñô ð ð	ð	ð 	s   ÃC-Ã-DÄDc                ó$  ‡ — ‰                       t          ||fd¬¦  «        ¦  «        }t          |t          ¦  «        r|nd}ˆ fd„‰ j        D ¦   «         }|s|t          |¦  «        vr)‰                      ||¦  «        }t          d|z  ¦  «        |‚dS )zùassert the mock has been called with the specified arguments.

        The assert passes if the mock has *ever* been called, unlike
        `assert_called_with` and `assert_called_once_with` that only pass if
        the call is the most recent one.Tr¬  Nc                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r!   r¸  r¹  s     €r#   rr  z3NonCallableMock.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£  ©rW   rX   rY   r°  r³  r±  r�  s   `      r#   r‘   zNonCallableMock.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                óŒ  — | j         r7d|v rd|d         › �nd}|                      ¦   «         |z   }t          |¦  «        ‚|                     d¦  «        }|| j        d         v rt          di |¤ŽS t          | ¦  «        }t          |t          ¦  «        r|t          v rt
          }nšt          |t          ¦  «        r)|t          v s| j        r|| j        v rt          }ndt
          }n\t          |t          ¦  «        s:t          |t          ¦  «        rt          }n*t          |t          ¦  «        rt           }n|j        d         } |di |¤ŽS )aP  Create the child mocks for attributes and return value.
        By default child mocks will be the same type as the parent.
        Subclasses of Mock may want to override this to customize the way
        child mocks are made.

        For non-callable mocks the callable variant will be used (rather than
        any custom subclass).r*   rI  r/  r  r*  rà   r!   )r  ri  rL   rs   rr   r
   r>   r=   r   Ú_async_method_magicsrÿ   Ú_all_sync_magicsr)  ÚCallableMixinr   r   r   rq   )rW   r  ri   r„  r  Ú_typeÚklasss          r#   r1  zNonCallableMock._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                 óJ   — | j         sdS d|› dt          | j         ¦  «        › d�S )zÓRenders self.mock_calls as a string.

        Example: "
Calls: [call(1), call(2)]."

        If self.mock_calls is empty, an empty string is returned. The
        output will be truncated if very long.
        r  Ú
z: rI  )r•   r   )rW   rÄ  s     r#   r¢  zNonCallableMock._calls_repr  s6   € ð Œð 	Ø�2Ø;�FÐ;Ð;�i¨¬Ñ8Ô8Ð;Ð;Ð;Ð;r"   )NNNNNNr  NFNF©F)FFr<   )r   )rØ  )/r   r   r   r    r   r`  r  rH   r  r#  r  Ú"_NonCallableMock__get_return_valueÚ"_NonCallableMock__set_return_valueÚ"_NonCallableMock__return_value_docrÜ   r—   r6  rÝ   r™   rš   r›   rœ   r•   Ú!_NonCallableMock__get_side_effectÚ!_NonCallableMock__set_side_effectr�   r–   r  rÊ   ri  r¿   rx  r€  rˆ  rŒ  r’  r—  r�  r‰   r‡   r‹   rƒ   r�   r�   r‘   r1  r¢  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                   ó   — e Zd ZdZd„ ZdS )rÐ  zÏA list which checks if it contains a call which may have an
    argument of ANY, flipping the components of item and self from
    their traditional locations so that ANY is guaranteed to be on
    the left.c                 ó¨   — | D ]N}t          |¦  «        t          |¦  «        k    sJ ‚t          d„ t          ||¦  «        D ¦   «         ¦  «        r dS ŒOdS )Nc                 ó    — g | ]\  }}||k    ‘ŒS r!   r!   )r)   r°  r±  s      r#   rr  z-_AnyComparer.__contains__.<locals>.<listcomp>5  s1   € ð ð ð á$�H˜fð ˜FÒ"ðð ð r"   TF)râ   ÚallÚzip)rW   Úitemr›  s      r#   rá   z_AnyComparer.__contains__2  s{   € Øð 	ð 	ˆEÝ�t‘9”9¥ E¡
¤
Ò*Ð*Ð*Ð*Ýð ð å(+¨D°%Ñ(8Ô(8ðñ ô ñ ô ð ð �t�tð	ð
 ˆur"   N)r   r   r   r    rá   r!   r"   r#   rÐ  rÐ  -  s-   € € € € € ðð ðð ð ð ð r"   rÐ  c                 ó’   — | €| S t          | ¦  «        r| S t          | ¦  «        r| S 	 t          | ¦  «        S # t          $ r | cY S w xY wr<   )rA   rk   ró   r™  r4   s    r#   r=  r=  =  sk   € Ø
€{Øˆ
Ý�SÑÔð Øˆ
Ý��~„~ð Øˆ
ðÝ�C‰yŒyÐøÝð ð ð ð ˆ
ˆ
ˆ
ðøøøs   ¨7 ·AÁAc            
       óH   — e Zd Zddedddddddf
d„Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	rÕ  Nr  c           
      óx   — || j         d<    t          t          | ¦  «        j        |||||||	|
fi |¤Ž || _        d S )NrÑ   )rr   r  rÕ  rH   r�   )rW   rþ   r�   r—   r   r*   rý   rì   r  r  r  rY   s               r#   rH   zCallableMixin.__init__N  sa   € ð /;ˆŒÐ*Ñ+Ø1�•M 4Ñ(Ô(Ô1Ø�%˜˜x¨Ø˜ Kð	
ð 	
à39ð	
ð 	
ð 	
ð
 'ˆÔÐÐr"   c                ó   — d S r<   r!   rú   s      r#   r^   zCallableMixin._mock_check_sigZ  s   € àˆr"   c                óP   —  | j         |i |¤Ž  | j        |i |¤Ž  | j        |i |¤ŽS r<   )r^   Ú_increment_mock_callÚ
_mock_callrú   s      r#   rK   zCallableMixin.__call___  sK   € ð 	ˆÔ˜dÐ- fÐ-Ð-Ð-Ø!ˆÔ! 4Ð2¨6Ð2Ð2Ð2ØˆtŒ Ð/¨Ð/Ð/Ð/r"   c                ó   —  | j         |i |¤ŽS r<   )Ú_execute_mock_callrú   s      r#   rí  zCallableMixin._mock_callg  s   € Ø&ˆtÔ&¨Ð7°Ð7Ð7Ð7r"   c                ó~  — d| _         | xj        dz  c_        t          ||fd¬¦  «        }|| _        | j                             |¦  «         | j        d u}| j        }| j        }|dk    }| j	                             t          d||f¦  «        ¦  «         | j
        }|�¡|rB|j                             t          |||f¦  «        ¦  «         |j        d u}|r|j        dz   |z   }t          |||f¦  «        }	|j	                             |	¦  «         |j        r|rd}
nd}
|j        dk    }|j        |
z   |z   }|j
        }|­Ÿd S d S )NTrà   r¬  r/  r  rI  )r™   rš   r®  r›   rœ   r,  rÍ   rÌ   rÎ   r•   rÏ   r”   )rW   rX   rY   r›  Údo_method_callsÚmethod_call_nameÚmock_call_nameÚ	is_a_callr  Úthis_mock_callrg  s              r#   rì  z"CallableMixin._increment_mock_callj  s•  € ØˆŒØˆŒ˜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 |¤Ž}|t          ur|S | j        t          ur| j        S | j        r| j        j        t          ur| j        S | j        � | j        |i |¤ŽS | j        S r<   )	r�   rA   rk   rõ   r   rÑ   r—   rŸ   r  )rW   rX   rY   Úeffectr}   s        r#   rï  z CallableMixin._execute_mock_call˜  sç   € ð Ô!ˆØÐÝ˜VÑ$Ô$ð 1Ø�Ý˜vÑ&Ô&ð 1Ý˜f™œ�Ý  Ñ(Ô(ð !Ø �Lð!ð  ˜ Ð0¨Ð0Ð0�à�WÐ$Ð$Ø�àÔ"­'Ð1Ð1ØÔ$Ð$àÔð 	% 4Ô#6Ô#CÍ7Ð#RÐ#RØÔ$Ð$àÔÐ'Ø#�4Ô# TÐ4¨VÐ4Ð4Ð4àÔ Ð r"   )
r   r   r   r   rH   r^   rK   rí  rì  rï  r!   r"   r#   rÕ  rÕ  L  s‹   € € € € € à ¨dÀØ $°¸dØ!¨R¸Tð	'ð 	'ð 	'ð 	'ðð ð ð
0ð 0ð 0ð8ð 8ð 8ð,7ð ,7ð ,7ð\!ð !ð !ð !ð !r"   rÕ  c                   ó   — e Zd ZdZdS )r   a¶
  
    Create a new `Mock` object. `Mock` takes several optional arguments
    that specify the behaviour of the Mock object:

    * `spec`: This can be either a list of strings or an existing object (a
      class or instance) that acts as the specification for the mock object. If
      you pass in an object then a list of strings is formed by calling dir on
      the object (excluding unsupported magic attributes and methods). Accessing
      any attribute not in this list will raise an `AttributeError`.

      If `spec` is an object (rather than a list of strings) then
      `mock.__class__` returns the class of the spec object. This allows mocks
      to pass `isinstance` tests.

    * `spec_set`: A stricter variant of `spec`. If used, attempting to *set*
      or get an attribute on the mock that isn't on the object passed as
      `spec_set` will raise an `AttributeError`.

    * `side_effect`: A function to be called whenever the Mock is called. See
      the `side_effect` attribute. Useful for raising exceptions or
      dynamically changing return values. The function is called with the same
      arguments as the mock, and unless it returns `DEFAULT`, the return
      value of this function is used as the return value.

      If `side_effect` is an iterable then each call to the mock will return
      the next value from the iterable. If any of the members of the iterable
      are exceptions they will be raised instead of returned.

    * `return_value`: The value returned when the mock is called. By default
      this is a new Mock (created on first access). See the
      `return_value` attribute.

    * `unsafe`: By default, accessing any attribute whose name starts with
      *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an
       AttributeError. Passing `unsafe=True` will allow access to
      these attributes.

    * `wraps`: Item for the mock object to wrap. If `wraps` is not None then
      calling the Mock will pass the call through to the wrapped object
      (returning the real result). Attribute access on the mock will return a
      Mock object that wraps the corresponding attribute of the wrapped object
      (so attempting to access an attribute that doesn't exist will raise an
      `AttributeError`).

      If the mock has an explicit `return_value` set then calls are not passed
      to the wrapped object and the `return_value` is returned instead.

    * `name`: If the mock has a name then it will be used in the repr of the
      mock. This can be useful for debugging. The name is propagated to child
      mocks.

    Mocks can also be called with arbitrary keyword arguments. These will be
    used to set attributes on the mock after it is created.
    Nr   r!   r"   r#   r   r   ·  s   € € € € € ð5ð 5ð 5ð 5r"   r   c                 ó@   — d}|D ]}|| v rt          |›d�¦  «        ‚Œd S )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                   ó~   — e Zd ZdZg Zddœd„Zd„ Zd„ Zd„ Ze	j
        d„ ¦   «         Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )Ú_patchNF©r  c
                ó¬  — |�)|t           urt          d¦  «        ‚|�t          d¦  «        ‚|
st          |	¦  «         t          |¦  «        rt	          d|›d|›d�¦  «        ‚t          |¦  «        rt	          d|›d|›d�¦  «        ‚|| _        || _        || _        || _        || _	        || _
        d| _        || _        || _        |	| _        g | _        d S )Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot 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)r   rN   r  r.   r   Úgetterri   r
  Únew_callablerþ   ÚcreateÚ	has_localrý   ÚautospecrY   Úadditional_patchers)rW   r  ri   r
  rþ   r  rý   r
  r  rY   r  s              r#   rH   z_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„ | j        D ¦   «         |_        |S )Nc                 ó6   — g | ]}|                      ¦   «         ‘ŒS r!   )Úcopy)r)   Úps     r#   rr  z_patch.copy.<locals>.<listcomp>,  s-   € ð '
ð '
ð '
ØˆA�FŠF‰HŒHð'
ð '
ð '
r"   )r  r  ri   r
  rþ   r  rý   r
  r  rY   Úattribute_namer  )rW   Úpatchers     r#   r  z_patch.copy%  sq   € ÝØŒK˜œ¨¬°4´9ØŒK˜œØŒM˜4Ô,¨d¬kñ
ô 
ˆð
 "&Ô!4ˆÔð'
ð '
Ø"Ô6ð'
ñ '
ô '
ˆÔ#ð ˆr"   c                 óÒ   — t          |t          ¦  «        r|                      |¦  «        S t          j        |¦  «        r|                      |¦  «        S |                      |¦  «        S r<   ©r/   r>   Údecorate_classr2   r   Údecorate_async_callableÚdecorate_callable)rW   r9   s     r#   rK   z_patch.__call__2  sc   € Ý�d�DÑ!Ô!ð 	-Ø×&Ò& tÑ,Ô,Ð,ÝÔ& tÑ,Ô,ð 	6Ø×/Ò/°Ñ5Ô5Ð5Ø×%Ò% dÑ+Ô+Ð+r"   c                 ó  — t          |¦  «        D ]q}|                     t          j        ¦  «        sŒ"t	          ||¦  «        }t          |d¦  «        sŒC|                      ¦   «         }t          || ||¦  «        ¦  «         Œr|S ©NrK   )r+  r(   r   ÚTEST_PREFIXr1   r0   r  rg   )rW   r×  r¢   Ú
attr_valuer  s        r#   r  z_patch.decorate_class:  s†   € Ý˜‘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              #   óT  K  — g }t          j        ¦   «         5 }|j        D ]W}|                     |¦  «        }|j        �|                     |¦  «         Œ4|j        t          u r|                     |¦  «         ŒX|t          |¦  «        z  }||fV — d d d ¦  «         d S # 1 swxY w Y   d S r<   )
Ú
contextlibÚ	ExitStackÚ	patchingsÚenter_contextr  Úupdater
  r   r,  rn   )rW   ÚpatchedrX   ÚkeywargsÚ
extra_argsÚ
exit_stackÚpatchingrR  s           r#   Údecoration_helperz_patch.decoration_helperH  s  è è € àˆ
ÝÔ!Ñ#Ô#ð 		# zØ#Ô-ð +ð +�Ø ×.Ò.¨xÑ8Ô8�ØÔ*Ð6Ø—O’O CÑ(Ô(Ð(Ð(Ø”\¥WÐ,Ð,Ø×%Ò% cÑ*Ô*Ð*øà•E˜*Ñ%Ô%Ñ%ˆDØ˜Ð"Ð"Ð"Ð"ð		#ð 		#ð 		#ñ 		#ô 		#ð 		#ð 		#ð 		#ð 		#ð 		#ð 		#ð 		#øøøð 		#ð 		#ð 		#ð 		#ð 		#ð 		#s   ˜A8BÂB!Â$B!c                 ó¬   ‡ ‡‡— t          ‰d¦  «        r‰j                             ‰ ¦  «         ‰S t          ‰¦  «        ˆˆˆ fd„¦   «         Š‰ g‰_        ‰S )Nr  c                  ó|   •— ‰                      ‰| |¦  «        5 \  }} ‰|i |¤Žcd d d ¦  «         S # 1 swxY w Y   d S r<   ©r&  ©rX   r"  ÚnewargsÚnewkeywargsr9   r!  rW   s       €€€r#   r!  z)_patch.decorate_callable.<locals>.patched]  s™   ø€ à×'Ò'¨Ø(,Ø(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©r0   r  r,  r   ©rW   r9   r!  s   ``@r#   r  z_patch.decorate_callableW  sv   øøø€ å�4˜Ñ%Ô%ð 	ØŒN×!Ò! $Ñ'Ô'Ð'ØˆKå	ˆt‰Œð	5ð 	5ð 	5ð 	5ð 	5ð 	5ñ 
Œð	5ð "˜FˆÔØˆr"   c                 ó¬   ‡ ‡‡— t          ‰d¦  «        r‰j                             ‰ ¦  «         ‰S t          ‰¦  «        ˆˆˆ fd„¦   «         Š‰ g‰_        ‰S )Nr  c               Ÿ   óŒ   •K  — ‰                      ‰| |¦  «        5 \  }} ‰|i |¤Žƒ d {V —†cd d d ¦  «         S # 1 swxY w Y   d S r<   r)  r*  s       €€€r#   r!  z/_patch.decorate_async_callable.<locals>.patchedn  s¯   øè è € à×'Ò'¨Ø(,Ø(0ñ2ô 2ð ;á5K°g¸{Ø!˜T 7Ð:¨kÐ:Ð:Ð:Ð:Ð:Ð:Ð:Ð:ð;ð ;ð ;ð ;ñ ;ô ;ð ;ð ;ð ;ð ;ð ;ð ;øøøð ;ð ;ð ;ð ;ð ;ð ;s   ›9¹=Á =r-  r.  s   ``@r#   r  z_patch.decorate_async_callableh  sv   øøø€ å�4˜Ñ%Ô%ð 	ØŒN×!Ò! $Ñ'Ô'Ð'ØˆKå	ˆt‰Œð	;ð 	;ð 	;ð 	;ð 	;ð 	;ñ 
Œð	;ð "˜FˆÔØˆr"   c                 ó`  — |                       ¦   «         }| j        }t          }d}	 |j        |         }d}n-# t          t
          f$ r t          ||t          ¦  «        }Y nw xY w|t          v rt          |t          ¦  «        rd| _
        | j
        s|t          u rt	          |›d|›�¦  «        ‚||fS )NFTz does not have the attribute )r  ri   r   rr   rL   ÚKeyErrorr1   Ú	_builtinsr/   r   r  )rW   Útargetr*   r|   Úlocals        r#   Úget_originalz_patch.get_originaly  sÔ   € Ø—’‘”ˆØŒ~ˆåˆØˆð	Ø” 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        }|                      ¦   «         | _        |du rd}|du rd}|du rd}|�|�t          d¦  «        ‚|€|�|dvrt          d¦  «        ‚|  	                    ¦   «         \  }}|t          u �r•|�€’d}	|du r|}|du r|}d}n|�	|du r|}d}n|du r|}|€|�/|t          u rt          d¦  «        ‚t          |t          ¦  «        rd}	|€t          |¦  «        rt          }
nt          }
i }|�|}
nN|€|�J|}|�|}t!          |¦  «        rd|v}nt#          |¦  «         }t          |¦  «        rt          }
n	|rt$          }
|�||d	<   |�||d
<   t          |
t          ¦  «        r&t'          |
t(          ¦  «        r| j        r
| j        |d<   |                     |¦  «          |
di |¤Ž}|	r_t/          |¦  «        rP|}|�|}t!          |¦  «        st1          |¦  «        st$          }
|                     d¦  «          |
d|ddœ|¤Ž|_        nõ|�â|t          urt          d¦  «        ‚|t          u rt          d¦  «        ‚t7          |¦  «        }|du r|}t/          | j        ¦  «        r#t9          d| j        ›d| j        ›d|›d�¦  «        ‚t/          |¦  «        rAt;          | j        d| j        ¦  «        }t9          d| j        ›d|›d| j        ›d|›d�	¦  «        ‚t=          |f|| j        dœ|¤Ž}n|rt          d¦  «        ‚|}|| _        || _         tC          j"        ¦   «         | _#        	 tI          | j        | j        |¦  «         | j%        �ci }| j         t          u r
||| j%        <   | j&        D ]?}| j#         '                    |¦  «        }|j         t          u r|                     |¦  «         Œ@|S |S #   | j(        tS          j*        ¦   «         Ž s‚ Y dS xY w)zPerform the patch.FNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerK   rþ   rý   r*   r/  r0  zBautospec 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%  r   r\  r]  )rý   Ú_namez.Can't pass kwargs to a mock we aren't creatingr!   )+r
  rþ   rý   r
  rY   r  r  r4  r™  r6  r   r/   r>   r6   r
   r   ro   r8  r   r=   r   ri   r   r.   ru   rQ  r—   Úboolr   r1   r	   Útemp_originalÚis_localr  r  Ú_exit_stackrg   r  r  r  Ú__exit__ÚsysÚexc_info)rW   r
  rþ   rý   r
  rY   r  r|   r5  ÚinheritÚKlassÚ_kwargsÚ	this_specÚnot_callablera  Únew_attrr#  r%  rR  s                      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   ÍBO ÏO ÏO<c                 óh  — | j         r/| j        t          ur!t          | j        | j        | j        ¦  «         ndt          | j        | j        ¦  «         | j        sCt          | j        | j        ¦  «        r	| j        dv r t          | j        | j        | j        ¦  «         | `| ` | `| j	        }| `	 |j
        |Ž S )zUndo the patch.)r    r   re   Ú__annotations__rf   )r;  r:  r   rg   r4  ri   r†  r  r0   r<  r=  )rW   r?  r$  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                 ób   — |                       ¦   «         }| j                             | ¦  «         |S ©z-Activate a patch, returning any created mock.)rF  Ú_active_patchesr,  ©rW   r}   s     r#   Ústartz_patch.start8  s-   € à—’Ñ!Ô!ˆØÔ×#Ò# DÑ)Ô)Ð)Øˆr"   c                 óŠ   — 	 | j                              | ¦  «         n# t          $ r Y dS w xY w|                      ddd¦  «        S ©zStop an active patch.N)rK  rÇ  rN   r=  r¾   s    r#   Ústopz_patch.stop?  s[   € ð	ØÔ ×'Ò'¨Ñ-Ô-Ð-Ð-øÝð 	ð 	ð 	à�4�4ð	øøøð �}Š}˜T 4¨Ñ.Ô.Ð.s   ‚ �
+ª+)r   r   r   r  rK  rH   r  rK   r  r  Úcontextmanagerr&  r  r  r6  rF  r=  rM  rP  r!   r"   r#   r  r  û  sø   € € € € € à€NØ€Oð AFð"&ð "&ð "&ð "&ð "&ðJ
ð 
ð 
ð,ð ,ð ,ðð ð ð Ôð#ð #ñ Ôð#ðð ð ð"ð ð ð"ð ð ð0Pð Pð Pðd.ð .ð .ð*ð ð ð/ð /ð /ð /ð /r"   r  c                 óÊ   — 	 |                       dd¦  «        \  } }n-# t          t          t          f$ r t          d| ›�¦  «        ‚w xY wt	          t
          j        | ¦  «        |fS )NrI  rà   z,Need a valid target to patch. You supplied: )Úrsplitr™  rN   rL   r   ÚpkgutilÚresolve_name)r4  ri   s     r#   Ú_get_targetrV  K  s‚   € ðGØ"ŸMšM¨#¨qÑ1Ô1Ñˆ�	�	øÝ•z¥>Ð2ð Gð Gð GÝØE¸6ÐEÐEñGô Gð 	GðGøøøõ •7Ô'¨Ñ0Ô0°)Ð;Ð;s	   ‚ œ*Ar  c                ó�   ‡ — t          ‰ ¦  «        t          u rt          ‰ ›d�¦  «        ‚ˆ fd„}
t          |
||||||||	|¬¦
  «
        S )a  
    patch the named member (`attribute`) on an object (`target`) with a mock
    object.

    `patch.object` can be used as a decorator, class decorator or a context
    manager. Arguments `new`, `spec`, `create`, `spec_set`,
    `autospec` and `new_callable` have the same meaning as for `patch`. Like
    `patch`, `patch.object` takes arbitrary keyword arguments for configuring
    the mock object it creates.

    When used as a class decorator `patch.object` honours `patch.TEST_PREFIX`
    for choosing which methods to wrap.
    z3 must be the actual object to be patched, not a strc                  ó   •— ‰ S r<   r!   ©r4  s   €r#   rL  z_patch_object.<locals>.<lambda>j  s   ø€ �V€ r"   r  )r>   Ústrr™  r  )r4  ri   r
  rþ   r  rý   r
  r  r  rY   r  s   `          r#   Ú_patch_objectr[  T  sn   ø€ õ$ ˆF�|„|•sÐÐÝØÐLÐLÐLñ
ô 
ð 	
ð ˆ^ˆ^ˆ^€FÝØ�	˜3  fØ�(˜L¨&¸ðñ ô ð r"   c                 óº  ‡ — t          ‰ ¦  «        t          u rt          t          j        ‰ ¦  «        }nˆ fd„}|st          d¦  «        ‚t          |                     ¦   «         ¦  «        }|d         \  }	}
t          ||	|
|||||i ¦	  «	        }|	|_	        |dd…         D ]=\  }	}
t          ||	|
|||||i ¦	  «	        }|	|_	        |j
                             |¦  «         Œ>|S )a¾  Perform multiple patches in a single call. It takes the object to be
    patched (either as an object or a string to fetch the object by importing)
    and keyword arguments for the patches::

        with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):
            ...

    Use `DEFAULT` as the value if you want `patch.multiple` to create
    mocks for you. In this case the created mocks are passed into a decorated
    function by keyword, and a dictionary is returned when `patch.multiple` is
    used as a context manager.

    `patch.multiple` can be used as a decorator, class decorator or a context
    manager. The arguments `spec`, `spec_set`, `create`,
    `autospec` and `new_callable` have the same meaning as for `patch`. These
    arguments will be applied to *all* patches done by `patch.multiple`.

    When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX`
    for choosing which methods to wrap.
    c                  ó   •— ‰ S r<   r!   rY  s   €r#   rL  z!_patch_multiple.<locals>.<lambda>Š  s   ø€ ˜€ r"   z=Must supply at least one keyword argument with patch.multipler   rà   N)r>   rZ  r   rT  rU  rN   rm   rO  r  r  r  r,  )r4  rþ   r  rý   r
  r  rY   r  rO  ri   r
  r  Úthis_patchers   `            r#   Ú_patch_multipler_  q  s
  ø€ õ, ˆ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                óX   — t          | ¦  «        \  }	}
t          |	|
||||||||¬¦
  «
        S )a:  
    `patch` acts as a function decorator, class decorator or a context
    manager. Inside the body of the function or with statement, the `target`
    is patched with a `new` object. When the function/with statement exits
    the patch is undone.

    If `new` is omitted, then the target is replaced with an
    `AsyncMock if the patched object is an async function or a
    `MagicMock` otherwise. If `patch` is used as a decorator and `new` is
    omitted, the created mock is passed in as an extra argument to the
    decorated function. If `patch` is used as a context manager the created
    mock is returned by the context manager.

    `target` should be a string in the form `'package.module.ClassName'`. The
    `target` is imported and the specified object replaced with the `new`
    object, so the `target` must be importable from the environment you are
    calling `patch` from. The target is imported when the decorated function
    is executed, not at decoration time.

    The `spec` and `spec_set` keyword arguments are passed to the `MagicMock`
    if patch is creating one for you.

    In addition you can pass `spec=True` or `spec_set=True`, which causes
    patch to pass in the object being mocked as the spec/spec_set object.

    `new_callable` allows you to specify a different class, or callable object,
    that will be called to create the `new` object. By default `AsyncMock` is
    used for async functions and `MagicMock` for the rest.

    A more powerful form of `spec` is `autospec`. If you set `autospec=True`
    then the mock will be created with a spec from the object being replaced.
    All attributes of the mock will also have the spec of the corresponding
    attribute of the object being replaced. Methods and functions being
    mocked will have their arguments checked and will raise a `TypeError` if
    they are called with the wrong signature. For mocks replacing a class,
    their return value (the 'instance') will have the same spec as the class.

    Instead of `autospec=True` you can pass `autospec=some_object` to use an
    arbitrary object as the spec instead of the one being replaced.

    By default `patch` will fail to replace attributes that don't exist. If
    you pass in `create=True`, and the attribute doesn't exist, patch will
    create the attribute for you when the patched function is called, and
    delete it again afterwards. This is useful for writing tests against
    attributes that your production code creates at runtime. It is off by
    default because it can be dangerous. With it switched on you can write
    passing tests against APIs that don't actually exist!

    Patch can be used as a `TestCase` class decorator. It works by
    decorating each test method in the class. This reduces the boilerplate
    code when your test methods share a common patchings set. `patch` finds
    tests by looking for method names that start with `patch.TEST_PREFIX`.
    By default this is `test`, which matches the way `unittest` finds tests.
    You can specify an alternative prefix by setting `patch.TEST_PREFIX`.

    Patch can be used as a context manager, with the with statement. Here the
    patching applies to the indented block after the with statement. If you
    use "as" then the patched object will be bound to the name after the
    "as"; very useful if `patch` is creating a mock object for you.

    Patch will raise a `RuntimeError` if passed some common misspellings of
    the arguments autospec and spec_set. Pass the argument `unsafe` with the
    value True to disable that check.

    `patch` takes arbitrary keyword arguments. These will be passed to
    `AsyncMock` if the patched object is asynchronous, to `MagicMock`
    otherwise or to `new_callable` if specified.

    `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are
    available for alternate use-cases.
    r  )rV  r  )r4  r
  rþ   r  rý   r
  r  r  rY   r  ri   s              r#   r   r   ¢  sD   € õV $ FÑ+Ô+Ñ€FˆIÝØ�	˜3  fØ�(˜L¨&¸ðñ ô ð r"   c                   óV   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zd„ Zd„ Zd„ ZdS )Ú_patch_dicta#  
    Patch a dictionary, or dictionary like object, and restore the dictionary
    to its original state after the test.

    `in_dict` can be a dictionary or a mapping like container. If it is a
    mapping then it must at least support getting, setting and deleting items
    plus iterating over keys.

    `in_dict` can also be a string specifying the name of the dictionary, which
    will then be fetched by importing it.

    `values` can be a dictionary of values to set in the dictionary. `values`
    can also be an iterable of `(key, value)` pairs.

    If `clear` is True then the dictionary will be cleared before the new
    values are set.

    `patch.dict` can also be called with arbitrary keyword arguments to set
    values in the dictionary::

        with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()):
            ...

    `patch.dict` can be used as a context manager, decorator or class
    decorator. When used as a class decorator `patch.dict` honours
    `patch.TEST_PREFIX` for choosing which methods to wrap.
    r!   Fc                 óŒ   — || _         t          |¦  «        | _        | j                             |¦  «         || _        d | _        d S r<   )Úin_dictÚdictrB  r   ÚclearÚ	_original)rW   rd  rB  rf  rY   s        r#   rH   z_patch_dict.__init__  s>   € ØˆŒå˜6‘l”lˆŒØŒ×Ò˜6Ñ"Ô"Ð"ØˆŒ
ØˆŒˆˆr"   c                 óÒ   — t          |t          ¦  «        r|                      |¦  «        S t          j        |¦  «        r|                      |¦  «        S |                      |¦  «        S r<   r  )rW   Úfs     r#   rK   z_patch_dict.__call__  sc   € Ý�a�ÑÔð 	*Ø×&Ò& qÑ)Ô)Ð)ÝÔ& qÑ)Ô)ð 	3Ø×/Ò/°Ñ2Ô2Ð2Ø×%Ò% aÑ(Ô(Ð(r"   c                 ó@   ‡ ‡— t          ‰¦  «        ˆˆ fd„¦   «         }|S )Nc                  ó˜   •— ‰                      ¦   «          	  ‰| i |¤Ž‰                     ¦   «          S # ‰                     ¦   «          w xY wr<   ©rb  Ú_unpatch_dict©rX   r  ri  rW   s     €€r#   Ú_innerz-_patch_dict.decorate_callable.<locals>._inner#  sV   ø€ à×ÒÑÔÐð%Ø�q˜$�~ "�~�~à×"Ò"Ñ$Ô$Ð$Ð$ø�×"Ò"Ñ$Ô$Ð$Ð$øøøs	   —3 ³A	©r   ©rW   ri  ro  s   `` r#   r  z_patch_dict.decorate_callable"  ó9   øø€ Ý	ˆq‰Œð	%ð 	%ð 	%ð 	%ð 	%ñ 
Œð	%ð ˆr"   c                 ó@   ‡ ‡— t          ‰¦  «        ˆˆ fd„¦   «         }|S )Nc               Ÿ   óª   •K  — ‰                      ¦   «          	  ‰| i |¤Žƒ d {V —†	 ‰                     ¦   «          S # ‰                     ¦   «          w xY wr<   rl  rn  s     €€r#   ro  z3_patch_dict.decorate_async_callable.<locals>._inner/  so   øè è € à×ÒÑÔÐð%Ø˜Q ˜^¨˜^˜^Ð+Ð+Ð+Ð+Ð+Ð+Ð+à×"Ò"Ñ$Ô$Ð$Ð$ø�×"Ò"Ñ$Ô$Ð$Ð$øøøs	   ™< ¼Arp  rq  s   `` r#   r  z#_patch_dict.decorate_async_callable.  rr  r"   c                 ó   — t          |¦  «        D ]}}t          ||¦  «        }|                     t          j        ¦  «        rLt          |d¦  «        r<t          | j        | j        | j	        ¦  «        } ||¦  «        }t          |||¦  «         Œ~|S r  )r+  r1   r(   r   r  r0   rb  rd  rB  rf  rg   )rW   r×  r¢   r  Ú	decoratorÚ	decorateds         r#   r  z_patch_dict.decorate_class:  s�   € Ý˜‘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                 ó8   — |                       ¦   «          | j        S )zPatch the dict.)rb  rd  r¾   s    r#   rF  z_patch_dict.__enter__E  s   € à×ÒÑÔÐØŒ|Ðr"   c                 ó®  — | j         }t          | j        t          ¦  «        rt	          j        | j        ¦  «        | _        | j        }| j        }	 |                     ¦   «         }n"# t          $ r i }|D ]}||         ||<   ŒY nw xY w|| _	        |rt          |¦  «         	 |                     |¦  «         d S # t          $ r |D ]}||         ||<   ŒY d S w xY wr<   )rB  r/   rd  rZ  rT  rU  rf  r  rL   rg  Ú_clear_dictr   )rW   rB  rd  rf  r|   rM  s         r#   rb  z_patch_dict._patch_dictK  s!  € Ø”ˆÝ�d”l¥CÑ(Ô(ð 	>Ý"Ô/°´Ñ=Ô=ˆDŒLØ”,ˆØ”
ˆð	-Ø—|’|‘~”~ˆHˆHøÝð 	-ð 	-ð 	-ð ˆHØð -ð -�Ø '¨¤�˜‘�ð-ð -ð		-øøøð "ˆŒàð 	!Ý˜Ñ Ô Ð ð	+Ø�NŠN˜6Ñ"Ô"Ð"Ð"Ð"øÝð 	+ð 	+ð 	+àð +ð +�Ø% cœ{�˜‘�ð+ð +ð +ð	+øøøs$   ÁA$ Á$BÂBÂB6 Â6CÃCc                 ó®   — | j         }| j        }t          |¦  «         	 |                     |¦  «         d S # t          $ r |D ]}||         ||<   ŒY d S w xY wr<   )rd  rg  rz  r   rL   )rW   rd  r|   rM  s       r#   rm  z_patch_dict._unpatch_dictg  sƒ   € Ø”,ˆØ”>ˆå�GÑÔÐð	-Ø�NŠN˜8Ñ$Ô$Ð$Ð$Ð$øÝð 	-ð 	-ð 	-Øð -ð -�Ø'¨œ}�˜‘�ð-ð -ð -ð	-øøøs   Ÿ6 ¶AÁAc                 ó<   — | j         �|                      ¦   «          dS )zUnpatch the dict.NF)rg  rm  )rW   rX   s     r#   r=  z_patch_dict.__exit__t  s!   € àŒ>Ð%Ø×ÒÑ Ô Ð Øˆur"   c                 ól   — |                       ¦   «         }t          j                             | ¦  «         |S rJ  )rF  r  rK  r,  rL  s     r#   rM  z_patch_dict.start{  s-   € à—’Ñ!Ô!ˆÝÔ×%Ò% dÑ+Ô+Ð+Øˆr"   c                 ó”   — 	 t           j                             | ¦  «         n# t          $ r Y dS w xY w|                      ddd¦  «        S rO  )r  rK  rÇ  rN   r=  r¾   s    r#   rP  z_patch_dict.stop‚  s[   € ð	ÝÔ"×)Ò)¨$Ñ/Ô/Ð/Ð/øÝð 	ð 	ð 	à�4�4ð	øøøð �}Š}˜T 4¨Ñ.Ô.Ð.s   ‚" ¢
0¯0N)r!   F)r   r   r   r    rH   rK   r  r  r  rF  rb  rm  r=  rM  rP  r!   r"   r#   rb  rb  ô  sÈ   € € € € € ðð ð8ð ð ð ð)ð )ð )ð	ð 	ð 	ð	ð 	ð 	ðð ð ðð ð ð+ð +ð +ð8
-ð 
-ð 
-ðð ð ðð ð ð/ð /ð /ð /ð /r"   rb  c                 ó€   — 	 |                       ¦   «          d S # t          $ r t          | ¦  «        }|D ]}| |= ŒY d S w xY wr<   )rf  rL   rm   )rd  ÚkeysrM  s      r#   rz  rz  �  se   € ðØ�Š‰ŒˆˆˆøÝð ð ð Ý�G‰}Œ}ˆØð 	ð 	ˆCØ˜��ð	ð 	ð 	ðøøøs   ‚ ˜!=¼=c                  óf   — t          t          j        ¦  «        D ]} |                      ¦   «          ŒdS )z7Stop all active patches. LIFO to unroll nested patches.N)rc  r  rK  rP  )r   s    r#   Ú_patch_stopallr‚  –  s5   € å�&Ô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 |z  V — Œ
dS )zi%sNr!   ©r)   Úns     r#   r¾  r¾  µ  s&   è è € Ð7Ð7 �5˜1‘9Ð7Ð7Ð7Ð7Ð7Ð7r"   c              #   ó    K  — | ]	}d |z  V — Œ
dS )zr%sNr!   r†  s     r#   r¾  r¾  ¶  s&   è è € Ð5Ð5˜q�˜‘Ð5Ð5Ð5Ð5Ð5Ð5r"   >   rx  Ú__get__Ú__set__r¿   Ú
__delete__Ú
__format__rÂ   Ú__missing__Ú__getstate__Ú__reversed__Ú__setstate__Ú__getformat__Ú__reduce_ex__Ú__getnewargs__Ú__subclasses__Ú__getinitargs__Ú__getnewargs_ex__c                 ó    ‡— ˆfd„}| |_         |S )z:Turns a callable object (like a mock) into a real functionc                ó   •—  ‰| g|¢R i |¤ŽS r<   r!   )rW   rX   r  r9   s      €r#   Úmethodz_get_method.<locals>.methodÇ  s#   ø€ Øˆt�DÐ&˜4Ð&Ð&Ð& 2Ð&Ð&Ð&r"   )r   )r*   r9   r™  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__r  rH   rÊ   Ú__prepare__r€  Ú__instancecheck__Ú__subclasscheck__c                 ó6   — t                                | ¦  «        S r<   )rw  Ú__hash__r¾   s    r#   rL  rL  ã  s   € �VŸ_š_¨TÑ2Ô2€ r"   c                 ó6   — t                                | ¦  «        S r<   )rw  Ú__str__r¾   s    r#   rL  rL  ä  s   € �FŸNšN¨4Ñ0Ô0€ r"   c                 ó6   — t                                | ¦  «        S r<   )rw  Ú
__sizeof__r¾   s    r#   rL  rL  å  s   € �v×0Ò0°Ñ6Ô6€ r"   c                 óx   — t          | ¦  «        j        › d|                      ¦   «         › dt          | ¦  «        › �S )Nú/)r>   r   ri  rA  r¾   s    r#   rL  rL  æ  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                 ó   ‡ — ˆ fd„}|S )Nc                 óL   •— ‰j         j        }|t          ur|S ‰| u rdS t          S ©NT)Ú__eq__rÑ   r   ÚNotImplemented)ÚotherÚret_valrW   s     €r#   r¹  z_get_eq.<locals>.__eq__û  s1   ø€ Ø”+Ô0ˆØ�'Ð!Ð!ØˆNØ�5ˆ=ˆ=Ø�4ÝÐr"   r!   )rW   r¹  s   ` r#   Ú_get_eqr½  ú  s#   ø€ ðð ð ð ð ð €Mr"   c                 ó   ‡ — ˆ fd„}|S )Nc                 óR   •— ‰j         j        t          urt          S ‰| u rdS t          S ©NF)Ú__ne__rÑ   r   rº  )r»  rW   s    €r#   rÁ  z_get_ne.<locals>.__ne__  s,   ø€ ØŒ;Ô)µÐ8Ð8ÝˆNØ�5ˆ=ˆ=Ø�5ÝÐr"   r!   )rW   rÁ  s   ` r#   Ú_get_nerÂ    s#   ø€ ðð ð ð ð ð €Mr"   c                 ó   ‡ — ˆ fd„}|S )Nc                  ój   •— ‰j         j        } | t          u rt          g ¦  «        S t          | ¦  «        S r<   )Ú__iter__rÑ   r   ró   ©r¼  rW   s    €r#   rÅ  z_get_iter.<locals>.__iter__  s1   ø€ Ø”-Ô2ˆØ•gÐÐÝ˜‘8”8ˆOõ �G‰}Œ}Ðr"   r!   )rW   rÅ  s   ` r#   Ú	_get_iterrÇ    s#   ø€ ðð ð ð ð ð €Or"   c                 ó   ‡ — ˆ fd„}|S )Nc                  óž   •— ‰j         j        } | t          u rt          t	          g ¦  «        ¦  «        S t          t	          | ¦  «        ¦  «        S r<   )rž  rÑ   r   Ú_AsyncIteratorró   rÆ  s    €r#   rž  z"_get_async_iter.<locals>.__aiter__  s@   ø€ Ø”.Ô3ˆØ•gÐÐÝ!¥$ r¡(¤(Ñ+Ô+Ð+Ý�d 7™mœmÑ,Ô,Ð,r"   r!   )rW   rž  s   ` r#   Ú_get_async_iterrË    s$   ø€ ð-ð -ð -ð -ð -ð
 Ðr"   )r¹  rÁ  rÅ  rž  c                 ó&  — t                                |t          ¦  «        }|t          ur	||_        d S t                               |¦  «        }|� || ¦  «        }||_        d S t
                               |¦  «        }|� || ¦  «        |_        d S d S r<   )Ú_return_valuesrs   r   r—   Ú_calculate_return_valueÚ_side_effect_methodsr�   )rD   r™  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                   ó   — e Zd Zd„ Zd„ ZdS )Ú
MagicMixinc                ó–   — |                       ¦   «           t          t          | ¦  «        j        |i |¤Ž |                       ¦   «          d S r<   )Ú_mock_set_magicsr  rÕ  rH   ©rW   rX   r  s      r#   rH   zMagicMixin.__init__;  sN   € Ø×ÒÑÔÐØ.�•J Ñ%Ô%Ô.°Ð;¸Ð;Ð;Ð;Ø×ÒÑÔÐÐÐr"   c           	      ó¨  — t           t          z  }|}t          | dd ¦  «        �X|                     | j        ¦  «        }t          ¦   «         }||z
  }|D ](}|t          | ¦  «        j        v rt          | |¦  «         Œ)|t          t          | ¦  «        j        ¦  «        z
  }t          | ¦  «        }|D ]!}t          ||t          || ¦  «        ¦  «         Œ"d S )Nr)  )Ú_magicsrÓ  r1   Úintersectionr)  ry  r>   rr   r†  rg   Ú
MagicProxy)rW   Úorig_magicsÚthese_magicsÚremove_magicsrK  rÖ  s         r#   r×  zMagicMixin._mock_set_magicsA  sá   € ÝÕ 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)r   r   r   rH   r×  r!   r"   r#   rÕ  rÕ  :  s2   € € € € € ð ð  ð  ð;ð ;ð ;ð ;ð ;r"   rÕ  c                   ó   — e Zd ZdZdd„ZdS )r   z-A version of `MagicMock` that isn't callable.Fc                 óZ   — |                       ||¦  «         |                      ¦   «          dS r!  ©r  r×  r"  s      r#   r#  z"NonCallableMagicMock.mock_add_spec[  ó2   € ð 	×Ò˜D (Ñ+Ô+Ð+Ø×ÒÑÔÐÐÐr"   NrÛ  ©r   r   r   r    r#  r!   r"   r#   r   r   Y  s.   € € € € € Ø7Ð7ð ð  ð  ð  ð  ð  r"   r   c                   ó   — e Zd Zd„ ZdS )ÚAsyncMagicMixinc                ó–   — |                       ¦   «           t          t          | ¦  «        j        |i |¤Ž |                       ¦   «          d S r<   )r×  r  ræ  rH   rØ  s      r#   rH   zAsyncMagicMixin.__init__f  sN   € Ø×ÒÑÔÐØ3�•O TÑ*Ô*Ô3°TÐ@¸RÐ@Ð@Ð@Ø×ÒÑÔÐÐÐr"   N©r   r   r   rH   r!   r"   r#   ræ  ræ  e  s#   € € € € € ð ð  ð  ð  ð  r"   ræ  c                   ó   — e Zd ZdZdd„ZdS )r   a„  
    MagicMock is a subclass of Mock with default implementations
    of most of the magic methods. You can use MagicMock without having to
    configure the magic methods yourself.

    If you use the `spec` or `spec_set` arguments then *only* magic
    methods that exist in the spec will be created.

    Attributes and the return value of a `MagicMock` will also be `MagicMocks`.
    Fc                 óZ   — |                       ||¦  «         |                      ¦   «          dS r!  râ  r"  s      r#   r#  zMagicMock.mock_add_specv  rã  r"   NrÛ  rä  r!   r"   r#   r   r   k  s2   € € € € € ð	ð 	ð ð  ð  ð  ð  ð  r"   r   c                   ó"   — e Zd Zd„ Zd„ Zdd„ZdS )rÜ  c                 ó"   — || _         || _        d S r<   ©r*   rì   )rW   r*   rì   s      r#   rH   zMagicProxy.__init__‚  s   € ØˆŒ	ØˆŒˆˆr"   c                 ó–   — | j         }| j        }|                     |||¬¦  «        }t          |||¦  «         t	          |||¦  «         |S )N)r*   r  r  )r*   rì   r1  rg   rÓ  )rW   rK  rì   Úms       r#   Úcreate_mockzMagicProxy.create_mock†  sZ   € Ø”	ˆØ”ˆØ×"Ò"¨¸Ø/5ð #ñ 7ô 7ˆå�˜˜qÑ!Ô!Ð!Ý˜& ! UÑ+Ô+Ð+Øˆr"   Nc                 ó*   — |                       ¦   «         S r<   )rð  )rW   r5   rÖ  s      r#   r‰  zMagicProxy.__get__�  s   € Ø×ÒÑ!Ô!Ð!r"   r<   )r   r   r   rH   rð  r‰  r!   r"   r#   rÜ  rÜ  �  sF   € € € € € ðð ð ðð ð ð"ð "ð "ð "ð "ð "r"   rÜ  c                   óœ   ‡ — e Zd Z ed¦  «        Z ed¦  «        Z ed¦  «        Zˆ fd„Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zdd„Zd„ Zˆ fd„Zˆ xZS )rÿ   r®   r¯   r°   c                óô  •—  t          ¦   «         j        |i |¤Ž t          j        j        | j        d<   d| j        d<   d | j        d<   t          ¦   «         | j        d<   t          t          ¬¦  «        }t          j
        t          j        z   t          j        z   |_        d|_        d|_        d|_        d|_        || j        d<   d	| j        d
<   t%          ¦   «         | j        d<   i | j        d<   d | j        d<   d S )Nr­   r   Ú_mock_await_countÚ_mock_await_argsÚ_mock_await_args_list©rý   )rX   rY   r8   r
   r   re   rf   rH  )ÚsuperrH   r«   r¬   r­   rr   r“   r   r   r2   ÚCO_COROUTINEÚ
CO_VARARGSÚCO_VARKEYWORDSÚco_flagsÚco_argcountÚco_varnamesÚco_posonlyargcountÚco_kwonlyargcountrn   )rW   rX   rY   Ú	code_mockr6  s       €r#   rH   zAsyncMockMixin.__init__˜  sü   ø€ Ø�‰ŒÔ˜$Ð) &Ð)Ð)Ð)õ *1Ô);Ô)IˆŒ�oÑ&Ø-.ˆŒÐ)Ñ*Ø,0ˆŒÐ(Ñ)Ý1:±´ˆŒÐ-Ñ.Ý#­XÐ6Ñ6Ô6ˆ	åÔ ÝÔ ñ!åÔ$ñ%ð 	Ôð
 !"ˆ	ÔØ 2ˆ	ÔØ'(ˆ	Ô$Ø&'ˆ	Ô#Ø$-ˆŒ�jÑ!Ø$/ˆŒ�jÑ!Ý(-©¬ˆŒ�nÑ%Ø*,ˆŒÐ&Ñ'Ø+/ˆŒÐ'Ñ(Ð(Ð(r"   c             �   ó`  K  — t          ||fd¬¦  «        }| xj        dz  c_        || _        | j                             |¦  «         | j        }|�‰t          |¦  «        r|‚t          |¦  «        s8	 t          |¦  «        }n# t          $ r t          ‚w xY wt          |¦  «        r|‚n&t          |¦  «        r ||i |¤Žƒ d {V —†}n ||i |¤Ž}|t          ur|S | j        t          ur| j        S | j        �4t          | j        ¦  «        r | j        |i |¤Žƒ d {V —†S  | j        |i |¤ŽS | j        S )NTr¬  rà   )r®  r®   r¯   r°   r,  r�   rA   rk   rõ   ÚStopIterationÚStopAsyncIterationr   r   rÑ   r—   r  )rW   rX   rY   r›  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   Á1B ÂBc                 óT   — | j         dk    rd| j        pd› d�}t          |¦  «        ‚dS )zA
        Assert that the mock was awaited at least once.
        r   ú	Expected rD   z to have been awaited.N©r®   rÌ   r£  r¤  s     r#   r¤   zAsyncMockMixin.assert_awaitedÜ  s?   € ð Ô˜qÒ Ð ØO˜dœoÐ7°ÐOÐOÐOˆCÝ  Ñ%Ô%Ð%ð !Ð r"   c                 ód   — | j         dk    s$d| j        pd› d| j         › d�}t          |¦  «        ‚dS )z@
        Assert that the mock was awaited exactly once.
        rà   r  rD   ú$ to have been awaited once. Awaited r   Nr  r¤  s     r#   r¥   z"AsyncMockMixin.assert_awaited_onceä  sW   € ð Ô 1Ò$Ð$ð9˜tœÐ8°&ð 9ð 9Ø#Ô/ð9ð 9ð 9ˆCå  Ñ%Ô%Ð%ð %Ð$r"   c                óh  ‡ ‡‡— ‰ j         €)‰                      ‰‰¦  «        }t          d|› d�¦  «        ‚ˆˆˆ fd„}‰                      t	          ‰‰fd¬¦  «        ¦  «        }‰                      ‰ j         ¦  «        }||k    r1t          |t          ¦  «        r|nd}t           |¦   «         ¦  «        |‚dS )zN
        Assert that the last await was with the specified arguments.
        NzExpected 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¯  )rW   rX   rY   r°  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                óz   — | j         dk    s$d| j        pd› d| j         › d�}t          |¦  «        ‚ | j        |i |¤ŽS )zi
        Assert that the mock was awaited exactly once and with the specified
        arguments.
        rà   r  rD   r	  r   )r®   rÌ   r£  r¦   rµ  s       r#   r§   z'AsyncMockMixin.assert_awaited_once_withÿ  sg   € ð
 Ô 1Ò$Ð$ð9˜tœÐ8°&ð 9ð 9Ø#Ô/ð9ð 9ð 9ˆCå  Ñ%Ô%Ð%Ø'ˆtÔ'¨Ð8°Ð8Ð8Ð8r"   c                ó$  ‡ — ‰                       t          ||fd¬¦  «        ¦  «        }t          |t          ¦  «        r|nd}ˆ fd„‰ j        D ¦   «         }|s|t          |¦  «        vr)‰                      ||¦  «        }t          d|z  ¦  «        |‚dS )zU
        Assert the mock has ever been awaited with the specified arguments.
        Tr¬  Nc                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r!   r¸  r¹  s     €r#   rr  z3AsyncMockMixin.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¨   zAsyncMockMixin.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                 ó*  ‡ — ˆ fd„|D ¦   «         }t          d„ |D ¦   «         d¦  «        }t          ˆ fd„‰ j        D ¦   «         ¦  «        }|sT||vrN|€d}nd                     d„ |D ¦   «         ¦  «        }t	          |› dt          |¦  «        › d	‰ j        › �¦  «        |‚dS t          |¦  «        }g }|D ]=}	 |                     |¦  «         Œ# t          $ r |                     |¦  «         Y Œ:w xY w|r t	          t          |¦  «        ›d
�¦  «        |‚dS )a´  
        Assert the mock has been awaited with the specified calls.
        The :attr:`await_args_list` list is checked for the awaits.

        If `any_order` is False (the default) then the awaits must be
        sequential. There can be extra calls before or after the
        specified awaits.

        If `any_order` is True then the awaits can be in any order, but
        they must all appear in :attr:`await_args_list`.
        c                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r!   r¸  r¹  s     €r#   rr  z4AsyncMockMixin.assert_has_awaits.<locals>.<listcomp>#	  r»  r"   c              3   óD   K  — | ]}t          |t          ¦  «        ¯|V — Œd S r<   r½  rt  s     r#   r¾  z3AsyncMockMixin.assert_has_awaits.<locals>.<genexpr>$	  r¿  r"   Nc              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S r<   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"   zAwaits not found.z,Error processing expected awaits.
Errors: {}c                 ó@   — g | ]}t          |t          ¦  «        r|nd ‘ŒS r<   r½  rt  s     r#   rr  z4AsyncMockMixin.assert_has_awaits.<locals>.<listcomp>-	  rÂ  r"   rÃ  z	
Actual: z not all found in await list)
rõ   r“   r°   rÅ  r£  rm   rÇ  rN   r,  rn   )	rW   rÈ  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   Â6CÃC.Ã-C.c                 ód   — | j         dk    r$d| j        pd› d| j         › d�}t          |¦  «        ‚dS )z9
        Assert that the mock was never awaited.
        r   r  rD   z# to not have been awaited. Awaited r   Nr  r¤  s     r#   rª   z!AsyncMockMixin.assert_not_awaitedC	  sW   € ð Ô˜qÒ Ð ð9˜tœÐ8°&ð 9ð 9Ø#Ô/ð9ð 9ð 9ˆCå  Ñ%Ô%Ð%ð !Ð r"   c                ó|   •—  t          ¦   «         j        |i |¤Ž d| _        d| _        t	          ¦   «         | _        dS )z0
        See :func:`.Mock.reset_mock()`
        r   N)rø  r–   r®   r¯   r“   r°   )rW   rX   rY   r6  s      €r#   r–   zAsyncMockMixin.reset_mockL	  sB   ø€ ð 	�‰ŒÔ˜DÐ+ FÐ+Ð+Ð+ØˆÔØˆŒÝ(™{œ{ˆÔÐÐr"   rÛ  )r   r   r   rÝ   r®   r¯   r°   rH   rï  r¤   r¥   r¦   r§   r¨   r©   rª   r–   Ú__classcell__)r6  s   @r#   rÿ   rÿ   “  s  ø€ € € € € Ø&Ð& }Ñ5Ô5€KØ%Ð% lÑ3Ô3€JØ*Ð*Ð+<Ñ=Ô=€Oð0ð 0ð 0ð 0ð 0ð8&!ð &!ð &!ðP&ð &ð &ð&ð &ð &ð>ð >ð >ð$	9ð 	9ð 	9ðð ð ð*ð *ð *ð *ðX&ð &ð &ð+ð +ð +ð +ð +ð +ð +ð +ð +r"   rÿ   c                   ó   — e Zd ZdZdS )r
   aY  
    Enhance :class:`Mock` with features allowing to mock
    an async function.

    The :class:`AsyncMock` object will behave so the object is
    recognized as an async function, and the result of a call is an awaitable:

    >>> mock = AsyncMock()
    >>> iscoroutinefunction(mock)
    True
    >>> inspect.isawaitable(mock())
    True


    The result of ``mock()`` is an async function which will have the outcome
    of ``side_effect`` or ``return_value``:

    - if ``side_effect`` is a function, the async function will return the
      result of that function,
    - if ``side_effect`` is an exception, the async function will raise the
      exception,
    - if ``side_effect`` is an iterable, the async function will return the
      next value of the iterable, however, if the sequence of result is
      exhausted, ``StopIteration`` is raised immediately,
    - if ``side_effect`` is not defined, the async function will return the
      value defined by ``return_value``, hence, by default, the async function
      returns a new :class:`AsyncMock` object.

    If the outcome of ``side_effect`` or ``return_value`` is an async function,
    the mock async function obtained when the mock object is called will be this
    async function itself (and not an async function returning an async
    function).

    The test author can also specify a wrapped object with ``wraps``. In this
    case, the :class:`Mock` object behavior is the same as with an
    :class:`.Mock` object: the wrapped object may have methods
    defined as async function functions.

    Based on Martin Richard's asynctest project.
    Nr   r!   r"   r#   r
   r
   V	  s   € € € € € ð'ð 'ð 'ð 'r"   r
   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )Ú_ANYz2A helper object that compares equal to everything.c                 ó   — dS r¸  r!   ©rW   r»  s     r#   r¹  z_ANY.__eq__„	  s   € Øˆtr"   c                 ó   — dS rÀ  r!   r  s     r#   rÁ  z_ANY.__ne__‡	  s   € Øˆur"   c                 ó   — dS )Nz<ANY>r!   r¾   s    r#   r¿   z_ANY.__repr__Š	  s   € Øˆwr"   N)r   r   r   r    r¹  rÁ  r¿   r!   r"   r#   r  r  �	  sG   € € € € € Ø8Ð8ðð ð ðð ð ðð ð ð ð r"   r  c                 óÞ   — d| z  }d}d                      d„ |D ¦   «         ¦  «        }d                      d„ |                     ¦   «         D ¦   «         ¦  «        }|r|}|r|r|dz  }||z  }||z  S )Nz%s(%%s)r  z, c                 ó,   — g | ]}t          |¦  «        ‘ŒS r!   )Úrepr)r)   rR  s     r#   rr  z*_format_call_signature.<locals>.<listcomp>”	  s   € Ð7Ð7Ð7¨3�T #™YœYÐ7Ð7Ð7r"   c                 ó"   — g | ]\  }}|›d |›�‘ŒS )Ú=r!   )r)   rM  rØ   s      r#   rr  z*_format_call_signature.<locals>.<listcomp>•	  s4   € ð ð ð Ù#- 3¨�3�3�3˜˜Ððð ð r"   )rd  rO  )r*   rX   rY   r�  Ú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                   óŽ   — e Zd ZdZ	 	 dd„Z	 	 dd„Zd	„ Zej        Zd
„ Z	d„ Z
d„ Zd„ Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ ZdS )r®  a£  
    A tuple for holding the results of a call to a mock, either in the form
    `(args, kwargs)` or `(name, args, kwargs)`.

    If args or kwargs are empty then a call tuple will compare equal to
    a tuple without those values. This makes comparisons less verbose::

        _Call(('name', (), {})) == ('name',)
        _Call(('name', (1,), {})) == ('name', (1,))
        _Call(((), {'a': 'b'})) == ({'a': 'b'},)

    The `_Call` object provides a useful shortcut for comparing with call::

        _Call(((1, 2), {'a': 3})) == call(1, 2, a=3)
        _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3)

    If the _Call has no name then it will match any name.
    r!   r  NFTc                 ó¸  — d}i }t          |¦  «        }|dk    r|\  }}}n~|dk    r<|\  }	}
t          |	t          ¦  «        r|	}t          |
t          ¦  «        r|
}nD|
}nA|	|
}}n<|dk    r6|\  }t          |t          ¦  «        r|}nt          |t          ¦  «        r|}n|}|rt                               | ||f¦  «        S t                               | |||f¦  «        S )Nr!   é   r´   rà   )râ   r/   rZ  rn   r  )r  rØ   r*   rì   r­  Ú	from_kallrX   rY   Ú_lenÚfirstÚseconds              r#   r  z_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   — || _         || _        || _        d S r<   )rÌ   rÍ   Ú_mock_from_kall)rW   rØ   r*   rì   r­  r+  s         r#   rH   z_Call.__init__Ö	  s   € àˆŒØ"ˆÔØ(ˆÔÐÐr"   c                 ór  — 	 t          |¦  «        }n# t          $ r
 t          cY S w xY wd}t          | ¦  «        dk    r| \  }}n| \  }}}t          | dd ¦  «        r#t          |dd ¦  «        r| j        |j        k    rdS d}|dk    rdi }}nš|dk    r|\  }}}n�|dk    r?|\  }	t          |	t          ¦  «        r|	}i }nit          |	t          ¦  «        r|	}di }}nMd}|	}nH|dk    r@|\  }
}t          |
t          ¦  «        r!|
}t          |t          ¦  «        r|i }}nd|}}n|
|}}ndS |r||k    rdS ||f||fk    S )	Nr  r´   rÍ   Fr   r!   r*  rà   )râ   r™  rº  r1   rÍ   r/   rn   rZ  )rW   r»  Ú	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         €t          d||fd¬¦  «        S | j         dz   }t          | j         ||f|| ¬¦  «        S )Nr  r/  r¶   rí  ©rÌ   r®  r‹  s       r#   rK   z_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+  rI  )r*   rì   r+  r:  )rW   r¢   r*   s      r#   rÊ   z_Call.__getattr__
  sD   € ØŒ?Ð"Ý˜d¨eÐ4Ñ4Ô4Ð4Øœ/˜/˜/¨4¨4Ð0ˆÝ˜$ t°uÐ=Ñ=Ô=Ð=r"   c                 ób   — |t           j        v rt          ‚t                                | |¦  «        S r<   )rn   rr   rL   Ú__getattribute__)rW   r¢   s     r#   r=  z_Call.__getattribute__$
  s+   € Ø•5”>Ð!Ð!Ý Ð Ý×%Ò% d¨DÑ1Ô1Ð1r"   c                 óH   — t          | ¦  «        dk    r| \  }}n| \  }}}||fS )Nr´   )râ   r‹  s       r#   Ú_get_call_argumentsz_Call._get_call_arguments*
  s2   € Ýˆt‰9Œ9˜Š>ˆ>Ø‰LˆD�&�&à!%ÑˆD�$˜à�Vˆ|Ðr"   c                 ó6   — |                       ¦   «         d         S ©Nr   ©r?  r¾   s    r#   rX   z
_Call.args2
  ó   € à×'Ò'Ñ)Ô)¨!Ô,Ð,r"   c                 ó6   — |                       ¦   «         d         S )Nrà   rB  r¾   s    r#   rY   z_Call.kwargs6
  rC  r"   c                 ó  — | j         s%| j        pd}|                     d¦  «        rd|z  }|S t          | ¦  «        dk    rd}| \  }}n+| \  }}}|sd}n |                     d¦  «        sd|z  }nd|z  }t	          |||¦  «        S )Nr   r/  zcall%sr´   zcall.%s)r0  rÌ   r(   râ   rŠ  )rW   r*   rX   rY   s       r#   r¿   z_Call.__repr__:
  s°   € ØÔ#ð 	Ø”?Ð, fˆDØ�Š˜tÑ$Ô$ð 'Ø $‘�ØˆKåˆt‰9Œ9˜Š>ˆ>ØˆDØ‰LˆD�&�&à!%ÑˆD�$˜Øð 'Ø��Ø—_’_ TÑ*Ô*ð 'Ø  4Ñ'��à $‘�Ý% d¨D°&Ñ9Ô9Ð9r"   c                 ó�   — g }| }|�%|j         r|                     |¦  «         |j        }|­%t          t	          |¦  «        ¦  «        S )z•For a call object that represents multiple calls, `call_list`
        returns a list of all the intermediate calls as well as the
        final call.)r0  r,  rÍ   r“   rc  )rW   ÚvalsÚthings      r#   Ú	call_listz_Call.call_listO
  sW   € ð ˆØˆØÐØÔ$ð #Ø—’˜EÑ"Ô"Ð"ØÔ&ˆEð Ðõ � $™œÑ(Ô(Ð(r"   )r!   r  NFT)r!   NNFT)r   r   r   r    r  rH   r¹  rw  rÁ  rK   rÊ   r=  r?  rÜ   rX   rY   r¿   rI  r!   r"   r#   r®  r®  £	  s  € € € € € ðð ð$ :?Øð8ð 8ð 8ð 8ð@ >CØð)ð )ð )ð )ð2Fð 2Fð 2Fðj Œ]€FðNð Nð Nð>ð >ð >ð2ð 2ð 2ðð ð ð ð-ð -ñ „Xð-ð ð-ð -ñ „Xð-ð:ð :ð :ð*
)ð 
)ð 
)ð 
)ð 
)r"   r®  )r+  c          	      ó$  — t          | ¦  «        rt          | ¦  «        } t          | t          ¦  «        }t          | ¦  «        rt	          d| ›d�¦  «        ‚t          | ¦  «        }d| i}	|rd| i}	n| €i }	|	r|rd|	d<   |st          |¦  «         |	                     |¦  «         t          }
t          j
        | ¦  «        ri }	nL|r|rt          d¦  «        ‚t          }
n1t          | ¦  «        st          }
n|r|rt          | ¦  «        st          }
|	                     d	|¦  «        }|}|€d
} |
d||||dœ|	¤Ž}t          | t"          ¦  «        r"t%          || ¦  «        }|rt'          |¦  «         nt)          | |||¦  «         |�|s
||j        |<   |                     d¦  «        }|r |sd|vrt/          | |dd||¬¦  «        |_        t3          | ¦  «        D �];}t5          |¦  «        rŒ	 t7          | |¦  «        }n# t8          $ r Y Œ1w xY wd|i}|r&t;          ||¦  «        r|                     |¬¦  «         |rd|i}t          |t"          ¦  «        st=          |||||¦  «        }||j        |<   n{|}t          | t"          ¦  «        r|j        }tA          | ||¦  «        }||d<   tC          |¦  «        rt          }nt          } |d||||dœ|¤Ž}||j        |<   t)          |||¬¦  «         t          |t"          ¦  «        rtE          |||¦  «         �Œ=|S )a  Create a mock object using another object as a spec. Attributes on the
    mock will use the corresponding attribute on the `spec` object as their
    spec.

    Functions or methods being mocked will have their arguments checked
    to check that they are called with the correct signature.

    If `spec_set` is True then attempting to set attributes that don't exist
    on the spec object will raise an `AttributeError`.

    If a class is used as a spec then the return value of the mock (the
    instance of the class) will have the same spec. You can use a class as the
    spec for an instance object by passing `instance=True`. The returned mock
    will only be callable if instances of the mock are callable.

    `create_autospec` will raise a `RuntimeError` if passed some common
    misspellings of the arguments autospec and spec_set. Pass the argument
    `unsafe` with the value True to disable that check.

    `create_autospec` also takes arbitrary keyword arguments that are passed to
    the constructor of the created mock.z'Cannot autospec a Mock object. [object=r%  rþ   rý   NTr  zJInstance can not be True when create_autospec is mocking an async functionr*   r  )rì   r  r  r*   r   r—   r/  )ra   r8  rî   r   rp  r  )rì   r*   r  r  )r`   r!   )#ro   r>   r/   r.   r   r:   r  r   r   r2   Úisdatadescriptorrý  r
   rk   r   ru   rQ  rE   r€   r±   rb   rž   rs   r	   r—   r+  r·   r1   rL   r0   rC  rD   Ú
_must_skipr   rg   )rþ   rý   ra   rî   r8  r  rY   Úis_typeÚis_async_funcrB  rA  r  rD   ÚwrappedrK  r|   r
  rì   r`   Úchild_klasss                       r#   r	   r	   _
  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Ñ%à�jŠj˜Ñ!Ô!€Gàð ;�xð ; N¸&Ð$@Ð$@Ý+¨D°(ÀTØ26ÀØ29ð;ñ ;ô ;ˆÔõ �T‘”ð 3&ñ 3&ˆÝ�UÑÔð 	àð	Ý˜t UÑ+Ô+ˆHˆHøÝð 	ð 	ð 	ØˆHð	øøøð ˜(Ð#ˆàð 	*•w˜w¨Ñ.Ô.ð 	*Ø�MŠM ˆMÑ)Ô)Ð)Øð 	,Ø  (Ð+ˆ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   Ç'G8Ç8
HÈHc                 óD  — t          | t          ¦  «        s|t          | di ¦  «        v rdS | j        } | j        D ]f}|j                             |t          ¦  «        }|t          u rŒ,t          |t          t          f¦  «        r dS t          |t          ¦  «        r|c S  dS |S )z[
    Return whether we should skip the first argument on spec's `entry`
    attribute.
    rr   F)r/   r>   r1   r6  rq   rr   rs   r   rJ   rI   rE   )rþ   rK  rM  r×  r}   s        r#   rL  rL  ñ
  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                   ó   — e Zd Z	 	 dd„ZdS )rC  FNc                 óZ   — || _         || _        || _        || _        || _        || _        d S r<   )rþ   Úidsrý   rì   ra   r*   )rW   rþ   rý   rì   r*   rT  ra   s          r#   rH   z_SpecState.__init__  s0   € àˆŒ	ØˆŒØ ˆŒØˆŒØ ˆŒØˆŒ	ˆ	ˆ	r"   )FNNNFrè  r!   r"   r#   rC  rC    s.   € € € € € à48Ø/4ðð ð ð ð ð r"   rC  c                 ó|   — t          | t          ¦  «        rt          j        | ¦  «        S t          j        | ¦  «        S r<   )r/   ÚbytesÚioÚBytesIOÚStringIO)Ú	read_datas    r#   Ú
_to_streamr[  %  s4   € Ý�)�UÑ#Ô#ð &ÝŒz˜)Ñ$Ô$Ð$åŒ{˜9Ñ%Ô%Ð%r"   r  c           	      óV  ‡‡‡	‡
‡— t          ‰¦  «        }|dgŠ
ˆ
ˆfd„}ˆ
ˆfd„}ˆˆ
fd„Š	ˆ
ˆfd„Šˆ
ˆfd„}t          €dddl}t          t	          t          |j        ¦  «        ¦  «                             t	          t          |j        ¦  «        ¦  «        ¦  «        ¦  «        at          €2ddl}t          t	          t          |j
        ¦  «        ¦  «        ¦  «        a	| €t          dt          ¬	¦  «        } t          t          ¬
¦  «        Š‰‰j        _        d‰j        _        d‰j        _        d‰j        _        d‰j        _        |‰j        _         ‰	¦   «         ‰
d<   ‰
d         ‰j        _        |‰j        _        ‰‰j        _        |‰j        _        ˆ	ˆ
ˆˆfd„}|| _        ‰| _        | S )a÷  
    A helper function to create a mock to replace the use of `open`. It works
    for `open` called directly or used as a context manager.

    The `mock` argument is the mock object to configure. If `None` (the
    default) then a `MagicMock` will be created for you, with the API limited
    to methods or attributes available on standard file handles.

    `read_data` is a string for the `read`, `readline` and `readlines` of the
    file handle to return.  This is an empty string by default.
    Nc                  óZ   •— ‰j         j        �‰j         j        S  ‰d         j         | i |¤ŽS rA  )Ú	readlinesr—   ©rX   rY   Ú_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   •— ‰j         j        �‰j         j        S  ‰d         j         | i |¤ŽS rA  )Úreadr—   r_  s     €€r#   Ú_read_side_effectz$mock_open.<locals>._read_side_effect@  s4   ø€ ØŒ;Ô#Ð/Ø”;Ô+Ð+Øˆv�aŒyŒ~˜tÐ. vÐ.Ð.Ð.r"   c               ?   óV   •K  —  ‰¦   «         E d {V —† 	  ‰d         j         | i |¤ŽV — Œ©NTr   )Úreadline)rX   rY   Ú_iter_side_effectr`  s     €€r#   Ú_readline_side_effectz(mock_open.<locals>._readline_side_effectE  sT   øè è € Ø$Ð$Ñ&Ô&Ð&Ð&Ð&Ð&Ð&Ð&Ð&ð	6Ø$�&˜”)Ô$ dÐ5¨fÐ5Ð5Ð5Ð5Ð5ð	6r"   c               3   ób   •K  — ‰j         j        �	 ‰j         j        V — Œ‰d         D ]} | V — Œd S rg  )rh  r—   )Úliner`  ra  s    €€r#   ri  z$mock_open.<locals>._iter_side_effectJ  sU   øè è € ØŒ?Ô'Ð3ð3Ø”oÔ2Ð2Ð2Ð2ð3à˜1”Ið 	ð 	ˆDØˆJˆJˆJˆJð	ð 	r"   c                  ó^   •— ‰j         j        �‰j         j        S t          ‰ d         ¦  «        S rA  )rh  r—   rõ   )r`  ra  s   €€r#   Ú_next_side_effectz$mock_open.<locals>._next_side_effectQ  s)   ø€ ØŒ?Ô'Ð3Ø”?Ô/Ð/Ý�F˜1”I‰ŒÐr"   r   Úopen)r*   rþ   )rþ   rà   c                  ó    •— t          ‰¦  «        ‰d<   ‰j        j        ‰d         k    r ‰¦   «         ‰d<   ‰d         ‰j        _        t          S )Nr   rà   )r[  rh  r�   r   )rX   rY   rj  r`  ra  rZ  s     €€€€r#   Ú
reset_datazmock_open.<locals>.reset_dataq  sM   ø€ Ý˜yÑ)Ô)ˆˆq‰	ØŒ?Ô&¨&°¬)Ò3Ð3à-Ð-Ñ/Ô/ˆF�1‰IØ*0°¬)ˆFŒOÔ'Ýˆr"   )r[  Ú	file_specÚ_iorm   ry  r+  ÚTextIOWrapperÚunionrX  Ú	open_specro  r   rF  r—   Úwriterd  rh  r^  r�   rÅ  rö   )rD   rZ  Ú
_read_datarb  re  rn  rs  rq  ri  rj  r`  ra  s    `      @@@@r#   r   r   ,  s  øøøøø€ õ ˜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                   ó&   — e Zd ZdZd„ Zdd„Zd„ ZdS )r   aW  
    A mock intended to be used as a property, or other descriptor, on a class.
    `PropertyMock` provides `__get__` and `__set__` methods so you can specify
    a return value when it is fetched.

    Fetching a `PropertyMock` instance from an object calls the mock, with
    no args. Setting it calls the mock with the value being set.
    c                ó   — t          di |¤ŽS )Nr!   )r   )rW   rY   s     r#   r1  zPropertyMock._get_child_mock‡  s   € ÝÐ"Ð"˜6Ð"Ð"Ð"r"   Nc                 ó   —  | ¦   «         S r<   r!   )rW   r5   Úobj_types      r#   r‰  zPropertyMock.__get__Š  s   € Øˆt‰vŒvˆr"   c                 ó   —  | |¦  «         d S r<   r!   )rW   r5   rS  s      r#   rŠ  zPropertyMock.__set__Œ  s   € ØˆˆS‰	Œ	ˆ	ˆ	ˆ	r"   r<   )r   r   r   r    r1  r‰  rŠ  r!   r"   r#   r   r   ~  sP   € € € € € ðð ð#ð #ð #ðð ð ð ðð ð ð ð r"   r   c                 ó4  — d| _         t          | ¦  «        D ]€}	 t          | |¦  «        }n# t          $ r Y Œ w xY wt	          |t
          ¦  «        sŒ:t	          |j                             |¦  «        t          ¦  «        rŒh|j	        | u rt          |¦  «         Œ�dS )a˜  Disable the automatic generation of child mocks.

    Given an input Mock, seals it to ensure no further mocks will be generated
    when accessing an attribute that was not already defined.

    The operation recursively seals the mock passed in, meaning that
    the mock itself, any mocks generated by accessing one of its attributes,
    and all assigned mocks without a name or spec will be sealed.
    TN)r  r+  r1   rL   r/   r   rž   rs   rC  rÏ   r   )rD   r¢   rï  s      r#   r   r   �  s¶   € ð €DÔÝ�D‘	”	ð 
ð 
ˆð	Ý˜˜dÑ#Ô#ˆAˆAøÝð 	ð 	ð 	ØˆHð	øøøå˜!�_Ñ-Ô-ð 	ØÝ�aÔ&×*Ò*¨4Ñ0Ô0µ*Ñ=Ô=ð 	ØØÔ Ð%Ð%Ý�‰GŒGˆGøð
ð 
s   š+«
8·8c                   ó   — e Zd ZdZd„ Zd„ ZdS )rÊ  z8
    Wraps an iterator in an asynchronous iterator.
    c                 ót   — || _         t          t          ¬¦  «        }t          j        |_        || j        d<   d S )Nr÷  r8   )Úiteratorr   r   r2   ÚCO_ITERABLE_COROUTINErü  rr   )rW   r�  r  s      r#   rH   z_AsyncIterator.__init__¬  s6   € Ø ˆŒÝ#­XÐ6Ñ6Ô6ˆ	Ý$Ô:ˆ	ÔØ$-ˆŒ�jÑ!Ð!Ð!r"   c              ƒ   ó^   K  — 	 t          | j        ¦  «        S # t          $ r Y nw xY wt          ‚r<   )rõ   r�  r  r  r¾   s    r#   rœ  z_AsyncIterator.__anext__²  sA   è è € ð	Ý˜œÑ&Ô&Ð&øÝð 	ð 	ð 	ØˆDð	øøøå Ð s   „ ˜
%¤%N)r   r   r   r    rH   rœ  r!   r"   r#   rÊ  rÊ  ¨  s<   € € € € € ðð ð.ð .ð .ð!ð !ð !ð !ð !r"   rÊ  rÛ  )NFNNN)FFNN)Nr  )‚Ú__all__r«   r  rW  r2   ré   r>  ÚbuiltinsrT  r   Útypesr   r   r   Úunittest.utilr   Ú	functoolsr   r   Ú	threadingr   r¯  r   r+  r3  r   rø  r  r6   r:   r.   rA   rF   rR   rb   r]   rk   ro   ru   r€   r{   r±   r·   rw  r¹   rÄ   r   r   ÚMISSINGr‡  ÚDELETEDrD  rÚ   rÝ   rm   r“   rï   rñ   rø   r   rM   rH   r   rÐ  r=  rÕ  r   r  r  rV  r[  r_  r   rb  rz  r‚  re  ÚmultipleÚstopallr  Úmagic_methodsÚnumericsrd  rP  Ú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æ  r   rÜ  rÿ   r
   r  r   rŠ  rn   r®  r   r	   rL  rC  r>   r¹  rE   rr  rv  r[  r   r   r   rÊ  r!   r"   r#   ú<module>r•     s5
  ðð€ð& €€€Ø Ð Ð Ð Ø 	€	€	€	Ø €€€Ø €€€Ø 
€
€
€
Ø €€€Ø €€€Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 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ðð ð ðð ð ð ð  ð  ðF	#ð 	#ð 	#ð 	#ð
ð 
ð 
ðð ð ð&ð &ð &ðð ð ðð ð ð ð6."ð ."ð ."ðb>ð >ð >ð6)ð )ð )ð	)ð 	)ð 	)ð 	)ð 	)�fñ 	)ô 	)ð 	)ðð ð ð ð �ñ ô ð ð ˆ9‰;Œ;€à
Ô
€ØÔ€ØÔ€ðð ð €ð ð  ð  ð&*ð *ð *ð *ð *�ñ *ô *ð *ð(ð ð ð6ð ð ð ð �ñ ô ð ðð ð ð ð ˆ6ñ ô ð ðN
<ð N
<ð N
<ð N
<ð N
<�dñ N
<ô N
<ð N
<ðb ˆGÔ˜oÔ6Ñ7Ô7€	ðð ð ð ð �4ñ ô ð ð ð ð ðg!ð g!ð g!ð g!ð g!�Dñ g!ô g!ð g!ðV6ð 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ðdV/ð 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ÐÑÔ€ð CGØðOØ*/ðOð Oð Oð Oð Oðdð ð ð8	ð 	ð 	ð 	ð 	�ñ 	ô 	ð 	ð 	€DˆÑÔà€DˆŒÑÔð	€ð €	Ø€	ð&ð &ð &ðOð Oð Oð Oðdð ð ð ð �4ñ ô ð ð$ð ð ð0!ð !ð !ð !ð !ñ !ô !ð !ð !ð !r"   