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

Skip to content

Commit 75c26f2

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, which can only be called on a `Node` or in a `MathtextBackend`, neither of which are really public per the above. - `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 5584ba7 commit 75c26f2

File tree

7 files changed

+3211
-3035
lines changed

7 files changed

+3211
-3035
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

doc/api/mathtext_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
:members:
1010
:undoc-members:
1111
:show-inheritance:
12+
:exclude-members: Box, Char, ComputerModernFontConstants, DejaVuSansFontConstants, DejaVuSerifFontConstants, FontConstantsBase, Fonts, Glue, Kern, Node, Parser, STIXFontConstants, STIXSansFontConstants, Ship, StandardPsFonts, TruetypeFonts
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*facename* parameter of `.mathtext.Fonts.render_glyph`
2-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1+
*facename* parameter of ``mathtext.Fonts.render_glyph``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
This parameter was renamed to *font* for consistency with the rest of the
4-
`.Fonts` API.
4+
``Fonts`` API.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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``, ``ship``, ``Error``,
7+
``Parser``, ``SHRINK_FACTOR``, ``GROW_FACTOR``, ``NUM_SIZE_LEVELS``,
8+
``latex_to_bakoma``, ``latex_to_cmex``, ``latex_to_standard``,
9+
``stix_virtual_fonts``, ``tex2uni``.

0 commit comments

Comments
 (0)