MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / can_import

Function can_import

pydev_ipython/qt_loaders.py:192–201  ·  view source on GitHub ↗

Safely query whether an API is importable, without importing it

(api)

Source from the content-addressed store, hash-verified

190
191
192def can_import(api):
193 """Safely query whether an API is importable, without importing it"""
194 if not has_binding(api):
195 return False
196
197 current = loaded_api()
198 if api == QT_API_PYQT_DEFAULT:
199 return current in [QT_API_PYQT, QT_API_PYQTv1, QT_API_PYQT5, QT_API_PYQT6, None]
200 else:
201 return current in [api, None]
202
203
204def import_pyqt4(version=2):

Callers 1

load_qtFunction · 0.85

Calls 2

has_bindingFunction · 0.85
loaded_apiFunction · 0.85

Tested by

no test coverage detected