|
24 | 24 | import numpy as np |
25 | 25 | from PIL import Image |
26 | 26 |
|
27 | | -from matplotlib import _api, colors as mcolors, rcParams, _mathtext |
| 27 | +from matplotlib import ( |
| 28 | + _api, colors as mcolors, rcParams, _mathtext, _mathtext_data) |
28 | 29 | from matplotlib.ft2font import FT2Image, LOAD_NO_HINTING |
29 | 30 | from matplotlib.font_manager import FontProperties |
30 | | -# Backcompat imports, all are deprecated as of 3.4. |
31 | | -from matplotlib._mathtext import ( # noqa: F401 |
32 | | - SHRINK_FACTOR, GROW_FACTOR, NUM_SIZE_LEVELS) |
33 | | -from matplotlib._mathtext_data import ( # noqa: F401 |
34 | | - latex_to_bakoma, latex_to_cmex, latex_to_standard, stix_virtual_fonts, |
35 | | - tex2uni) |
36 | 31 |
|
37 | 32 | _log = logging.getLogger(__name__) |
38 | 33 |
|
39 | 34 |
|
| 35 | +@_api.caching_module_getattr |
| 36 | +class __getattr__: |
| 37 | + locals().update({ |
| 38 | + name: _api.deprecated("3.4")( |
| 39 | + property(lambda self, _mod=mod, _name=name: getattr(_mod, _name))) |
| 40 | + for mod, names in [ |
| 41 | + (_mathtext, ["SHRINK_FACTOR", "GROW_FACTOR", "NUM_SIZE_LEVELS"]), |
| 42 | + (_mathtext_data, [ |
| 43 | + "latex_to_bakoma", "latex_to_cmex", "latex_to_standard", |
| 44 | + "stix_virtual_fonts", "tex2uni"])] |
| 45 | + for name in names}) |
| 46 | + |
| 47 | + |
40 | 48 | get_unicode_index = _mathtext.get_unicode_index |
41 | 49 | get_unicode_index.__module__ = __name__ |
42 | 50 |
|
|
0 commit comments