8000 Deprecate some mathtext glue helper classes. by anntzer · Pull Request #16804 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Deprecate some mathtext glue helper classes. #16804

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
Mar 18, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions doc/api/next_api_changes/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,9 @@ and ``funchspace`` methods of `.widgets.SubplotTool` are deprecated.
The ``axleft``, ``axright``, ``axbottom``, ``axtop``, ``axwspace``, and
``axhspace`` attributes of `.widgets.SubplotTool` are deprecated. Access the
``ax`` attribute of the corresponding slider, if needed.

mathtext ``Glue`` helper classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``Fil``, ``Fill``, ``Filll``, ``NegFil``, ``NegFill``, ``NegFilll``, and
``SsGlue`` classes in the :mod:`matplotlib.mathtext` module are deprecated.
As an alternative, directly construct glue instances with ``Glue("fil")``, etc.
24 changes: 12 additions & 12 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1932,36 +1932,43 @@ def factory(cls, glue_type):
# Some convenient ways to get common kinds of glue


@cbook.deprecated("3.3", alternative="Glue('fil')")
class Fil(Glue):
def __init__(self):
Glue.__init__(self, 'fil')


@cbook.deprecated("3.3", alternative="Glue('fill')")
class Fill(Glue):
def __init__(self):
Glue.__init__(self, 'fill')


@cbook.deprecated("3.3", alternative="Glue('filll')")
class Filll(Glue):
def __init__(self):
Glue.__init__(self, 'filll')


@cbook.deprecated("3.3", alternative="Glue('neg_fil')")
class NegFil(Glue):
def __init__(self):
Glue.__init__(self, 'neg_fil')


@cbook.deprecated("3.3", alternative="Glue('neg_fill')")
class NegFill(Glue):
def __init__(self):
Glue.__init__(self, 'neg_fill')


@cbook.deprecated("3.3", alternative="Glue('neg_filll')")
class NegFilll(Glue):
def __init__(self):
Glue.__init__(self, 'neg_filll')


@cbook.deprecated("3.3", alternative="Glue('ss')")
class SsGlue(Glue):
def __init__(self):
Glue.__init__(self, 'ss')
Expand All @@ -1974,8 +1981,7 @@ class HCentered(Hlist):
"""

def __init__(self, elements):
Hlist.__init__(self, [SsGlue()] + elements + [SsGlue()],
do_kern=False)
super().__init__([Glue('ss'), *elements, Glue('ss')], do_kern=False)


class VCentered(Hlist):
Expand All @@ -1985,7 +1991,7 @@ class VCentered(Hlist):
"""

def __init__(self, elements):
Vlist.__init__(self, [SsGlue()] + elements + [SsGlue()])
super().__init__([Glue('ss'), *elements, Glue('ss')])


class Kern(Node):
Expand Down Expand Up @@ -3216,12 +3222,8 @@ def sqrt(self, s, loc, toks):
depth = check.depth + check.shift_amount

# Put a little extra space to the left and right of the body
padded_body = Hlist([Hbox(thickness * 2.0),
body,
Hbox(thickness * 2.0)])
rightside = Vlist([Hrule(state),
Fill(),
padded_body])
padded_body = Hlist([Hbox(2 * thickness), body, Hbox(2 * thickness)])
rightside = Vlist([Hrule(state), Glue('fill'), padded_body])
# Stretch the glue between the hrule and the body
rightside.vpack(height + (state.fontsize * state.dpi) / (100.0 * 12.0),
'exactly', depth)
Expand Down Expand Up @@ -3259,9 +3261,7 @@ def overline(self, s, loc, toks):
depth = body.depth + body.shift_amount

# Place overline above body
rightside = Vlist([Hrule(state),
Fill(),
Hlist([body])])
rightside = Vlist([Hrule(state), Glue('fill'), Hlist([body])])

# Stretch the glue between the hrule and the body
rightside.vpack(height + (state.fontsize * state.dpi) / (100.0 * 12.0),
Expand Down
0