o
    voi                     @   st   d dl Z d dlZd dlmZmZ dddZg dZi Zdd ZG d	d
 d
e	Z
dd Zdedeeef fddZdS )    N)TupleCallableqtgtk)qt4gtk2)r   qt5qt6r   r   gtk3gtk4tkwxpygletglutosxasyncioc                 C   s   |t | < dS )z?Register the function *inputhook* as an event loop integration.N)
registered)name	inputhook r   [/home/ubuntu/.local/lib/python3.10/site-packages/IPython/terminal/pt_inputhooks/__init__.pyregister   s   r   c                   @   s   e Zd Zdd Zdd ZdS )UnknownBackendc                 C   s
   || _ d S )N)r   )selfr   r   r   r   __init__"   s   
zUnknownBackend.__init__c                 C   s   d | jdttt S )NzANo event loop integration for {!r}. Supported event loops are: {}z, )formatr   joinbackendssortedr   )r   r   r   r   __str__%   s
   zUnknownBackend.__str__N)__name__
__module____qualname__r   r   r   r   r   r   r   !   s    r   c                 C   s  t jdd}ddlm}m}m}m}m}m	}m
}m}	 |	 }
|d|d|d|d|d|d|di}|
durJ| dkrJ||
 | krJtd	||
  d
 ||
 S |duri| dkri|| | krgtd|  d| d || S dS | dkrzddl}dt jd< W np ty   zddl}dt jd< W n ty   dt jd< Y nw Y nNw | dkrzddl}dt jd< W n= ty   zddl}dt jd< W n ty   dt jd< Y nw Y nw | dkrdt j v rt jd= n
td|  d dS ddlm} || S )z?Sets the `QT_API` environment variable if it isn't already set.QT_APINr   )QT_API_PYQTQT_API_PYQT5QT_API_PYQT6QT_API_PYSIDEQT_API_PYSIDE2QT_API_PYSIDE6QT_API_PYQTv1
loaded_apir   r   r	   r   z5Cannot switch Qt versions for this session; will use .zRequest for "zC" will be ignored because `QT_API` environment variable is set to ""pyqt5pyside2pyqt6pyside6zUnrecognized Qt version: z". Should be "qt5", "qt6", or "qt".)r#   )osenvirongetIPython.external.qt_loadersr$   r%   r&   r'   r(   r)   r*   r+   printPyQt5ImportErrorPySide2PyQt6PySide6keysIPython.external.qt_for_kernelr#   )guiqt_apir$   r%   r&   r'   r(   r)   r*   r+   loaded
qt_env2guir7   r9   r:   r;   r#   r   r   r   
set_qt_api+   sx   (	rB   r>   returnc                 C   sj   | t v r
| t |  fS | tvrt| | tv rtt|  S | }| dr)t| } d}td| }| |j	fS )Nr   zIPython.terminal.pt_inputhooks.)
r   r   r   aliasesget_inputhook_name_and_func
startswithrB   	importlibimport_moduler   )r>   gui_modmodr   r   r   rE   {   s   

rE   )rG   r2   typingr   r   rD   r   r   r   KeyErrorr   rB   strrE   r   r   r   r   <module>   s    
P