
    {	                     j    S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KrS
r " S S\5      rg	)zk
Win32 asyncio event loop.

Windows notes:
- Somehow it doesn't seem to work with the 'ProactorEventLoop'.
    )unicode_literals   )	EventLoopINPUT_TIMEOUT   )ConsoleInputReader)EventLoopCallbacks)AsyncioTimeoutN)Win32AsyncioEventLoopc                   j    \ rS rSrSS jr\R                  S 5       rS rS r	S r
SS jrS	 rS
 rSrg)r      Nc                     [        5       U l        SU l        SU l        U=(       d    [        R
                  " 5       U l        g NF)r   _console_input_readerrunningclosedasyncioget_event_looploop)selfr   s     9lib/third_party/prompt_toolkit/eventloop/asyncio_win32.py__init__Win32AsyncioEventLoop.__init__   s0    %7%9"4G224	    c              #     #    [        U[        5      (       d   eU R                  (       a  [        S5      e[	        [
        UR                  U R                  5      nSU l         U R                  (       aZ  UR                  5          [        U R                  R                  SU R                  R                  5      5      n [        U5      v   M  UR%                  5         g! [         a  nUR                   S   n SnAOSnAff = fU H  nUR#                  U5        M     U R                  (       a  M  Ne! UR%                  5         f = f7f)z
The input 'event loop'.
zEvent loop already closed.TNr   )
isinstancer	   r   	Exceptionr
   r   input_timeoutr   r   resetiterrun_in_executorr   readnextStopIterationargsfeed_keystop)r   stdin	callbackstimeoutgekeysks           r   run_as_coroutine&Win32AsyncioEventLoop.run_as_coroutine   s      )%78888;;899 	0G0GS	,,%TYY66tT=W=W=\=\]^A"1g  LLN % %66!9D% A&&q)  ,,, LLNsC   A E#!D3 A	C E
D)C=8D3 =D.D3 3EEc                     SU l         g r   )r   r   s    r   r'   Win32AsyncioEventLoop.stop=   s	    r   c                 F    SU l         U R                  R                  5         g )NT)r   r   closer2   s    r   r5   Win32AsyncioEventLoop.close@   s     ""((*r   c                 <    U R                   R                  S U5        g N)r   r!   )r   callbacks     r   r!   %Win32AsyncioEventLoop.run_in_executorG   s    		!!$1r   c                 :    U R                   R                  U5        g r8   )r   call_soon_threadsafe)r   r9   _max_postpone_untils      r   call_from_executor(Win32AsyncioEventLoop.call_from_executorJ   s    		&&x0r   c                 :    U R                   R                  X5        g)z:Start watching the file descriptor for read availability. N)r   
add_reader)r   fdr9   s      r   rA    Win32AsyncioEventLoop.add_readerM   s    		R*r   c                 :    U R                   R                  U5        g)z9Stop watching the file descriptor for read availability. N)r   remove_reader)r   rB   s     r   rE   #Win32AsyncioEventLoop.remove_readerQ   s    		#r   )r   r   r   r   r8   )__name__
__module____qualname____firstlineno__r   r   	coroutiner/   r'   r5   r!   r>   rA   rE   __static_attributes__ r   r   r   r      s@    5  @+21+$r   r   )__doc__
__future__r   baser   r   terminal.win32_inputr   r)   r	   asyncio_baser
   r   __all__r   rM   r   r   <module>rT      s1    ( * 5 ) ( 
>$I >$r   