MCPcopy Create free account
hub / github.com/LabPy/lantz / can_import

Function can_import

lantz/utils/qt_loaders.py:170–179  ·  view source on GitHub ↗

Safely query whether an API is importable, without importing it

(api)

Source from the content-addressed store, hash-verified

168
169
170def can_import(api):
171 """Safely query whether an API is importable, without importing it"""
172 if not has_binding(api):
173 return False
174
175 current = loaded_api()
176 if api == QT_API_PYQT_DEFAULT:
177 return current in [QT_API_PYQT, QT_API_PYQTv1, None]
178 else:
179 return current in [api, None]
180
181
182def 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