
    f@	                     |    d Z ddlZddlZddlmZ ddlZej                  j                  d      rd Z	d Z
yd Z	d Z
y)z;Enable pyglet to be used interactively with prompt_toolkit
    N)default_timerlinuxc                 D    	 | j                          y # t        $ r Y y w xY wN)flipAttributeErrorwindows    `/var/www/cvtools/html/venv/lib/python3.12/site-packages/IPython/terminal/pt_inputhooks/pyglet.pyr   r      s"    	KKM 		s    	c                 $    | j                          y r   )r   r	   s    r   r   r      s        c                    	 t               }| j                         st        j                   j                          t        j                  j
                  D ]>  }|j                          |j                          |j                  d       t        |       @ t               |z
  }|dkD  rt        j                  d       n0|dkD  rt        j                  d       nt        j                  d       | j                         syy# t        $ r Y yw xY w)aE  Run the pyglet event loop by processing pending events only.

    This keeps processing pending events until stdin is ready.  After
    processing all pending events, a call to time.sleep is inserted.  This is
    needed, otherwise, CPU usage is at 100%.  This sleep time should be tuned
    though for best performance.
    on_drawg      $@g      ?g?g?gMbP?N)clockinput_is_readypyglettickappwindows	switch_todispatch_eventsdispatch_eventr   timesleepKeyboardInterrupt)contexttr
   	used_times       r   	inputhookr      s     G((*LL **,,   "&&(%%i0V	  !I4

3S 

4  

5!9 ((*:  s   C;D   	DD)__doc__sysr   timeitr   r   r   platform
startswithr   r    r   r   <module>r&      s@      )  <<7#*	*r   