8000 Kill attributes that are never used/updated. by anntzer · Pull Request #13716 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
8000

Kill attributes that are never used/updated. #13716

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 24, 2019
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
9 changes: 9 additions & 0 deletions doc/api/next_api_changes/2019-03-18-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Deprecations
````````````

The following (unused and never updated) attributes are deprecated:
``NavigationToolbar2QT.buttons``, ``Line2D.verticalOffset``, ``Quiver.keytext``,
``Quiver.keyvec``, ``SpanSelector.buttonDown``.

The ``interp_at_native`` parameter to ``BboxImage``, which has no effect since
Matplotlib 2.0, is deprecated.
1 change: 0 additions & 1 deletion lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ def __init__(self, filename, metadata=None):
self.fontNames = {} # maps filenames to internal font names
self.nextFont = 1 # next free internal font name
self.dviFontInfo = {} # maps dvi font names to embedding information
self._texFontMap = None # maps TeX font names to PostScript fonts
# differently encoded Type-1 fonts may share the same descriptor
self.type1Descriptors = {}
self.used_characters = {}
Expand Down
7 changes: 5 additions & 2 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,6 @@ def _init_toolbar(self):
'Customize', self.edit_parameters)
a.setToolTip('Edit axis, curve and image parameters')

self.buttons = {}

# Add the x,y location widget at the right side of the toolbar
# The stretch factor is 1 which means any resizing of the toolbar
# will resize this label instead of the buttons.
Expand All @@ -736,6 +734,11 @@ def _init_toolbar(self):
self.setIconSize(QtCore.QSize(24, 24))
self.layout().setSpacing(12)

@cbook.deprecated("3.1")
@property
def buttons(self):
return {}

if is_pyqt5():
# For some reason, self.setMinimumHeight doesn't seem to carry over to
# the actual sizeHint, so override it instead in order to make the
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
self.basename = basename
self._imaged = {}
self._clipd = OrderedDict()
self._char_defs = {}
self._markers = {}
self._path_collection_id = 0
self._imaged = {}
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/backend_wx.py
E864
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ def __init__(self, bitmap, renderer):
self.gfx_ctx = gfx_ctx
self._pen = wx.Pen('BLACK', 1, wx.SOLID)
gfx_ctx.SetPen(self._pen)
self._style = wx.SOLID
self.renderer = renderer

def select(self):
Expand Down Expand Up @@ -1595,7 +1594,6 @@ def __init__(self, toolmanager, parent, style=wx.TB_HORIZONTAL):
wx.ToolBar.__init__(self, parent, -1, style=style)
self._toolitems = {}
self._groups = {}
self._last = None

def add_toolitem(
self, name, group, position, image_file, description, toggle):
Expand Down Expand Up @@ -1624,7 +1622,6 @@ def handler(event):
else:
control.Bind(wx.EVT_LEFT_DOWN, handler)

self._last = tool
self._toolitems.setdefault(name, [])
group.insert(position, tool)
self._toolitems[name].append((tool, handler))
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,6 @@ def _process_args(self, *args, **kwargs):
self.allkinds = len(args) > 2 and args[2] or None
self.zmax = np.max(self.levels)
self.zmin = np.min(self.levels)
self._auto = False

