Skip to content

Switch documented deprecations in mathtext by __getattr__ deprecations #20944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down