
    	h!K                        U 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mZmZmZmZmZmZmZmZmZmZmZ ddlZddlmZmZmZmZmZm Z m!Z! ej"        dk    rddlm#Z# nddl$m#Z#  ed          Z%e#d	         Z& ed
          Z' ededee%         f                   Z( ededee%         f                   Z)ee(e)f         Z*ee*ge*f         Z+eZ,eZ- G d de.ej/                  Z0dZ1dede ddfdZ2eddddddde*dddeee3                  de4deeee.e5e6e4df                  eegee3         f         df         dee.         de*fd            Z7e	 dZdddddddddddeee3                  de4deeee.e5e6e4df                  eegee3         f         df         dee.         de+fd            Z7	 d[dee*         d edee*e+f         fd!Z7d"ede4fd#Z8d"eddfd$Z9d"ede4fd%Z:d"ede4fd&Z;d'ede0fd(Z<d'eddfd)Z= ej>        d*+          d'edee.         fd,            Z?d'ed-ee,         ddfd.Z@d/e,ddfd0ZAd/e,ddfd1ZBd2edef         d ee.ef         d3ejC        d4e-dee.ef         f
d5ZDd2e'd6ee         d7e4de'fd8ZEd/e,ddfd9ZFd/e,ddfd:ZG eH            ZIee,         eJd;<    ej>        d*+          d<eejK        ejL        f         de.d"e3deej        ejM        eeej        ejM        f                  df         fd=            ZNd>e!d'ed?ee         ddfd@ZOdAede4fdBZP ej>        d*C          d/e,d4e-dee3         fdD            ZQd/e,dEeg e3f         ddfdFZR e
dG          ZSd\dHZTd\dIZU ej>        d*d*J          dKej        dee3         fdL            ZVdAede4fdMZWdKej        d2edee         f         dNejC        fdOZXdPej        ddfdQZYej7        d4edeejC                 fdR            ZZdSe6de6fdTZ[ej7        de6fdU            Z\ej7        de6fdV            Z] ej7        d>W          deg e6f         fdX            Z^ ej7        d>W          deg e6f         fdY            Z_dS )]zpytest-asyncio implementation.    N)dedent)AnyAsyncIterator	AwaitableCallableDictIterableIteratorListOptionalSetTypeVarUnioncastoverload)ConfigFixtureRequestFunctionItemParserPytestPluginManagerSession)      )Literal_R)sessionpackagemoduleclassfunction_TSimpleFixtureFunction.)boundFactoryFixtureFunctionc                       e Zd ZdZdZdS )ModeautostrictN)__name__
__module____qualname__AUTOSTRICT     b/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/pytest_asyncio/plugin.pyr'   r'   ?   s        DFFFr0   r'   z'auto' - for automatically handling all async functions by the plugin
'strict' - for autoprocessing disabling (useful if different async frameworks should be tested together, e.g. both pytest-asyncio and pytest-trio are used in the same project)
parserpluginmanagerreturnc                     |                      d          }|                    ddd dt                     |                     ddd           d S )	Nasyncioz--asyncio-modeasyncio_modeMODE)destdefaultmetavarhelpz default value for --asyncio-moder)   )r<   r:   )getgroup	addoptionASYNCIO_MODE_HELPaddini)r2   r3   groups      r1   pytest_addoptionrB   L   sm    OOI&&E	OO     MM/      r0   )scopeparamsautouseidsnamefixture_functionrC   z6Union[_ScopeName, Callable[[str, Config], _ScopeName]]rD   rE   rF   rG   c                    d S Nr/   rH   rC   rD   rE   rF   rG   s         r1   fixturerL   \   	     Cr0   c                    d S rJ   r/   rK   s         r1   rL   rL   m   rM   r0   kwargsc                     | !t          |            t          j        | fi S t          j        t                    dt
          dt
          ffd            }|S )NrH   r4   c                     t          | fi S rJ   )rL   )rH   rO   s    r1   innerzfixture.<locals>.inner   s    +66v666r0   )_make_asyncio_fixture_functionpytestrL   	functoolswrapsFixtureFunction)rH   rO   rR   s    ` r1   rL   rL   ~   s}     #&'7888~.99&999 
	!	!	7O 	7 	7 	7 	7 	7 	7 
"	!	7 r0   objc                 F    t          | d|           } t          | dd          S )N__func___force_asyncio_fixtureFgetattrrX   s    r1   _is_asyncio_fixture_functionr_      s&    
#z3
'
'C30%888r0   c                 B    t          | d          r| j        } d| _        d S )NrZ   T)hasattrrZ   r[   r^   s    r1   rS   rS      s)    sJ l!%Cr0   c                 *    t          j        |           S )z9Check to see if an object is really an asyncio coroutine.)r6   iscoroutinefunctionr^   s    r1   _is_coroutinerd      s    &s+++r0   c                 H    t          |           pt          j        |           S rJ   )rd   inspectisasyncgenfunctionr^   s    r1   _is_coroutine_or_asyncgenrh      s     @!;C!@!@@r0   configc                    |                      d          }||                     d          }	 t          |          S # t          $ r? d                    d t          D                       }t          j        |d| d          w xY w)Nr7   z, c              3   $   K   | ]}|j         V  d S rJ   )value).0ms     r1   	<genexpr>z$_get_asyncio_mode.<locals>.<genexpr>   s$      00a!'000000r0   z+ is not a valid asyncio_mode. Valid modes: .)	getoptiongetinir'   
ValueErrorjoinrT   
UsageError)ri   valmodess      r1   _get_asyncio_moderx      s    


>
*
*C
{mmN++
Cyy 
 
 
		00400000IIIII
 
 	

s
   = A	Bc                 2    |                      dd           dS )zInject documentation.markerszQasyncio: mark the test as a coroutine, it will be run using an asyncio event loopN)addinivalue_line)ri   s    r1   pytest_configurer|      s,    
	*    r0   T)tryfirstc                 ,    t          |           }d| gS )z$Add asyncio config to pytest header.zasyncio: mode=)rx   )ri   modes     r1   pytest_report_headerr      s"     V$$D#T##$$r0   processed_fixturedefsc                    t          |           }| j                            d          }|j                                        D ]}|D ]}|j        }||v st          |          st          |          s|t          j	        k    r=t          |           t          |           t          |           t          |j                  sJ |                    |           d S )N
funcmanage)rx   r3   
get_plugin_arg2fixturedefsvaluesfuncrh   r_   r'   r.   rS   _inject_fixture_argnames_synchronize_async_fixtureadd)ri   r   r7   fixturemanagerfixtures
fixturedefr   s          r1   _preprocess_async_fixturesr      s    %V,,L)44\BBN"3::<< 2 2" 	2 	2J?D222:S; ;2 /55 ,$+:U:U *4000$Z000&z222/
@@@@@!%%j1111	22 2r0   r   c                     g }dD ] }|| j         vr|                    |           !|r| xj         t          |          z  c_         dS dS )zY
    Ensures that `request` and `event_loop` are arguments of the specified fixture.
    )request
event_loopN)argnamesappendtuple)r   to_addrG   s      r1   r   r      sk     F)    z***MM$ -uV}},- -r0   c                     t          j        | j                  rt          |            dS t          j        | j                  rt          |            dS dS )zS
    Wraps the fixture function of an async fixture in a synchronous function.
    N)rf   rg   r   _wrap_asyncgen_fixturerc   _wrap_async_fixture)r   s    r1   r   r      s`     !*/22 (z*****		$Z_	5	5 (J'''''( (r0   r   r   r   c                     t          j        |           }|                                }d|j        v r||d<   d|j        v r||d<   |S )Nr   r   )rf   	signaturecopy
parameters)r   rO   r   r   sigrets         r1   _add_kwargsr      sS     
D
!
!C
++--CCN"" Is~%%&LJr0   instanceunittestc                     |Z| d }}	 | j         t          | j                  }}n# t          $ r Y nw xY w|s|%t	          ||          r|                    |          } | S rJ   )rZ   type__self__AttributeError
isinstance__get__)r   r   r   unboundclss        r1   _perhaps_rebind_fixture_funcr      s      T	=$t}*=*=SGG 	 	 	D	
  	-Jx,E,E??8,,DKs   $ 
11c                       j         t          j                  dt          j        dt
          dt          f fd            }| _         d S )Nr   r   rO   c           
           t          |j        	j                  } |di t          || |          fd}d fd}                      |                      }|                    |           |S )Nc                  @   K                                     d {V } | S rJ   )	__anext__)resgen_objs    r1   setupzH_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup  s/      ))++++++++CJr0   r4   c                  N    dfd}                       |                        dS )zYield again, to finalize.r4   Nc                     K   	                                   d {V  d} | dz  } t          |           # t          $ r Y d S w xY w)Nz$Async generator fixture didn't stop.zYield only once.)r   rs   StopAsyncIteration)msgr   s    r1   async_finalizerze_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.finalizer.<locals>.async_finalizer$  ss      *!++--------- AC--C$S//) *   DDs   5 
AAr4   N)run_until_complete)r   r   r   s    r1   	finalizerzL_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.finalizer!  sE    * * * * * * ))//*;*;<<<<<r0   r/   r   )r   r   r   r   r   addfinalizer)
r   r   rO   r   r   r   resultr   rL   r   s
   `      @r1   _asyncgen_fixture_wrapperz9_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper  s     ,W%z':
 
 $HHT6:wGGHH	 	 	 	 		= 	= 	= 	= 	= 	= 	= ..uuww77Y'''r0   r   rU   rV   r6   AbstractEventLoop
SubRequestr   )r   r   rL   s   ` @r1   r   r     sk    oG_W-8BNQ      > 0JOOOr0   c                       j         t          j                  dt          j        dt
          dt          f fd            }| _         d S )Nr   r   rO   c                      t          j        j                   fd}                      |                      S )Nc            
      H   K    di t                     d {V } | S )Nr/   )r   )r   r   r   rO   r   s    r1   r   zB_wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setupB  sA      NN{4WMMNNNNNNNNCJr0   )r   r   r   r   )r   r   rO   r   r   rL   r   s   ``` @r1   _async_fixture_wrapperz3_wrap_async_fixture.<locals>._async_fixture_wrapper:  si     ,W%z':
 
	 	 	 	 	 	 	 	 ,,UUWW555r0   r   )r   r   rL   s   ` @r1   r   r   7  sk    oG_W6-68B6NQ6 6 6 6 6 6 6 -JOOOr0   _HOLDER	collectorc                 h    |                      |          sdS t          | j        t                     dS )z,A pytest hook to collect asyncio coroutines.N)funcnamefilterr   ri   r   )r   rG   rX   s      r1   pytest_pycollect_makeitemr   N  s7     ##D)) ty/9994r0   r   itemsc                 0   t          |          t          j        k    rdS d |D             }|D ]g}|j        }t	          |t
                    r|j        }t          |          st          |          r$t          |          r|
                    d           hdS )z
    Marks collected async test items as `asyncio` tests.

    The mark is only applied in `AUTO` mode. It is applied to:

      - coroutines
      - staticmethods wrapping coroutines
      - Hypothesis tests wrapping coroutines

    Nc              3   D   K   | ]}t          |t                    |V  d S rJ   )r   r   )rm   items     r1   ro   z0pytest_collection_modifyitems.<locals>.<genexpr>j  s1      KKt
40J0JKdKKKKKKr0   r6   )rx   r'   r-   rX   r   staticmethodrZ   rd   _is_hypothesis_test _hypothesis_test_wraps_coroutine
add_marker)r   ri   r   function_itemsfunction_itemr!   s         r1   pytest_collection_modifyitemsr   [  s       DI--KKuKKKN' 
0 
0 $h-- 	)(H(##	0"8,,	0 1::	0
 $$Y///
0 
0r0   r!   c                 4    t          | j        j                  S rJ   )rd   
hypothesis
inner_testr!   s    r1   r   r   x  s    ,7888r0   )hookwrapperc              #     K   | j         dk    rt          | t          t                     dV }|                                }t          j                    }	 t          j                    5  t          j	        dt                     |                                }ddd           n# 1 swxY w Y   ||ur|                                 n# t          $ r Y nw xY w|                    |           dS dV  dS )z<Adjust the event loop policy when an event loop is produced.r   Nignore)argname_add_finalizers_close_event_loop_provide_clean_event_loop
get_resultr6   get_event_loop_policywarningscatch_warningssimplefilterDeprecationWarningget_event_loopcloseRuntimeErrorset_event_loop)r   r   outcomelooppolicyold_loops         r1   pytest_fixture_setupr   |  sS     
 \)) 	%	
 	
 	

 %%!!##.00
	(** 3 3%h0BCCC!00223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 t##    	 	 	 D		
 	d###	EEEEEs6   C (/B#C #B''C *B'+C 
CC
finalizersc                 T    t          |          D ]}|                     |           dS )a  
    Regsiters the specified fixture finalizers in the fixture.

    Finalizers need to specified in the exact order in which they should be invoked.

    :param fixturedef: Fixture definition which finalizers should be added to
    :param finalizers: Finalizers to be added
    N)reversedr   )r   r   r   s      r1   r   r     s<     j)) + +		****+ +r0   a      pytest-asyncio detected an unclosed event loop when tearing down the event_loop
    fixture: %r
    pytest-asyncio will close the event loop for you, but future versions of the
    library will no longer do so. In order to ensure compatibility with future
    versions, please make sure that:
        1. Any custom "event_loop" fixture properly closes the loop after yielding it
        2. The scopes of your custom "event_loop" fixtures do not overlap
        3. Your code does not modify the event loop in async fixtures or tests
    c                     t          j                    } 	 |                                 }n# t          $ r d }Y nw xY w|L|                                s"t          j        t          |z  t                     |	                                 d S d S rJ   )
r6   r   r   r   	is_closedr   warn_UNCLOSED_EVENT_LOOP_WARNINGr   r   )r   r   s     r1   r   r     s    *,,F$$&&   ~~ 	M,t3"   	

 s   * 99c                  ~    t          j                    } |                                 }|                     |           d S rJ   )r6   r   new_event_loopr   )r   new_loops     r1   r   r     s=     *,,F$$&&H
(#####r0   )r}   r   
pyfuncitemc              #   P  K   |                      d          }|| j        }t          t          j        |d                   }t          | j                  r1t          | | j        j        j	        |          | j        j        _	        nt          | | j        |          | _        dV  dS )z
    Pytest hook called before a test case is run.

    Wraps marked tests in a synchronous function
    where the wrapped test coroutine is executed in an event loop.
    r6   Nr   )_loop)
get_closest_markerfuncargsr   r6   r   r   rX   wrap_in_syncr   r   )r   markerr   r   s       r1   pytest_pyfunc_callr     s       **955F&0&9G-x/EFFz~.. 	3?)44 4 4JN%00 *  JN
 
EEEEEr0   c                 $    t          | dd          S )Nis_hypothesis_testFr\   r   s    r1   r   r     s    815999r0   r   c                      t          dd          }||t          j                   fd            }|_        |S )zZReturn a sync wrapper around an async function executing it in the
    current event loop._raw_test_funcNc                      | i |}t          j        |          s-                    t          j        d d                     d S t          j        |          }	                     |           d S # t          $ r> |	                                r(|
                                s|                                  w xY w)Nz	The test z is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.)r   )rf   isawaitabler   rT   PytestWarningr6   ensure_futurer   BaseExceptiondone	cancelled	exception)argsrO   corotaskr   r   r   s       r1   rR   zwrap_in_sync.<locals>.inner  s    tT$V$$"4(( 
	OO$I
 I I I    F$T666	$$T***** 	 	 	 yy{{ !4>>#3#3 !   	s   "A9 9AC)r]   rU   rV   r  )r   r   r   raw_funcrR   s   ```  r1   r   r     sk     t-t44H_T      0  ELr0   r   c                 @   |                      d          }|d S | j        }d|v r|                    d           |                    dd           t	          | dd           }t	          |dd          s*t	          |dd          rt          j        d| z             d S d S d S )	Nr6   r   r   rX   r   Fr  zftest function `%r` is using Hypothesis, but pytest-asyncio only works with Hypothesis 3.64.0 or later.)r   fixturenamesremoveinsertr]   rT   fail)r   r   r  rX   s       r1   pytest_runtest_setupr  !  s    $$Y//F~$L|##L)))<(((
