+
    Dfj                          ! R  R4      t R# )c                   V   a  ] tR t^t o RtR tR tR tR t]t	R t
RR ltR	 tR
tV tR# )MonkeyPatcherzb
Cover up attributes with new objects. Neat for monkey-patching things for
unit-testing purposes.
c                T    . V n         . V n        V F  pV P                  ! V!   K  	  R # N)_patchesToApply
_originalsaddPatch)selfpatchespatchs   &* 7/usr/lib/python3/dist-packages/twisted/python/monkey.py__init__MonkeyPatcher.__init__   s)    ! EMM5!     c                @    V P                   P                  WV34       R# )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   r   MonkeyPatcher.addPatch   s     	##S$67r   c                J    V P                    F  w  r4pW43W38X  g   K   R# 	  R# )zK
Has the C{name} attribute of C{obj} already been patched by this
patcher?
TF)r   )r	   r   r   onvs   &&&   r   _alreadyPatchedMonkeyPatcher._alreadyPatched   s*    
 GA!v#$ ' r   c           	         V P                    FO  w  rpV P                  W4      '       g'   V P                  P                  W\	        W4      34       \        WV4       KQ  	  R# )zn
Apply all of the patches that have been specified with L{addPatch}.
Reverse this operation using L{restore}.
N)r   r   r   r   getattrsetattrr   s   &   r   r   MonkeyPatcher.patch)   sP    
 !% 4 4Cu''22&&733E'FGCu% !5r   c                    V P                   '       d,   V P                   P                  4       w  rp\        WV4       K=  R# )z5
Restore all original values to any patched objects.
N)r   popr   r   s   &   r   restoreMonkeyPatcher.restore5   s3     ooo#224CuCu% r   Nc                &    V P                  4        R # r   )r#   )r	   excTypeexcValueexcTracebacks   &&&&r   __exit__MonkeyPatcher.__exit__=   s    r   c                ~    V P                  4         V! V/ VB V P                  4        #   T P                  4        i ; i)z{
Apply each patch already specified. Then run the function f with the
given args and kwargs. Restore everything when done.
)r   r#   )r	   fargskws   &&*,r   runWithPatchesMonkeyPatcher.runWithPatches@   s0    
 	

	d>b>LLNDLLNs   * <)r   r   )NNN)__name__
__module____qualname____firstlineno____doc__r   r   r   r   	__enter__r#   r)   r/   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s9     
"8& I&	 	r   r   N)r    r   r   <module>r;      s   B Br   