# Check lengths of levels and allsegs.
if self.filled:
Expand Down Expand Up @@ -1152,7 +1151,6 @@ def _autolev(self, N):
one contour line, but two filled regions, and therefore
three levels to provide boundaries for both regions.
"""
self._auto = True
if self.locator is None:
if self.logscale:
self.locator = ticker.LogLocator()
Expand Down Expand Up @@ -1186,7 +1184,6 @@ def _contour_level_args(self, z, args):
"""
Determine the contour levels and store in self.levels.
"""
self._auto = False
if self.levels is None:
if len(args) == 0:
levels_arg = 7 # Default, hard-wired.
Expand Down
18 changes: 8 additions & 10 deletions lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,8 @@ def set_data(self, A):

class BboxImage(_ImageBase):
"""The Image class whose size is determined by the given bbox."""

@cbook._delete_parameter("3.1", "interp_at_native")
def __init__(self, bbox,
cmap=None,
norm=None,
Expand All @@ -1273,16 +1275,7 @@ def __init__(self, bbox,
cmap is a colors.Colormap instance
norm is a colors.Normalize instance to map luminance to 0-1

interp_at_native is a flag that determines whether or not
interpolation should still be applied when the image is
displayed at its native resolution. A common use case for this
is when displaying an image for annotational purposes; it is
treated similarly to Photoshop (interpolation is only used when
displaying the image at non-native resolutions).


kwargs are an optional list of Artist keyword args

"""
super().__init__(
None,
Expand All @@ -1297,9 +1290,14 @@ def __init__(self, bbox,
)

self.bbox = bbox
self.interp_at_native = interp_at_native
self._interp_at_native = interp_at_native
self._transform = IdentityTransform()

@cbook.deprecated("3.1")
@property
def interp_at_native(self):
return self._interp_at_native

def get_transform(self):
return self._transform

Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ def __init__(self, parent, handles, labels,
title_fontsize = rcParams['legend.title_fontsize']
tprop = FontProperties(size=title_fontsize)
self.set_title(title, prop=tprop)
self._last_fontsize_points = self._fontsize
self._draggable = None

def _set_artist_props(self, a):
Expand Down
7 changes: 5 additions & 2 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ def __init__(self, xdata, ydata,
self.set_markeredgecolor(markeredgecolor)
self.set_markeredgewidth(markeredgewidth)

self.verticalOffset = None

# update kwargs before updating data to give the caller a
# chance to init axes (and hence unit support)
self.update(kwargs)
Expand All @@ -424,6 +422,11 @@ def __init__(self, xdata, ydata,

self.set_data(xdata, ydata)

@cbook.deprecated("3.1")
@property
def verticalOffset(self):
return None

def contains(self, mouseevent):
"""
Test whether the mouse event occurred on the line. The pick
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def __init__(self,
self.set_hatch(hatch)
self.set_capstyle(capstyle)
self.set_joinstyle(joinstyle)
self._combined_transform = transforms.IdentityTransform()

if len(kwargs):
self.update(kwargs)
Expand Down
10 changes: 0 additions & 10 deletions lib/matplotlib/patheffects.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ def __init__(self, offset=(2, -2),
#: The dictionary of keywords to update the graphics collection with.
self._gc = kwargs

#: The offset transform object. The offset isn't calculated yet
#: as we don't know how big the figure will be in pixels.
self._offset_tran = mtransforms.Affine2D()

def draw_path(self, renderer, gc, tpath, affine, rgbFace):
"""
Overrides the standard draw_path to add the shadow offset and
Expand Down Expand Up @@ -313,7 +309,6 @@ def __init__(self, offset=(2, -2),
**kwargs
Extra keywords are stored and passed through to
:meth:`AbstractPathEffect._update_gc`.

"""
super().__init__(offset)
if shadow_color is None:
Expand All @@ -322,14 +317,9 @@ def __init__(self, offset=(2, -2),
self._shadow_color = mcolors.to_rgba(shadow_color)
self._alpha = alpha
self._rho = rho

#: The dictionary of keywords to update the graphics collection with.
self._gc = kwargs

#: The offset transform object. The offset isn't calculated yet
#: as we don't know how big the figure will be in pixels.
self._offset_tran = mtransforms.Affine2D()

def draw_path(self, renderer, gc, tpath, affine, rgbFace):
"""
Overrides the standard draw_path to add the shadow offset and
Expand Down
13 changes: 10 additions & 3 deletions lib/matplotlib/quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,6 @@ def __init__(self, ax, *args,
self.set_UVC(U, V, C)
self._initialized = False

self.keyvec = None
self.keytext = None

# try to prevent closure over the real self
weak_self = weakref.ref(self)

Expand All @@ -499,6 +496,16 @@ def on_dpi_change(fig):
def color(self):
return self.get_facecolor()

@cbook.deprecated("3.1")
@property
def keyvec(self):
return None

@cbook.deprecated("3.1")
@property
def keytext(self):
return None

def remove(self):
"""
Overload the remove method
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,8 @@ def __init__(self, ax, loc=None, bbox=None, **kwargs):
# use axes coords
self.set_transform(ax.transAxes)

self._texts = []
self._cells = {}
self._edges = None
self._autoRows = []
self._autoColumns = []
self._autoFontsize = True
self.update(kwargs)
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/testing/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def _read_until(self, terminator):
class _GSConverter(_Converter):
def __call__(self, orig, dest):
if not self._proc:
self._stdout = TemporaryFile()
self._proc = subprocess.Popen(
[mpl._get_executable_info("gs").executable,
"-dNOPAUSE", "-sDEVICE=png16m"],
Expand Down
6 changes: 5 additions & 1 deletion lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,6 @@ def _release(self, event):
"""on button release event"""
if self.pressv is None:
return
self.buttonDown = False

self.rect.set_visible(False)

Expand Down Expand Up @@ -1865,6 +1864,11 @@ def _release(self, event):
self.pressv = None
return False

@cbook.deprecated("3.1")
@property
def buttonDown(self):
return False

def _onmove(self, event):
"""on motion notify event"""
if self.pressv is None:
Expand Down
0