Skip to content

Commit 3fc0448

Browse files
authored
Merge pull request #20944 from anntzer/mtd
Switch documented deprecations in mathtext by `__getattr__` deprecations
2 parents 47077d1 + d1689df commit 3fc0448

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lib/matplotlib/mathtext.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,27 @@
2424
import numpy as np
2525
from PIL import Image
2626

27-
from matplotlib import _api, colors as mcolors, rcParams, _mathtext
27+
from matplotlib import (
28+
_api, colors as mcolors, rcParams, _mathtext, _mathtext_data)
2829
from matplotlib.ft2font import FT2Image, LOAD_NO_HINTING
2930
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)
3631

3732
_log = logging.getLogger(__name__)
3833

3934

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+
4048
get_unicode_index = _mathtext.get_unicode_index
4149
get_unicode_index.__module__ = __name__
4250

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy