
    MhC	                     v    d Z ddlZddlZddlmZ ddlZej                            d          rd Z	nd Z	d Z
dS )z:Enable pyglet to be used interactively with prompt_toolkit    N)default_timerlinuxc                 R    	 |                                   d S # t          $ r Y d S w xY wN)flipAttributeErrorwindows    e/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/IPython/terminal/pt_inputhooks/pyglet.pyr   r      s:    	KKMMMMM 	 	 	DD	s    
&&c                 .    |                                   d S r   )r   r	   s    r   r   r      s        c                 L   	 t                      }|                                 st          j                                          t          j        j        D ]N}|                                 |                                 |                    d           t          |           Ot                      |z
  }|dk    rt          j        d           n/|dk    rt          j        d           nt          j        d           |                                 dS dS # t          $ r Y dS 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      s8    GG((** 	"L *,    """&&(((%%i000V !I4
3S 
4     
5!!!9 ((** 	" 	" 	" 	" 	":    s   DD 
D#"D#)__doc__sysr   timeitr   r   r   platform
startswithr   r    r   r   <module>r&      s    @ @ 



  ) ) ) ) ) )  <7## 
     * * * * *r   