Skip to content

Commit ed9b7b5

Browse files
committed
Strip out the (unused, complex) rcParams deprecation machinery.
1 parent 71f5cf3 commit ed9b7b5

File tree

1 file changed

+2
-45
lines changed

1 file changed

+2
-45
lines changed

lib/matplotlib/__init__.py

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -638,18 +638,6 @@ def gen_candidates():
638638
"install is broken")
639639

640640

641-
# rcParams deprecated and automatically mapped to another key.
642-
# Values are tuples of (version, new_name, f_old2new, f_new2old).
643-
_deprecated_map = {}
644-
# rcParams deprecated; some can manually be mapped to another key.
645-
# Values are tuples of (version, new_name_or_None).
646-
_deprecated_ignore_map = {}
647-
# rcParams deprecated; can use None to suppress warnings; remain actually
648-
# listed in the rcParams.
649-
# Values are tuples of (version,)
650-
_deprecated_remain_as_none = {}
651-
652-
653641
@_docstring.Substitution(
654642
"\n".join(map("- {}".format, sorted(rcsetup._validators, key=str.lower)))
655643
)
@@ -747,21 +735,7 @@ def _ensure_has_backend(self):
747735

748736
def __setitem__(self, key, val):
749737
try:
750-
if key in _deprecated_map:
751-
version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
752-
_api.warn_deprecated(
753-
version, name=key, obj_type="rcparam", alternative=alt_key)
754-
key = alt_key
755-
val = alt_val(val)
756-
elif key in _deprecated_remain_as_none and val is not None:
757-
version, = _deprecated_remain_as_none[key]
758-
_api.warn_deprecated(version, name=key, obj_type="rcparam")
759-
elif key in _deprecated_ignore_map:
760-
version, alt_key = _deprecated_ignore_map[key]
761-
_api.warn_deprecated(
762-
version, name=key, obj_type="rcparam", alternative=alt_key)
763-
return
764-
elif key == 'backend':
738+
if key == 'backend':
765739
if val is rcsetup._auto_backend_sentinel:
766740
if 'backend' in self:
767741
return
@@ -776,21 +750,9 @@ def __setitem__(self, key, val):
776750
f"a list of valid parameters)") from err
777751

778752
def __getitem__(self, key):
779-
if key in _deprecated_map:
780-
version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
781-
_api.warn_deprecated(
782-
version, name=key, obj_type="rcparam", alternative=alt_key)
783-
return inverse_alt(self._get(alt_key))
784-
785-
elif key in _deprecated_ignore_map:
786-
version, alt_key = _deprecated_ignore_map[key]
787-
_api.warn_deprecated(
788-
version, name=key, obj_type="rcparam", alternative=alt_key)
789-
return self._get(alt_key) if alt_key else None
790-
791753
# In theory, this should only ever be used after the global rcParams
792754
# has been set up, but better be safe e.g. in presence of breakpoints.
793-
elif key == "backend" and self is globals().get("rcParams"):
755+
if key == "backend" and self is globals().get("rcParams"):
794756
val = self._get(key)
795757
if val is rcsetup._auto_backend_sentinel:
796758
from matplotlib import pyplot as plt
@@ -938,11 +900,6 @@ def _rc_params_in_file(fname, transform=lambda x: x, fail_on_error=False):
938900
except Exception as msg:
939901
_log.warning('Bad value in file %r, line %d (%r): %s',
940902
fname, line_no, line.rstrip('\n'), msg)
941-
elif key in _deprecated_ignore_map:
942-
version, alt_key = _deprecated_ignore_map[key]
943-
_api.warn_deprecated(
944-
version, name=key, alternative=alt_key, obj_type='rcparam',
945-
addendum="Please update your matplotlibrc.")
946903
else:
947904
# __version__ must be looked up as an attribute to trigger the
948905
# module-level __getattr__.

0 commit comments

Comments
 (0)