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

Skip to content

Commit 9fced56

Browse files
committed
Deprecate incorrect import locations
1 parent d7ffff2 commit 9fced56

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Alternative import location for ``TextPath`` and ``AxislineStyle``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
These two classes have historically sometimes been imported from incorrect
5+
locations. This is now deprecated and `.TextPath` should be imported from
6+
`matplotlib.textpath`, while `AxislineStyle` should be imported from
7+
`mpl_toolkit.axisartist.axisline_style`.

lib/matplotlib/text.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
from .artist import Artist
1616
from .font_manager import FontProperties
1717
from .patches import FancyArrowPatch, FancyBboxPatch, Rectangle
18-
from .textpath import TextPath # Unused, but imported by others.
18+
from .textpath import TextPath as _TextPath # Unused, but imported by others.
1919
from .transforms import (
2020
Affine2D, Bbox, BboxBase, BboxTransformTo, IdentityTransform, Transform)
2121

2222

2323
_log = logging.getLogger(__name__)
2424

2525

26+
@_api.deprecated("3.6", message="Since %(since)s, %(name)s should be imported "
27+
"from its correct module: matplotlib.textpath")
28+
class TextPath(_TextPath):
29+
pass
30+
31+
2632
@_api.deprecated("3.6")
2733
def get_rotation(rotation):
2834
"""

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
DrawingArea, TextArea, VPacker)
44
from matplotlib.patches import (Rectangle, Ellipse, ArrowStyle,
55
FancyArrowPatch, PathPatch)
6-
from matplotlib.text import TextPath
6+
from matplotlib.textpath import TextPath
77

88
__all__ = ['AnchoredDrawingArea', 'AnchoredAuxTransformBox',
99
'AnchoredEllipse', 'AnchoredSizeBar', 'AnchoredDirectionArrows']

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,17 @@
4646
import matplotlib.axes as maxes
4747
from matplotlib.path import Path
4848
from mpl_toolkits.axes_grid1 import mpl_axes
49-
from .axisline_style import AxislineStyle
49+
from .axisline_style import AxislineStyle as _AxislineStyle
5050
from .axis_artist import AxisArtist, GridlinesCollection
5151

5252

53+
@_api.deprecated("3.6", message="Since %(since)s, %(name)s should be imported "
54+
"from its correct module: "
55+
"mpl_toolkits.axisartist.axisline_style")
56+
class AxislineStyle(_AxislineStyle):
57+
pass
58+
59+
5360
class AxisArtistHelper:
5461
"""
5562
AxisArtistHelper should define

0 commit comments

Comments
 (0)