Skip to content

Deprecate PackerBase #14526

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

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/2019-06-10-TH.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Deprecations
````````````

The class `matplotlib.offsetbox.PackerBase` is deprecated. It is considered
an implementation detail and will become private in future versions.
14 changes: 10 additions & 4 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def draw(self, renderer):
self.stale = False


class PackerBase(OffsetBox):
class _PackerBase(OffsetBox):
def __init__(self, pad=None, sep=None, width=None, height=None,
align=None, mode=None,
children=None):
Expand Down Expand Up @@ -307,7 +307,13 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
self._children = children


class VPacker(PackerBase):
class PackerBase(_PackerBase):
def __init__(self, *args, **kwargs):
cbook.warn_deprecated("3.2", name='PackerBase', obj_type='class')
self.super(*args, *kwargs)


class VPacker(_PackerBase):
"""
The VPacker has its children packed vertically. It automatically
adjust the relative positions of children in the drawing time.
Expand Down Expand Up @@ -356,7 +362,7 @@ def get_extent_offsets(self, renderer):

if self.width is not None:
for c in self.get_visible_children():
if isinstance(c, PackerBase) and c.mode == "expand":
if isinstance(c, _PackerBase) and c.mode == "expand":
c.set_width(self.width)

whd_list = [c.get_extent(renderer)
Expand All @@ -383,7 +389,7 @@ def get_extent_offsets(self, renderer):
list(zip(xoffsets, yoffsets)))


class HPacker(PackerBase):
class HPacker(_PackerBase):
"""
The HPacker has its children packed horizontally. It automatically
adjusts the relative positions of children at draw time.
Expand Down