| 768 | dict.setdefault(self, "backend", rcsetup._auto_backend_sentinel) |
| 769 | |
| 770 | def __setitem__(self, key, val): |
| 771 | if (key == "backend" |
| 772 | and val is rcsetup._auto_backend_sentinel |
| 773 | and "backend" in self): |
| 774 | return |
| 775 | valid_key = _api.getitem_checked( |
| 776 | self.validate, rcParam=key, _error_cls=KeyError |
| 777 | ) |
| 778 | try: |
| 779 | cval = valid_key(val) |
| 780 | except ValueError as ve: |
| 781 | raise ValueError(f"Key {key}: {ve}") from None |
| 782 | if key in {"text.hinting_factor", "text.kerning_factor"} and cval is not None: |
| 783 | _api.warn_deprecated("3.11", name=key, obj_type="rcParam") |
| 784 | self._set(key, cval) |
| 785 | |
| 786 | def __getitem__(self, key): |
| 787 | # In theory, this should only ever be used after the global rcParams |