Skip to content

Commit 20c92ae

Browse files
committed
Re-add a deprecated cbook.deprecation module for backward compatibility
1 parent 01910b5 commit 20c92ae

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``matplotlib.cbook.deprecation`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The module is considered internal and will be removed from the public API.

lib/matplotlib/_api/deprecation.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ class MatplotlibDeprecationWarning(UserWarning):
1717
"""
1818

1919

20-
# mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead.
21-
mplDeprecation = MatplotlibDeprecationWarning
22-
23-
2420
def _generate_deprecation_warning(
2521
since, message='', name='', alternative='', pending=False, obj_type='',
2622
addendum='', *, removal=''):
@@ -105,7 +101,7 @@ def warn_deprecated(
105101
warning = _generate_deprecation_warning(
106102
since, message, name, alternative, pending, obj_type, addendum,
107103
removal=removal)
108-
from . import _warn_external
104+
from ..cbook import _warn_external
109105
_warn_external(warning, category=MatplotlibDeprecationWarning)
110106

111107

lib/matplotlib/cbook/deprecation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# imports are for backward compatibility
2+
from matplotlib._api.deprecation import (
3+
MatplotlibDeprecationWarning, warn_deprecated, deprecated)
4+
5+
# mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead.
6+
mplDeprecation = MatplotlibDeprecationWarning
7+
8+
warn_deprecated("3.4",
9+
"The module matplotlib.cbook.deprecation is considered "
10+
"internal and it will be made private in the future.")

0 commit comments

Comments
 (0)