
    Vh                     X    d Z ddgZddlZddlZddlmZ  G d de      Z G d de      Zy)z/
Testing helpers related to the module system.
	NoReactorAlternateReactor    N)SetAsideModulec                   "    e Zd ZdZd Zd Zd Zy)r   zc
    Context manager that uninstalls the reactor, if any, and then restores it
    afterwards.
    c                 0    t        j                  | d       y Nztwisted.internet.reactor)r   __init__selfs    S/home/dcms/DCMS/lib/python3.12/site-packages/twisted/internet/test/modulehelpers.pyr	   zNoReactor.__init__   s    &@A    c                 l    t        j                  |        d| j                  v rt        j                  `y y r   )r   	__enter__modulestwistedinternetreactorr
   s    r   r   zNoReactor.__enter__   s-      &%5  ( 6r   c                     t        j                  | |||       | j                  j                  dd       }||t        j
                  _        y 	 t        j
                  `y # t        $ r Y y w xY wr   )r   __exit__r   getr   r   r   AttributeError)r   excTypeexcValue	tracebackr   s        r   r   zNoReactor.__exit__   sf    gxC ,,""#=tD'.G$$$,! s   A 	A+*A+N)__name__
__module____qualname____doc__r	   r   r    r   r   r   r      s    
B)
r   c                       e Zd ZdZd Zd Zy)r   zd
    A context manager which temporarily installs a different object as the
    global reactor.
    c                 <    t         j                  |        || _        y)zN
        @param reactor: Any object to install as the global reactor.
        N)r   r	   	alternate)r   r   s     r   r	   zAlternateReactor.__init__3   s     	4  r   c                     t         j                  |        | j                  t        j                  _        | j                  t        j                  d<   y r   )r   r   r"   r   r   r   sysr   r
   s    r   r   zAlternateReactor.__enter__:   s5    D!#'>> 26.../r   N)r   r   r   r   r	   r   r   r   r   r   r   -   s    
!Ar   )	r   __all__r$   twisted.internetr   twisted.test.test_twistedr   r   r   r   r   r   <module>r(      s:   
 *
+ 
  4 8Ay Ar   