Safely query whether an API is importable, without importing it
(api)
| 180 | |
| 181 | |
| 182 | def can_import(api): |
| 183 | """Safely query whether an API is importable, without importing it""" |
| 184 | if not has_binding(api): |
| 185 | return False |
| 186 | |
| 187 | current = loaded_api() |
| 188 | if api == QT_API_PYQT_DEFAULT: |
| 189 | return current in [QT_API_PYQT6, None] |
| 190 | else: |
| 191 | return current in [api, None] |
| 192 | |
| 193 | |
| 194 | def import_pyqt4(version=2): |
no test coverage detected
searching dependent graphs…