U
    ýÇ-es  ã                   @   s†   d Z ddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZmZ eee	e
efZdd„ Zdd„ Zeƒ Zeeƒ\ZZZZeeeƒZdS )a   Import Qt in a manner suitable for an IPython kernel.

This is the import used for the `gui=qt` or `matplotlib=qt` initialization.

Import Priority:

if Qt has been imported anywhere else:
   use that

if matplotlib has been imported and doesn't support v2 (<= 1.0.1):
    use PyQt4 @v1

Next, ask QT_API env variable

if QT_API not set:
    ask matplotlib what it's using. If Qt4Agg or Qt5Agg, then use the
        version matplotlib is configured with

    else: (matplotlib said nothing)
        # this is the default path - nobody told us anything
        try in this order:
            PyQt default version, PySide, PyQt5
else:
    use what QT_API says

    Note that %gui's implementation will always set a `QT_API`, see
    `IPython.terminal.pt_inputhooks.get_inputhook_name_and_func`

é    N)
Úload_qtÚ
loaded_apiÚenum_factoryÚQT_API_PYQT6ÚQT_API_PYSIDE6ÚQT_API_PYQT5ÚQT_API_PYSIDE2ÚQT_API_PYQTÚQT_API_PYSIDEÚQT_API_PYQT_DEFAULTc                 C   sÄ   | dkrdS | j  dd¡}|dkr€| j  dd¡}|dkr<dS | ¡ dkrNtgS | ¡ dkr`tgS | ¡ dkrrtgS td| ƒ‚n@|d	krÀ| j  d
d¡}|dkr¢dS | ¡ dkr´tgS td| ƒ‚dS )z-Constraints placed on an imported matplotlib.NÚbackendZQt4Aggzbackend.qt4ZpysideZpyqt4Zpyqt4v2z3unhandled value for backend.qt4 from matplotlib: %rZQt5Aggzbackend.qt5Zpyqt5z3unhandled value for backend.qt5 from matplotlib: %r)ZrcParamsÚgetÚlowerr
   r   r	   ÚImportErrorr   )Úmplr   Zmpqt© r   ú_/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/IPython/external/qt_for_kernel.pyÚmatplotlib_optionsB   s2    ÿÿr   c                  C   sš   t ƒ } | dk	r| gS tj dd¡}|dk	rDt|j d¡ƒdk rDtgS tj	 dd¡}|dkrpt
|ƒpntttttgS |tkrtd|d t¡f ƒ‚n|gS dS )zGReturn a list of acceptable QT APIs, in decreasing order of preference.NZ
matplotlibÚ.)Ú1Ú0Ú2ÚQT_APIz'Invalid Qt API %r, valid values are: %rz, )r   ÚsysÚmodulesr   ÚtupleÚ__version__Úsplitr   ÚosÚenvironr   r   r   r   r   Ú_qt_apisÚRuntimeErrorÚjoin)Zloadedr   Zqt_apir   r   r   Úget_options\   s(    ûÿr#   )Ú__doc__r   r   ZIPython.external.qt_loadersr   r   r   r   r   r   r   r	   r
   r   r    r   r#   Zapi_optsZQtCoreZQtGuiZQtSvgr   Zenum_helperr   r   r   r   Ú<module>   s   !0ø