MCPcopy Index your code
hub / github.com/ipython/ipython / loaded_api

Function loaded_api

IPython/external/qt_loaders.py:91–117  ·  view source on GitHub ↗

Return which API is loaded, if any If this returns anything besides None, importing any other Qt binding is unsafe. Returns ------- None, 'pyside6', 'pyqt6', 'pyside2', 'pyside', 'pyqt', 'pyqt5', 'pyqtv1'

()

Source from the content-addressed store, hash-verified

89
90
91def loaded_api():
92 """Return which API is loaded, if any
93
94 If this returns anything besides None,
95 importing any other Qt binding is unsafe.
96
97 Returns
98 -------
99 None, 'pyside6', 'pyqt6', 'pyside2', 'pyside', 'pyqt', 'pyqt5', 'pyqtv1'
100 """
101 if sys.modules.get("PyQt6.QtCore"):
102 return QT_API_PYQT6
103 elif sys.modules.get("PySide6.QtCore"):
104 return QT_API_PYSIDE6
105 elif sys.modules.get("PyQt5.QtCore"):
106 return QT_API_PYQT5
107 elif sys.modules.get("PySide2.QtCore"):
108 return QT_API_PYSIDE2
109 elif sys.modules.get("PyQt4.QtCore"):
110 if qtapi_version() == 2:
111 return QT_API_PYQT
112 else:
113 return QT_API_PYQTv1
114 elif sys.modules.get("PySide.QtCore"):
115 return QT_API_PYSIDE
116
117 return None
118
119
120def has_binding(api):

Callers 5

set_qt_apiFunction · 0.90
get_optionsFunction · 0.90
find_specMethod · 0.85
can_importFunction · 0.85
load_qtFunction · 0.85

Calls 2

qtapi_versionFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…