$t
$
$C3e,, 
!52 2 
 	:<@A	
 	
 	
 	
 	

 
 
 
r0   c              #      K   t          j                                                    }|V  |                                 dS )z@Create an instance of the default event loop for each test case.N)r6   r   r   r   )r   r   s     r1   r   r   4  s<       (**99;;D
JJJJJLLLLLr0   socket_typec                     t          j        t          j        |                     5 }|                    d           |                                d         cddd           S # 1 swxY w Y   dS )z<Find an unused localhost port from 1024-65535 and return it.)r   )z	127.0.0.1r      N)
contextlibclosingsocketbindgetsockname)r  socks     r1   _unused_portr   <  s    		FM{;;;	<	< %		"###!!!$% % % % % % % % % % % % % % % % % %s   /A$$A(+A(c                  4    t          t          j                  S rJ   )r   r  SOCK_STREAMr/   r0   r1   unused_tcp_portr#  C  s    *+++r0   c                  4    t          t          j                  S rJ   )r   r  
SOCK_DGRAMr/   r0   r1   unused_udp_portr&  H  s    )***r0   )rC   c                  .    t                      fd} | S )z9A factory function, producing different unused TCP ports.c                      t          t          j                  } | v rt          t          j                  } | v                     |            | S zReturn an unused port.)r   r  r"  r   portproduceds    r1   factoryz(unused_tcp_port_factory.<locals>.factoryR  sT    F.//h 233D h 	Tr0   setr-  r,  s    @r1   unused_tcp_port_factoryr1  M  .     uuH	 	 	 	 	 Nr0   c                  .    t                      fd} | S )z9A factory function, producing different unused UDP ports.c                      t          t          j                  } | v rt          t          j                  } | v                     |            | S r)  )r   r  r%  r   r*  s    r1   r-  z(unused_udp_port_factory.<locals>.factorye  sT    F-..h 122D h 	Tr0   r.  r0  s    @r1   unused_udp_port_factoryr5  `  r2  r0   ).rJ   r   )`__doc__r6   r  enumrU   rf   r  sysr   textwrapr   typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   rT   r   r   r   r   r   r   r   version_infor   typing_extensionsr   
_ScopeNamer"   r#   r%   rW   FixtureFunctionMarker
FixtureDefr   strEnumr'   r?   rB   objectboolfloatintrL   r_   rS   rd   rh   rx   r|   hookimplr   r   r   r   r   r   r   r   r   r/  r   __annotations__ModuleClass	Collectorr   r   r   r   r   r   r   r   r   r   r   r  r   r   r#  r&  r1  r5  r/   r0   r1   <module>rK     s
   $ $ $             



                                      "                   v))))))WT]]HI
