+
    WBiw              	       j   R R.t ^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ^ RIHt ^RIHt ^ RIHt  ]! ]P$                  ]P$                  4      P&                  t ! R R	]P,                  4      t ! R
 R]P0                  4      t ! R R4      t ! R R4      t ! R R]P,                  4      t ! R R4      t]P<                  R8w  d]    ! R R ]]]P>                  4      t R t! ! R R]4      t" ! R R]PF                  4      t$ ! R R]4      t% ! R R]]PL                  4      t'ME ! R R ](4      t) ! R! R ]]]PT                  ])R"7      t  ! R# R]4      t" ! R$ R%]]PV                  4      t, ! R& R]PZ                  4      t.R#   ] d    ]P$                  P&                  t ELFi ; i)'GLibEventLoopGLibEventLoopPolicyN)
coroutines)Mapping)contextmanager)_ossighelper)GLibc                   H   a a ] tR t^,t oRtV 3R ltR tR tR tRt	Vt
V ;t# )_IdleSourceziInternal helper source for idle task handling

The only advantage is that we can keep the source around.
c                f   < \        4       P                  4        Wn        V P                  R 4       R# )FN)super__init___loopset_can_recurse)selfloop	__class__s   &&./usr/lib/python3.14/site-packages/gi/events.pyr   _IdleSource.__init__2   s$    
U#    c                    V P                   P                  '       g   R# \        V P                   P                  4      R3# )FFr   r   _may_iteratebool_idle_tasksr   s   &r   prepare_IdleSource.prepare9   s2    zz&&&DJJ**+R//r   c                |    V P                   P                  '       g   R # \        V P                   P                  4      # Fr   r   s   &r   check_IdleSource.check?   s*    zz&&&DJJ**++r   c                V    V P                   P                  4        \        P                  # N)r   _glib_idle_dispatchr   SOURCE_CONTINUEr   callbackargss   &&&r   dispatch_IdleSource.dispatchE   s    

&&(###r   )r   )__name__
__module____qualname____firstlineno____doc__r   r   r"   r+   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r   r
   r
   ,   s#     
$0,$ $r   r
   c                   R   a a ] tR t^Jt oRtV 3R ltR tR t]R 4       t	Rt
