8000 Merge pull request #16804 from anntzer/mathtextglue · matplotlib/matplotlib@dfc830d · GitHub
[go: up one dir, main page]

Skip to content

Commit dfc830d

Browse files
authored
Merge pull request #16804 from anntzer/mathtextglue
MNT: Deprecate some mathtext glue helper classes.
2 parents 5304c45 + 601322e commit dfc830d

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,9 @@ and ``funchspace`` methods of `.widgets.SubplotTool` are deprecated.
364364
The ``axleft``, ``axright``, ``axbottom``, ``axtop``, ``axwspace``, and
365365
``axhspace`` attributes of `.widgets.SubplotTool` are deprecated. Access the
366366
``ax`` attribute of the corresponding slider, if needed.
367+
368+
mathtext ``Glue`` helper classes
369+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
370+
The ``Fil``, ``Fill``, ``Filll``, ``NegFil``, ``NegFill``, ``NegFilll``, and
371+
``SsGlue`` classes in the :mod:`matplotlib.mathtext` module are deprecated.
372+
As an alternative, directly construct glue instances with ``Glue("fil")``, etc.

lib/matplotlib/mathtext.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,36 +1932,43 @@ def factory(cls, glue_type):
19321932
# Some convenient ways to get common kinds of glue
19331933

19341934

1935+
@cbook.deprecated("3.3", alternative="Glue('fil')")
19351936
class Fil(Glue):
19361937
def __init__(self):
19371938
Glue.__init__(self, 'fil')
19381939

19391940

1941+
@cbook.deprecated("3.3", alternative="Glue('fill')")
19401942
class Fill(Glue):
19411943
def __init__(self):
19421944
Glue.__init__(self, 'fill')
19431945

19441946

1947+
@cbook.deprecated("3.3", alternative="Glue('filll')")
19451948
class Filll(Glue):
19461949
def __init__(self):
19471950
Glue.__init__(self, 'filll')
19481951

19491952

1953+
@cbook.deprecated("3.3", alternative="Glue('neg_fil')")
19501954
class NegFil(Glue):
19511955
def __init__(self):
19521956
Glue.__init__(self, 'neg_fil')
19531957

19541958

1959+
@cbook.deprecated("3.3", alternative="Glue('neg_fill')")
19551960
class NegFill(Glue):
19561961
def __init__(self):
19571962
Glue.__init__(self, 'neg_fill')
19581963

19591964

1965+
@cbook.deprecated("3.3", alternative="Glue('neg_filll')")
19601966
class NegFilll(Glue):
19611967
def __init__(self):
19621968
Glue.__init__(self, 'neg_filll')
19631969

19641970

1971+
@cbook.deprecated("3.3", alternative="Glue('ss')")
19651972
class SsGlue(Glue):
19661973
def __init__(self):
19671974
Glue.__init__(self, 'ss')
@@ -1974,8 +1981,7 @@ class HCentered(Hlist):
19741981
"""
19751982

19761983
def __init__(self, elements):
1977-
Hlist.__init__(self, [SsGlue()] + elements + [SsGlue()],
1978-
do_kern=False)
1984+
super().__init__([Glue('ss'), *elements, Glue('ss')], do_kern=False)
19791985

19801986

19811987
class VCentered(Vlist):
@@ -1985,7 +1991,7 @@ class VCentered(Vlist):
19851991
"""
19861992

19871993
def __init__(self, elements):
1988-
Vlist.__init__(self, [SsGlue()] + elements + [SsGlue()])
1994+
super().__init__([Glue('ss'), *elements, Glue('ss')])
19891995

19901996

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

32183224
# Put a little extra space to the left and right of the body
3219-
padded_body = Hlist([Hbox(thickness * 2.0),
3220-
body,
3221-
Hbox(thickness * 2.0)])
3222-
rightside = Vlist([Hrule(state),
3223-
Fill(),
3224-
padded_body])
3225+
padded_body = Hlist([Hbox(2 * thickness), body, Hbox(2 * thickness)])
3226+
rightside = Vlist([Hrule(state), Glue('fill'), padded_body])
32253227
# Stretch the glue between the hrule and the body
32263228
rightside.vpack(height + (state.fontsize * state.dpi) / (100.0 * 12.0),
32273229
'exactly', depth)
@@ -3259,9 +3261,7 @@ def overline(self, s, loc, toks):
32593261
depth = body.depth + body.shift_amount
32603262

32613263
# Place overline above body
3262-
rightside = Vlist([Hrule(state),
3263-
Fill(),
3264-
Hlist([body])])
3264+
rightside = Vlist([Hrule(state), Glue('fill'), Hlist([body])])
32653265

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

0 commit comments

Comments
 (0)
0