MCPcopy Create free account
hub / github.com/ipython/ipython / can_import

Function can_import

IPython/external/qt_loaders.py:165–174  ·  view source on GitHub ↗

Safely query whether an API is importable, without importing it

(api)

Source from the content-addressed store, hash-verified

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