Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8025c9

Browse files
committed
Deprecate public access to many mathtext internals.
For most of these classes, there isn't really a "reasonable" way to use them via public API anyways. - `Fonts` subclasses are looked up via the private `_font_type_mapping` and extending that would require adding new entries for `rcParams["mathtext.fontset"]`. - `FontConstantsBase`\s are looked up via the private `_font_constant_mapping`. - `Node` and its subclasses are clearly internal constructs of the mathtext parser (technically, they are visible to `MathtextBackend` subclasses when their `render` method is called, but one cannot register new `MathtextBackend` subclasses either as that happens via the private `_backend_mapping`). - `Ship` is just an implementation detail for the `ship` callable. - `Parser` is set up and driven via the (still public) `MathTextParser`. - `Error`, `SHRINK_FACTOR`, `GROW_FACTOR`, `NUM_SIZE_LEVELS` are helpers for the parser. - `latex_to_*`, `stix_virtual_fonts`, `tex2uni` are helper lookup tables for the fonts. (`tex2uni` stays indirectly accessible via the `get_unicode_index`, which basically performs lookup on it.) Making these private should simplify the implementation of various improvements to mathtext, e.g. better support for math fonts, as well as code cleanups.
1 parent d9214de commit d8025c9

File tree

4 files changed

+3014
-2958
lines changed

4 files changed

+3014
-2958
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ per-file-ignores =
5050

5151
lib/matplotlib/__init__.py: F401
5252
lib/matplotlib/_cm.py: E202, E203, E302
53+
lib/matplotlib/_mathtext.py: E221, E251
5354
lib/matplotlib/_mathtext_data.py: E203, E261
5455
lib/matplotlib/animation.py: F401
5556
lib/matplotlib/axes/__init__.py: F401, F403
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Deprecation of mathtext internals
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The following API elements previously exposed by the :mod:`.mathtext` module
4+
are considered to be implementation details of and public access to them is
5+
deprecated: ``Fonts`` and all its subclasses, ``FontConstantsBase`` and all its
6+
subclasses, ``Node`` and all its subclasses, ``Ship``, ``Error``, ``Parser``,
7+
``SHRINK_FACTOR``, ``GROW_FACTOR``, ``NUM_SIZE_LEVELS``, ``latex_to_bakoma``,
8+
``latex_to_cmex``, ``latex_to_standard``, ``stix_virtual_fonts``, ``tex2uni``.

0 commit comments

Comments
 (0)