
    id                    <   S SK Jr  S SKrS SKrS SKJrJr  S SKJrJ	r	  SS/r
\R                  S:  a  S SKJr  OS SKJr  \	" S	5      r\R                  S
:  a  \R                  rg\R                  S:  a  SSS.       SS jjrgSSS.       SS jjrSS jrg)    )annotationsN)Callable	Coroutine)AnyTypeVarasyncio_runiscoroutinefunction)      )r	   _T)r
      )r
      Fdebugloop_factoryc                   [         R                  " XS9 nUR                  U 5      sS S S 5        $ ! , (       d  f       g = f)Nr   )asyncioRunnerrun)mainr   r   runners       J/var/www/html/trading/venv/lib/python3.13/site-packages/uvicorn/_compat.pyr   r      s+     ^^%Cv::d# DCCs   0
>c                   [         R                  " 5         [        S5      e! [         a     Of = f[         R                  " U 5      (       d  [	        SU < 35      eUc  [         R
                  " 5       nOU" 5       n Uc  [         R                  " U5        Ub  UR                  U5        UR                  U 5       [        U5        UR                  UR                  5       5        UR                  UR                  5       5        Uc  [         R                  " S 5        UR                  5         $ ! Uc  [         R                  " S 5        UR                  5         f = f!  [        U5        UR                  UR                  5       5        UR                  UR                  5       5        Uc  [         R                  " S 5        UR                  5         f ! Uc  [         R                  " S 5        UR                  5         f = f= f)Nz8asyncio.run() cannot be called from a running event loopza coroutine was expected, got )r   get_running_loopRuntimeErroriscoroutine
ValueErrornew_event_loopset_event_loop	set_debugrun_until_complete_cancel_all_tasksshutdown_asyncgensshutdown_default_executorclose)r   r   r   loops       r   r   r   #   s   	[$$& YZZ  		
 ""4((=dXFGG))+D>D	#&&t, u%**40!$'''(?(?(AB''(F(F(HI'**40

  '**40

!$'''(?(?(AB''(F(F(HI'**40

  '**40

s>   " 
//==E ;A	D..+EG?A	G'*G?+G<<G?c                h   [         R                  " U 5      nU(       d  g U H  nUR                  5         M     U R                  [         R                  " USS065        U HP  nUR                  5       (       a  M  UR                  5       c  M-  U R                  SUR                  5       US.5        MR     g )Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message	exceptiontask)r   	all_taskscancelr!   gather	cancelledr*   call_exception_handler)r&   	to_cancelr+   s      r   r"   r"   G   s    %%d+	DKKM  		 RT RSD~~~~+++#V%)^^%5 $	     )r   zCoroutine[Any, Any, _T]r   boolr   z.Callable[[], asyncio.AbstractEventLoop] | Nonereturnr   )r&   zasyncio.AbstractEventLoopr4   None)
__future__r   r   syscollections.abcr   r   typingr   r   __all__version_infoinspectr	   r   r   r   r"    r2   r   <module>r>      s    "  
 / /
0w++T]w++K 
 GK		$%	$ 	$ E		$
 
	$" GK	"%" " E	"
 
"Hr2   