| 784 | self._set(key, cval) |
| 785 | |
| 786 | def __getitem__(self, key): |
| 787 | # In theory, this should only ever be used after the global rcParams |
| 788 | # has been set up, but better be safe e.g. in presence of breakpoints. |
| 789 | if key == "backend" and self is globals().get("rcParams"): |
| 790 | val = self._get(key) |
| 791 | if val is rcsetup._auto_backend_sentinel: |
| 792 | from matplotlib import pyplot as plt |
| 793 | plt.switch_backend(rcsetup._auto_backend_sentinel) |
| 794 | return self._get(key) |
| 795 | |
| 796 | def _get_backend_or_none(self): |
| 797 | """Get the requested backend, if any, without triggering resolution.""" |