Commit to a particular API, and trigger ImportErrors on subsequent dangerous imports
(api)
| 61 | |
| 62 | |
| 63 | def commit_api(api): |
| 64 | """Commit to a particular API, and trigger ImportErrors on subsequent |
| 65 | dangerous imports""" |
| 66 | |
| 67 | if api == QT_API_PYSIDE2: |
| 68 | ID.forbid('PySide') |
| 69 | ID.forbid('PyQt4') |
| 70 | ID.forbid('PyQt5') |
| 71 | elif api == QT_API_PYSIDE: |
| 72 | ID.forbid('PySide2') |
| 73 | ID.forbid('PyQt4') |
| 74 | ID.forbid('PyQt5') |
| 75 | elif api == QT_API_PYQT5: |
| 76 | ID.forbid('PySide2') |
| 77 | ID.forbid('PySide') |
| 78 | ID.forbid('PyQt4') |
| 79 | else: # There are three other possibilities, all representing PyQt4 |
| 80 | ID.forbid('PyQt5') |
| 81 | ID.forbid('PySide2') |
| 82 | ID.forbid('PySide') |
| 83 | |
| 84 | |
| 85 | def loaded_api(): |