From d1689df82b2d164f6d99087168f2e1100edc5f6a Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 29 Aug 2021 20:56:55 +0200 Subject: [PATCH] Switch documented deprecations in mathtext by `__getattr__` deprecations --- lib/matplotlib/mathtext.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index 656aeb64dc0d..ce6de4cdee56 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -24,19 +24,27 @@ import numpy as np from PIL import Image -from matplotlib import _api, colors as mcolors, rcParams, _mathtext +from matplotlib import ( + _api, colors as mcolors, rcParams, _mathtext, _mathtext_data) from matplotlib.ft2font import FT2Image, LOAD_NO_HINTING from matplotlib.font_manager import FontProperties -# Backcompat imports, all are deprecated as of 3.4. -from matplotlib._mathtext import ( # noqa: F401 - SHRINK_FACTOR, GROW_FACTOR, NUM_SIZE_LEVELS) -from matplotlib._mathtext_data import ( # noqa: F401 - latex_to_bakoma, latex_to_cmex, latex_to_standard, stix_virtual_fonts, - tex2uni) _log = logging.getLogger(__name__) +@_api.caching_module_getattr +class __getattr__: + locals().update({ + name: _api.deprecated("3.4")( + property(lambda self, _mod=mod, _name=name: getattr(_mod, _name))) + for mod, names in [ + (_mathtext, ["SHRINK_FACTOR", "GROW_FACTOR", "NUM_SIZE_LEVELS"]), + (_mathtext_data, [ + "latex_to_bakoma", "latex_to_cmex", "latex_to_standard", + "stix_virtual_fonts", "tex2uni"])] + for name in names}) + + get_unicode_index = _mathtext.get_unicode_index get_unicode_index.__module__ = __name__ 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