Constraints placed on an imported matplotlib.
(mpl)
| 64 | |
| 65 | |
| 66 | def matplotlib_options(mpl): |
| 67 | """Constraints placed on an imported matplotlib.""" |
| 68 | if mpl is None: |
| 69 | return |
| 70 | backend = mpl.rcParams.get('backend', None) |
| 71 | if backend == 'Qt4Agg': |
| 72 | mpqt = mpl.rcParams.get('backend.qt4', None) |
| 73 | if mpqt is None: |
| 74 | return None |
| 75 | if mpqt.lower() == 'pyside': |
| 76 | return [QT_API_PYSIDE] |
| 77 | elif mpqt.lower() == 'pyqt4': |
| 78 | return [QT_API_PYQT_DEFAULT] |
| 79 | elif mpqt.lower() == 'pyqt4v2': |
| 80 | return [QT_API_PYQT] |
| 81 | raise ImportError("unhandled value for backend.qt4 from matplotlib: %r" % |
| 82 | mpqt) |
| 83 | elif backend == 'Qt5Agg': |
| 84 | mpqt = mpl.rcParams.get('backend.qt5', None) |
| 85 | if mpqt is None: |
| 86 | return None |
| 87 | if mpqt.lower() == 'pyqt5': |
| 88 | return [QT_API_PYQT5] |
| 89 | raise ImportError("unhandled value for backend.qt5 from matplotlib: %r" % |
| 90 | mpqt) |
| 91 | |
| 92 | def get_options(): |
| 93 | """Return a list of acceptable QT APIs, in decreasing order of preference.""" |
no test coverage detected
searching dependent graphs…