%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/monkey.cpython-312.pyc

�

Ϫ�f����Gd�d�Zy)c�@�eZdZdZd�Zd�Zd�Zd�ZeZd�Z	d
d�Z
d	�Zy)�
MonkeyPatcherzn
    Cover up attributes with new objects. Neat for monkey-patching things for
    unit-testing purposes.
    c�L�g|_g|_|D]}|j|��y�N)�_patchesToApply�
_originals�addPatch)�self�patches�patchs   �7/usr/lib/python3/dist-packages/twisted/python/monkey.py�__init__zMonkeyPatcher.__init__
s0��!�������	"�E��D�M�M�5�!�	"�c�@�|jj|||f�y)z�
        Add a patch so that the attribute C{name} on C{obj} will be assigned to
        C{value} when C{patch} is called or during C{runWithPatches}.

        You can restore the original values with a call to restore().
        N)r�append�r	�obj�name�values    rrzMonkeyPatcher.addPatchs��	
���#�#�S�$��$6�7rc�D�|jD]\}}}||f||fk(s�yy)zc
        Has the C{name} attribute of C{obj} already been patched by this
        patcher?
        TF)r)r	rr�o�n�vs      r�_alreadyPatchedzMonkeyPatcher._alreadyPatcheds5��
���	�G�A�q�!��1�v�#�t��$��	�rc	��|jD]M\}}}|j||�s(|jj||t	||�f�t|||��Oy)z�
        Apply all of the patches that have been specified with L{addPatch}.
        Reverse this operation using L{restore}.
        N)rrrr�getattr�setattrrs    rrzMonkeyPatcher.patch)s\��
!%� 4� 4�	&��C��u��'�'��T�2����&�&��T�7�3��3E�'F�G��C��u�%�	&rc��|jr9|jj�\}}}t|||�|jr�8yy)zE
        Restore all original values to any patched objects.
        N)r�poprrs    r�restorezMonkeyPatcher.restore5s9���o�o�#���2�2�4��C��u��C��u�%��o�orNc�$�|j�yr)r)r	�excType�excValue�excTracebacks    r�__exit__zMonkeyPatcher.__exit__=s�����rc�~�|j�	||i|��|j�S#|j�wxYw)z�
        Apply each patch already specified. Then run the function f with the
        given args and kwargs. Restore everything when done.
        )rr)r	�f�args�kws    r�runWithPatcheszMonkeyPatcher.runWithPatches@s0��
	
�
�
��	��d�>�b�>��L�L�N��D�L�L�N�s�*�<)NNN)�__name__�
__module__�__qualname__�__doc__r
rrr�	__enter__rr$r)�rrrrs1���
"�8��&��I�&��	rrN)rr/rr�<module>r0s��B�Br

Zerion Mini Shell 1.0