Safely query whether an API is importable, without importing it
(api)
| 163 | |
| 164 | |
| 165 | def 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 | |
| 177 | def import_pyqt4(version=2): |
no test coverage detected