VtV ;t# )GLibTaskzThis is a simple asyncio.Task subclass that will be returned when using the
GLibEventLoop. It adds functionality to set the priority that is used to
iterate the task's coroutine.
c                f   < \        4       P                  ! V/ VB  \        P                  V n        R # r%   )r   r   r   PRIORITY_DEFAULT_glib_idle_priority)r   r*   kwargsr   s   &*,r   r   GLibTask.__init__P   s&    $)&)#'#8#8 r   c                B    \        V\        4      '       g   Q hWn        R# )z:Set the GLib priority used to iterate the task's coroutineN)
isinstanceintr;   r   prioritys   &&r   set_priorityGLibTask.set_priorityU   s    (C((((#+ r   c                    V P                   # )z:Get the GLib priority used to iterate the task's coroutiner;   rA   s   &&r   get_priorityGLibTask.get_priority[   s    '''r   c                    \        V3R V/VB # )r   )r8   )clsr   coror<   s   &&&,r   _factoryGLibTask._factory_   s    242622r   rF   )r-   r.   r/   r0   r1   r   rC   rG   classmethodrL   r2   r3   r4   r5   s   @@r   r8   r8   J   s2     
9
,( 3 3 3r   r8   c                      a a ] tR t^dt oRtR t]R 4       t]R 4       tR t	R t
V 3R ltR tR	 tR
 tR tRtVtV ;t# )_GLibEventLoopMixina  Base functionally required for both proactor and selector.

The proactor/selector is always available through _selector, and we assume
it has the following extra functionality that we provide:
 * _source: the GSource subclass
 * _dispatching: boolean whether it is dispatching currently
 * attach/detach: add/remove the GSource from the main context

In principle, we simply override run_forever to call into GLib, with the
assumption that a GSource is registered which will then call back into
the python mainloop _run_once handler when needed. This in turn calls
self._selector.select(), which means we just need to make sure to return
our already prepared events at that point.
c                    Vf   Q hWn         \        P                  P                  V P                   R4      V n        . V n        . V n        RV n        R # )NF)_contextr   MainLoopnew
_main_loop_quit_funcsr   r   )r   main_contexts   &&r   r   _GLibEventLoopMixin.__init__t   sG    '''$--++DMM5A!r   c              #    "   V P                   '       g   Rx  R#  RV n         V P                  P                  4        Rx  RV n         V P                  P                  4        R#   RT n         T P                  P                  4        i ; i5i)zThis context manager ensures the EventLoop is *not* being iterated.

It purely exists to handle the case where python code iterates the main
context more gracefully.
NFT)r   	_selectordetachattachr   s   &r   paused_GLibEventLoopMixin.paused}   sl         	$ %DNN!!# $DNN!!# !%DNN!!#s   B
%A$ #B
$#BB
c           	   #  	  "   V P                   P                  4       '       g   Q hV P                  P                  V4       V P	                  4       '       df    Rx  V P                   P                  4        V P                  P                  4        V P                  '       d   V P                  R,          ! 4        R# V P                  4        V P                  V P                  4       \        P                  ! 4       V n        \        P                  ! 4       p\        P                   ! V P"                  V P$                  R7        \&        P(                  ! V 4       V P*                  P,                  P.                  '       d   Q hRV n        V P*                  P3                  4        \5        V 4      V n        V P6                  P3                  V P                   4       V P6                  P9                  R4       V P:                  '       d4   V P6                  P=                  V P:                  ^ ,          ^ ,          4       Rx  RV n        V P6                  P?                  4        RV n        V P*                  PA                  4        V P                   P                  4        RV n        \&        P(                  ! R4       \B        PD                  ! \F        4      ;_uu_ 4        V P                  R4       RRR4       \        P                   ! V!   V P                  P                  4        \I        V P                  4      ^ 8X  g   Q hRV n        R#   T P                   P                  4        T P                  P                  4        T P                  '       d   T P                  R,          ! 4        i i ; i  + '       g   i     L; i  RT n        T P6                  P?                  4        RT n        T P*                  PA                  4        T P                   P                  4        RT n        \&        P(                  ! R4       \B        PD                  ! \F        4      ;_uu_ 4        T P                  R4       RRR4       M  + '       g   i     M; i\        P                   ! T!   T P                  P                  4        \I        T P                  4      ^ 8X  g   Q hRT n        i ; i5i)zThis context manager ensures the EventLoop is marked as running
while other API is iterating its main context.
The passed quit function is used to stop all recursion levels when
stop() is called.
N)	firstiter	finalizerTzGLibEventLoop._idle_sourceFr   )%rR   acquirerV   append
is_runningreleasepop	_stopping_check_closed_set_coroutine_origin_tracking_debug	threading	get_ident
_thread_idsysget_asyncgen_hooksset_asyncgen_hooks_asyncgen_firstiter_hook_asyncgen_finalizer_hookasyncio_set_running_looprZ   _source_dispatchingr   r\   r
   _idle_sourceset_namer   rC   destroyr[   
contextlibsuppressAttributeErrorlen)r   	quit_funcold_agen_hookss   && r   running_GLibEventLoopMixin.running   sl     }}$$&&&&	*??+%%'  $$&>>>$$R(* 	++DKK8#--///13333	
	#%%d+~~--::::: $DNN!!# +D 1D$$T]]3&&'CD!!..t/?/?/B1/EF %D%%' $DNN!!#MM!!#"DO%%d+$$^4433E: 5""N3  "t''(A---"DNU %%'  $$&>>>$$R(* "B 54 !&D%%' $DNN!!#MM!!#"DO%%d+$$^4433E: 5444""N3  "t''(A---"DNss   ASM C&S;N9 >B<N9 :BSN&'ASA!N##S&N6	1S9BSQ0	'	S0R ;ASSc                :    \         P                  ! 4       R ,          # )i@B )r   get_monotonic_timer   s   &r   time_GLibEventLoopMixin.time   s    &&(722r   c                   V P                  4       '       g   \        P                  ! R \        4       V P                  RJ d   \        P                  ! R\        4       V P
                  '       d   ^ # V P                  '       dN   \        V P                  ^ ,          P                  V P                  4       ,
          R,          4      pV^ 8  d   V# ^ # R# )zkGLibEventLoop is iterated without being marked as running. Missing override or invalid use of existing API!TzXGLibEventLoop is not stopping properly. Missing override or invalid use of existing API!i  r   )
rd   warningswarnRuntimeWarningrg   _ready
_scheduledr@   _whenr   r   timeouts   & r   _get_timeout_ms#_GLibEventLoopMixin._get_timeout_ms   s      MM} >>T!MMj ;;;??? 4??1-33diikATIJG%l711	r   c                  <  VP                   P                  pV\        P                  8X  d   \        4       P                  WV4      # \        P                  ! WW4      pV P                  P                  WE34       V P                  P                  R  R7       V P                  P                  V P                  ^ ,          ^ ,          4       V#   \         d    \        P                  p Li ; i)c                     V ^ ,          # )     )xs   &r   <lambda>0_GLibEventLoopMixin._call_soon.<locals>.<lambda>   s    AaDr   )key)__self__r;   r|   r   r:   r   
_call_soonrs   Handler   rc   sortrw   rC   )r   r)   r*   contextrB   handler   s   &&&&  r   r   _GLibEventLoopMixin._call_soon   s    	-
  ((<<H t,,,7%%hg>>> 23.1 	&&t'7'7':1'=>  	-,,H	-s   C C+*C+c                j    V P                   '       g   Q hR V n         V P                  4        RV n         R# )FTN)r   	_run_oncer   s   &r   _glib_dispatch"_GLibEventLoopMixin._glib_dispatch   s0          " r   c                T   V P                   '       g   Q hV P                  4       ;_uu_ 4        V P                  P                  4       p. pV P                  '       dS   V P                  ^ ,          ^ ,          V8X  d4   VP                  V P                  P                  ^ 4      ^,          4       Kd  V F  pVP                  4        K  	  V P                  '       d4   V P                  P                  V P                  ^ ,          ^ ,          4       RRR4       R#   + '       g   i     R# ; ir   N)	r   r]   rw   rG   r   rc   rf   _runrC   )r   rB   ready_handlesr   s   &   r   r&   '_GLibEventLoopMixin._glib_idle_dispatch  s         
 [[]]((557HM"""t'7'7':1'='I$$T%5%5%9%9!%<Q%?@' ( !!..t/?/?/B1/EF ]]]s   .DA<D3DD'	c                l    R V n         V P                  '       d   V P                  R,          ! 4        R# R# )TNr   )rg   rV   r   s   &r   stop_GLibEventLoopMixin.stop  s+    R " r   c                    R V P                   P                   RV P                  4        RV P                  4        RV P	                  4        R\        V P                  4      R R\        V P                  4      R R2# )<z	 running=z closed=z debug=z ctx=0xXz loop=0x>)r   r-   rd   	is_closed	get_debughashrR   rU   r   s   &r   __repr___GLibEventLoopMixin.__repr__  sy    ''(	$//2C1D Enn&'wt~~/?.@ A$--(+8D4I!3LAO	
r   )rR   rw   r   rU   r   rV   rg   rm   )r-   r.   r/   r0   r1   r   r   r]   r   r   r   r   r   r&   r   r   r2   r3   r4   r5   s   @@r   rP   rP   d   sa     " $ $& 8# 8#t3,.!G(#
 
r   rP   c                   &   a  ] tR tRt o R tRtV tR# )_GLibEventLoopRunMixini&  c           	        V P                  4       '       d   \        R 4      h\        P                  ! V P                  P
                  4      ;_uu_ 4        V P                  V P                  P
                  4      ;_uu_ 4        \        V P                  4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z"This event loop is already runningN)rd   RuntimeErrorr   register_sigint_fallbackrU   quitr   g_main_loop_runr   s   &r   run_forever"_GLibEventLoopRunMixin.run_forever+  s    ??CDD 11$//2F2FGGLL--..DOO, / HG.. HGGs$   .B=B*	B=*B:5B==C	r   N)r-   r.   r/   r0   r   r2   r3   r6   s   @r   r   r   &  s     
	- 	-r   r   c                   H   a a ] tR tRt oRtV 3R ltR tR tR tRt	Vt
V ;t# )_SourceBasei7  z3Common Source functionality for both unix and win32c                   < \        4       P                  4        R V n        V P                  R 4       V P	                  R4       \
        P                  ! V4      V n        . V n        R# )Fzpython asyncio integrationN)	r   r   rv   r   rx   weakrefrefrZ   r   )r   selectorr   s   &&r   r   _SourceBase.__init__:  sO    !
 	U#23 !X.r   c                6    V P                  4       P                  # r%   )rZ   r   r   s   &r   r   _SourceBase._loopP  s    ~~%%%r   c                    R V n          V P                  4       P                  4        RV n         \        P                  #   RT n         i ; i)TF)rv   r   r   r   r'   r(   s   &&&r   r+   _SourceBase.dispatchS  sA     	&JJL'') %D### !&Ds	   > 	Ac                f    V P                   '       g   \        R 4      hV P                  p. V n        V# )z>gi.asyncio.Selector.select only works while it is dispatching!)rv   r   r   )r   readys   & r   
_get_ready_SourceBase._get_ready]  s5       P  r   )rv   r   rZ   )r-   r.   r/   r0   r1   r   r   r+   r   r2   r3   r4   r5   s   @@r   r   r   7  s!     =,&$ r   r   c                   \   a a ] tR tRt oRtV 3R ltV 3R ltRR ltRV 3R lltRt	Vt
V ;t# )	_SelectorMixinih  z>A Mixin for common functionality of the Selector and Proactor.c                ~   < \        4       P                  4        Wn        W n        / V n        \        V 4      V n        R # r%   )r   r   rR   r   
_fd_to_key_Sourceru   r   r   r   r   s   &&&r   r   _SelectorMixin.__init__k  s-    
t}r   c                   < V P                   '       d"   V P                   P                  4        R V n         \        4       P                  4        R # r%   )ru   ry   r   close)r   r   s   &r   r   _SelectorMixin.closet  s.    <<<LL  "DLr   c                6    V P                   P                  4       # r%   )ru   r   r   s   &&r   select_SelectorMixin.selectz  s    ||&&((r   c                6   < \        4       P                  V4      # r%   )r   r   )r   r   r   s   &&r   _real_select_SelectorMixin._real_select}  s    w~~g&&r   )rR   r   r   ru   r%   )r-   r.   r/   r0   r1   r   r   r   r   r2   r3   r4   r5   s   @@r   r   r   h  s!     H%)' 'r   r   win32c                      a a ] tR tRt oRt]P                  ]P                  ]P                  ]P                  ]P                  ]P                  0tR tV 3R ltV 3R ltR tV 3R ltRtVtV ;t# )	r   i  ziAn asyncio event loop that runs the python mainloop inside GLib.

Based on the asyncio.SelectorEventLoop
c                    \         P                  W4       / V n        \        V P                  V 4      p\
        P                  P                  W4       R V n        \        P                  V n
        R# gMbP?N)rP   r   _GLibEventLoop__signal_handlers	_SelectorrR   rs   SelectorEventLoop_clock_resolutionr8   rL   _task_factory)r   rW   r   s   && r   r   GLibEventLoop.__init__  sX    ((< &(D" 5H%%..t> &*D" "*!2!2Dr   c                  < \         P                  ! V4      '       g   \         P                  ! V4      '       d   \        R4      hV P	                  4        WP
                  9  d   \        4       P                  ! W.VO5!  # V P                  P                  VR4      ^ ,          pV'       d   VP                  4        \        P                  ! V4      pVP                  RV 24       VP                  \        P                  4       VP!                  V P"                  4       VP%                  V P&                  V4       WBV3V P                  V&   ?R# )zAdd a handler for UNIX signalz3coroutines cannot be used with add_signal_handler()Nzasyncio signal watch for )NNN)r   iscoroutineiscoroutinefunction	TypeErrorrh   _GLIB_SIGNALSr   add_signal_handlerr   getry   r   unix_signal_source_newrx   rC   PRIORITY_HIGHr\   rR   set_callback
_signal_cb)r   sigr)   r*   sourcer   s   &&&* r   r    GLibEventLoop.add_signal_handler  s   %%h//:3Q3Q4 4   UVV 
 ,,,w11#G$GG ++//5GHKF  005FOO7u=> 2 23MM$--(5+1T*BD""3'r   c                  < WP                   9  d   \        4       P                  V4      #  V P                  V,          w  p pV P                  V VP	                  4        VP                  4        V\        P                  8X  dr   \        P                  ! \        P                  4      ^ 8X  dI   \        P                  ^ 8  d4   \        P                  ! \        P                  \        P                  4       R#   \         d     R# i ; i)r   TF)r   r   remove_signal_handlerr   ry   _clear_boxedsignalSIGINTr   PyOS_getsigstartup_sigint_ptrPyOS_setsigKeyError)r   r   r   _r   s   &&  r   r   #GLibEventLoop.remove_signal_handler  s    ,,,w44S99#55c:1**3/ ##% 6==($00?1D$77!; ,,|'F'F  s   C
C8 8DDc                j    V P                   P                  V4      w  r#pV P                  ! V.VO5!   R # r%   )r   r   	call_soon)r   r   ru   cbr*   s   &&   r   r   GLibEventLoop._signal_cb  s0     $ 6 6 : :3 ?G NN2%%r   c                   < \        4       P                  4        \        V P                  4       F  pV P	                  V4       K  	  R # r%   )r   r   listr   r   )r   sr   s   & r   r   GLibEventLoop.close  s1    GMMO$001**1- 2r   )__signal_handlersr   r   )r-   r.   r/   r0   r1   r   SIGHUPr   SIGTERMSIGUSR1SIGUSR2SIGWINCHr   r   r   r   r   r   r2   r3   r4   r5   s   @@r   r   r     s[     	 MMMMNNNNNNOO
,	3 	<	6	&	. 	.r   c                 R    \        V \        4      '       d   V # V P                  4       # r%   )r?   r@   fileno)fileobjs   &r   _fileobj_to_fdr    s!    gs##N~~r   c                   ,   a  ] tR tRt o R tR tRtV tR# )r   i  c                F    V P                  4       P                  4       pR V3# r!   )r   r   r   s   & r   r   _Source.prepare  s"    jjl224G '>!r   c                B   . pV P                  4       P                  P                  4        F  pV P                  VP                  4      p^ pV\
        P                  P                  ( ,          '       d   V\        P                  ,          pV\
        P                  P                  ( ,          '       d   V\        P                  ,          pV'       g   K  VP                  W$34       K  	  Wn        V P                  4       P                  4       pV^ 8X  d   R# \!        V4      # )r   T)rZ   r   valuesquery_unix_fd_tagr   IOConditionOUT	selectors
EVENT_READINEVENT_WRITErc   r   r   r   r   )r   r   r   	conditioneventsr   s   &     r   r"   _Source.check  s    E~~'2299; ..sxx8	 0 0 4 4444i222F 0 0 3 3333i333F6LL#/ <  Kjjl224G!|;r   )r   N)r-   r.   r/   r0   r   r"   r2   r3   r   s   @r   r   r     s     	"	 	r   r   c                       ] tR tRtRtR# )_SelectorKeyi  r   N)r-   r.   r/   r0   r2   r   r   r   r$  r$    s    r   r$  c                   B   a  ] tR tRt o R tR tR	R ltR tR tRt	V t
R# )
_FileObjectMappingi  c                    Wn         R # r%   fd_dict)r   r)  s   &&r   r   _FileObjectMapping.__init__  s    "Lr   c                ,    \        V P                  4      # r%   )r}   r)  r   s   &r   __len___FileObjectMapping.__len__   s    t||$$r   Nc                N    \        V4      pV P                  P                  W24      # r%   )r  r)  r   )r   r  defaultfds   &&& r   r   _FileObjectMapping.get#  s!    (B<<##B00r   c                N    V P                  V4      pVf   \        V: R24      hV# )Nz is not registered)r   r   )r   r  values   && r   __getitem___FileObjectMapping.__getitem__'  s-    HHW%E}',>?@@Lr   c                ,    \        V P                  4      # r%   )iterr)  r   s   &r   __iter___FileObjectMapping.__iter__-  s    %%r   r(  r%   )r-   r.   r/   r0   r   r,  r   r4  r8  r2   r3   r   s   @r   r&  r&    s#     	#	%	1		& 	&r   r&  c                   d   a a ] tR tRt oRtV 3R ltR tR tR tRR lt	R t
R	 tR
 tRtVtV ;t# )r   i0  zGA Selector for gi.events.GLibEventLoop registering python IO with GLib.c                n   < \        4       P                  W4       \        V P                  4      V n        R # r%   )r   r   r&  r   _mapr   s   &&&r   r   _Selector.__init__3  s#    GW+*4??;DIr   c                d    V P                   P                  V P                  P                  4       R # r%   )ru   r\   r   rR   r   s   &r   r\   _Selector.attach7  s    LL

 3 34r   c                    V P                   P                  4        \        V 4      V n         V P                  P	                  4        F  pV P                  V4       K  	  R # r%   )ru   ry   r   r   r  _register_key)r   r   s   & r   r[   _Selector.detach:  sB    LL  ""4=DL--/""3' 0r   c                   \         P                  ! ^ 4      pVP                  \        P                  ,          '       d"   V\         P                  P
                  ,          pVP                  \        P                  ,          '       d"   V\         P                  P                  ,          pV P                  P                  VP                  V4      Vn        R# r   )r   r  r!  r  r  r  r  r  ru   add_unix_fdr0  r  )r   r   r   s   && r   rA  _Selector._register_keyA  s    ((+IzzI0000T--000	zzI1111T--111	||//	BCHr   c                J   V'       d4   V\         P                  \         P                  ,          ( ,          '       d   \        R V: 24      h\	        V4      pW@P
                  9   d   \        V: RV R24      h\        WW#4      pV P                  V4       WPP
                  V&   V# )zInvalid events: z (FD z) is already registered)	r  r  r  
ValueErrorr  r   r   r$  rA  )r   r  r!  datar0  r   s   &&&&  r   register_Selector.registerI  s    9//)2G2GGHHH #3F:!>??(B__$'E"5LMNNwF9Cs#"%OOBJr   c                    \        V4      pV P                  V,          pV P                  '       d&   V P                  P                  VP                  4       V P                  V V# r%   )r  r   ru   remove_unix_fdr  )r   r  r0  r   s   &&  r   
unregister_Selector.unregisterZ  sJ    (B//"%C|||++CHH5#Jr   c                (    V P                   V,          # r%   r<  )r   r  s   &&r   get_key_Selector.get_keyg  s    99W%%r   c                    V P                   # )zGReturn a mapping of file objects or file descriptors to
selector keys.
rP  r   s   &r   get_map_Selector.get_mapj  s     99r   )r<  ru   r%   )r-   r.   r/   r0   r1   r   r\   r[   rA  rI  rM  rQ  rT  r2   r3   r4   r5   s   @@r   r   r   0  s6     U	<	5	(	C	"			&	 	r   r   c                   &   a  ] tR tRt o R tRtV tR# )_PushRunMixinBackMetais  c                    \         P                  V 4      pVP                  \        4      p. VR V OW^,           ,          NW,          NW^,           R  O# r%   )typemroindexr   )rJ   rZ  idxs   &  r   rZ  _PushRunMixinBackMeta.mrox  sN    ((3-C))23CHS#YH!GHchH1WYHHr   r   N)r-   r.   r/   r0   rZ  r2   r3   r   s   @r   rW  rW  s  s     
	I 	Ir   rW  c                   *   a  ] tR tRt o RtR tRtV tR# )r   i~  zvAn asyncio event loop that runs the python mainloop inside GLib.

Based on the asyncio.WindowsProactorEventLoopPolicy
c                    \         P                  W4       \        V P                  V 4      p\        P
                  P                  W4       R V n        \        P                  V n	        R# r   )
rP   r   	_ProactorrR   rs   ProactorEventLoopr   r8   rL   r   )r   rW   proactors   && r   r   r     sN    ((< 5H%%..t> &*D" "*!2!2Dr   )r   r   N)r-   r.   r/   r0   r1   r   r2   r3   r   s   @r   r   r   ~  s     		3 	3r   )	metaclassc                   J   a a ] tR tRt oV 3R ltR tR tR tR tRt	Vt
V ;t# )r   i  c                H   < \        4       P                  V4       R V n        R # r%   )r   r   _poll_fd)r   rb  r   s   &&r   r   _Source.__init__  s    GX& !DMr   c                    V P                   e   Q h\        P                  ! V P                  4       P                  \        P
                  4      V n         V P                  V P                   4       R # r%   )rf  r   PollFDrZ   _iocpIO_INadd_pollr   s   &r   enable_Source.enable  sE    ==((( KK(8(>(>

KDMMM$--(r   c                J    V P                  V P                  4       R V n        R # r%   )remove_pollrf  r   s   &r   disable_Source.disable  s    T]]+ DMr   c                    V P                   f   R# V P                  4       P                  4       p\        V P                  4      V3# )Nr   )rf  r   r   r   r   r   s   & r   r   r    s:    }}$  jjl224G$g--r   c                4   V P                   f   R# V P                   P                  '       d9   V P                  P                  V P	                  4       P                  ^ 4      4       V P                  '       d   R# V P                  4       P                  4       ^ 8H  # )NFT)rf  reventsr   extendrZ   r   r   r   r   s   &r   r"   r"    si    }}$}}$$$""4>>#3#@#@#CD{{{::<//1Q66r   )rf  )r-   r.   r/   r0   r   rm  rq  r   r"   r2   r3   r4   r5   s   @@r   r   r     s#     	!	)	!	.
	7 
	7r   c                   B   a a ] tR tRt oRtV 3R ltR tR tRtVt	V ;t
# )r`  i  zGA Proactor for gi.events.GLibEventLoop registering python IO with GLib.c                   < \        4       P                  W4       \        V 4      V n        V P                  P	                  V4       R # r%   )r   r   r   ru   r\   r   s   &&&r   r   _Proactor.__init__  s2    GW+ #4=DLLL(r   c                :    V P                   P                  4        R # r%   )ru   rm  r   s   &r   r\   _Proactor.attach  s    LL!r   c                :    V P                   P                  4        R # r%   )ru   rq  r   s   &r   r[   _Proactor.detach  s    LL  "r   )ru   )r-   r.   r/   r0   r1   r   r\   r[   r2   r3   r4   r5   s   @@r   r`  r`    s     U	)	"	# 	#r   r`  c                      a  ] tR tRt o RtR tR tR tR tR t	R t
R	 t]P                  R
8w  d
   R tRtV tR# RtV tR# )r   i  ae  An asyncio event loop policy that runs the GLib main loop.

The policy allows creating a new EventLoop for threads other than the main
thread. For the main thread, you can use get_event_loop() to retrieve the
correct mainloop and run it.

Note that, unlike GLib, python does not support running the EventLoop
recursively. You should never iterate the GLib.MainContext from within
the python EventLoop as doing so prevents asyncio events from being
dispatched.

As such, do not use API such as GLib.MainLoop.run or Gtk.Dialog.run.
Instead use the proper asynchronous patterns to prevent entirely blocking
asyncio.
c                0    / V n         R V n        R V n        R # r%   )_loops_child_watcher!_GLibEventLoopPolicy__orig_policyr   s   &r   r   GLibEventLoopPolicy.__init__  s    "!r   c                ^   \         P                  P                  4       pVfK   \        P                  ! 4       \        P
                  ! 4       J d   \         P                  P                  4       pVf.   \        R\        P                  ! 4       P                  : R24      hV P                  V4      # )a  Get the event loop for the current context.

Returns an event loop object for the thread default GLib.MainContext
or in case of the main thread for the default GLib.MainContext.

An exception will be thrown if there is no GLib.MainContext for the
current thread. In that case, using new_event_loop() will create a new
main context and main loop which can subsequently attached to the thread
by calling set_event_loop().

Returns a new GLibEventLoop or raises an exception.
z(There is no main context set for thread .)
r   MainContextget_thread_defaultrk   current_threadmain_threadr/  r   nameget_event_loop_for_context)r   ctxs   & r   get_event_loop"GLibEventLoopPolicy.get_event_loop  s     113;93359N9N9PP""**,C ;:9;S;S;U;Z;Z:]]^_  ..s33r   c                    V P                   \        V4      ,          pVP                  4       '       g   V#  \	        V4      V P                   \        V4      &   V P
                  '       dM   V\        P                  P                  4       8X  d*   V P
                  P                  V P                  4       4       V P                   \        V4      ,          #   \         d     Li ; i)z*Get the event loop for a specific context.)r  r   r   r   r   r  r   r  r/  attach_loopr  )r   r  r   s   && r   r  .GLibEventLoopPolicy.get_event_loop_for_context  s    
	;;tCy)D>>## $
 "/s!3DI3$*:*:*B*B*D#D++D,?,?,AB{{49%%  		s   3C C C c                N   Ve   \        V\        4      '       g   Q h\        P                  P	                  4       ;r#VfK   \
        P                  ! 4       \
        P                  ! 4       J d   \        P                  P                  4       pVf   V P                  P                  \        V4      R4      pV'       dj   \        VP                  4      \        V4      8w  d   \        P                  ! R\        4       V'       d"   \        P                  P!                  V4       R# R# R# V'       d.   \#        R\
        P                  ! 4       P$                  : R24      h\        P                  P'                  VP                  4       WP                  \        VP                  4      &   R# )zSet the event loop for the current context (python thread) to loop.

This is only permitted if the thread has no thread default main context
with the main thread using the default main context.
Nz<GMainContext was changed unknowingly by asyncio integration!zThread zN already has a main context, get_event_loop() will create a new loop if needed)r?   r   r   r  r  rk   r  r  r/  r  rf   r   rR   r   r   r   pop_thread_defaultr   r  push_thread_default)r   r   r  ctx_tdolds   &&   r   set_event_loop"GLibEventLoopPolicy.set_event_loop  s3    |z$>>>>''::<<;93359N9N9PP""**,C<++//$s)T2C%c2MMV& $$77?   "i668==@ AH H 
 00?/3KKT]]+,r   c                >    \        \        P                  ! 4       4      # )zICreate and return a new event loop that iterates a new
GLib.MainContext.
)r   r   r  r   s   &r   new_event_loop"GLibEventLoopPolicy.new_event_loop5  s     T--/00r   c                f    \         P                  ! 4       V n        \         P                  ! V 4       V # r%   )rs   get_event_loop_policyr  set_event_loop_policyr   s   &r   	__enter__GLibEventLoopPolicy.__enter__;  s&    $::<%%d+r   c                    V P                   P                  4        F  pVP                  4        K  	  \        P                  ! V P
                  4       R # r!   )r  r  r   rs   r  r  )r   exc_type	exc_value	tracebackr   s   &&&& r   __exit__GLibEventLoopPolicy.__exit__@  s?    
 KK&&(DJJL ) 	%%d&8&89 r   r   c                   V P                   fp   \        P                  ! 4       V n         \        P                  ! 4       \        P
                  ! 4       J d*   V P                   P                  V P                  4       4       V P                   # r%   )r  rs   ThreadedChildWatcherrk   r  r  r  r  r   s   &r   get_child_watcher%GLibEventLoopPolicy.get_child_watcherX  sb    ""*&-&B&B&D#++-1F1F1HH''33D4G4G4IJ&&&r   )__orig_policyr  r  N)r-   r.   r/   r0   r1   r   r  r  r  r  r  r  rn   platformr  r2   r3   r   s   @r   r   r     sK      "48&"!4F1
, ||w	' 	' r   )/__all__rz   rn   rs   r   r   rk   r  r   r   collections.abcr   r    r   gi.repositoryr   r   rS   runr   r|   Sourcer
   Taskr8   rP   r   r   r   r  r   r   r  r   SelectorKeyr$  r&  BaseSelectorr   rY  rW  ra  IocpProactorr`  AbstractEventLoopPolicyr   r   r   r   <module>r     s  * 1
2  
        # %  (DMM4==9==O
$$++ $<3w|| 34
 
D- -".$++ .b' '2 <<7p.3W5N5Np.d + :y,, &W &(>NI$:$: >F	I 	I3!!'	32$7+ $7L#NG$8$8 #"Q''99 Q'M  (mm''O(s   'F F21F2