WT]]8C2,>#?    !HS-2C-C$D    -/EEF /!2O!CD  

    3	   
 V 4G D      
 GJ),
 	  % D Xf%&	
  
sE3d234#(()	
 3-    
  
  GJ),
 	   D Xf%&	
  
sE3d234#(()	
 3-    
" 37 /BE
?112    9c 9d 9 9 9 9
& & & & & &,s ,t , , , ,
A3 A4 A A A A

f 

 

 

 

 

V      $% %DI % % %  %22z?2 
2 2 2 20	- 	- 	- 	- 	- 	-(: ($ ( ( ( (
38
cN ) 	
 
#s(^   
 15   &#0z #0d #0 #0 #0 #0L-J -4 - - - -( 355Z       $	V]FL01	9<	CI	

K!4fk6;K.K(L#MtS	 	 	  	00$0-1$Z0	0 0 0 0:9s 9t 9 9 9 9 T""" 
 
%/ 
f 
  
  
 #" 
F
+
 
+"f*9M 
+RV 
+ 
+ 
+ 
+  &v	       	$ 	$ 	$ 	$ $D111
6? 
x7G 
 
 
 21
4:# :$ : : : :))
3	#&
') $) ) ) )X
v{ 
t 
 
 
 
&  8G4M+N    %c %c % % % % , , , , , + + + + + i   "c'!2    ! $ i   "c'!2    !   r0   