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

Skip to content

Commit 45cfd87

Browse files
authored
Merge pull request #16096 from timhoffm/depecate-unused
Deprecate unused parameters
2 parents de1a665 + d8f815d commit 45cfd87

File tree

9 files changed

+44
-10
lines changed

9 files changed

+44
-10
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,12 @@ them.
110110
``args_key`` and ``exec_key`` attributes of builtin `.MovieWriter`\s
111111
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112112
These attributes are deprecated.
113+
114+
Unused parameters
115+
~~~~~~~~~~~~~~~~~
116+
The following parameters do not have any effect and are deprecated:
117+
118+
- arbitrary keyword arguments to ``StreamplotSet``
119+
- parameter *quantize* of `.Path.cleaned()`
120+
- parameter *s* of `.AnnotationBbox.get_fontsize()`
121+
- parameter *label* of `.Tick`

examples/specialty_plots/skewt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_view_interval(self):
5656
# as well as create instances of the custom tick
5757
class SkewXAxis(maxis.XAxis):
5858
def _get_tick(self, major):
59-
return SkewXTick(self.axes, None, '', major=major)
59+
return SkewXTick(self.axes, None, major=major)
6060

6161
def get_view_interval(self):
6262
return self.axes.upper_xlim[0], self.axes.lower_xlim[1]

lib/matplotlib/axis.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ class Tick(martist.Artist):
5353
The right/top tick label.
5454
5555
"""
56-
def __init__(self, axes, loc, label,
56+
@cbook._delete_parameter("3.3", "label")
57+
def __init__(self, axes, loc, label=None,
5758
size=None, # points
5859
width=None,
5960
color=None,
@@ -1877,7 +1878,7 @@ def _get_tick(self, major):
18771878
tick_kw = self._major_tick_kw
18781879
else:
18791880
tick_kw = self._minor_tick_kw
1880-
return XTick(self.axes, 0, '', major=major, **tick_kw)
1881+
return XTick(self.axes, 0, major=major, **tick_kw)
18811882

18821883
def set_label_position(self, position):
18831884
"""
@@ -2173,7 +2174,7 @@ def _get_tick(self, major):
21732174
tick_kw = self._major_tick_kw
21742175
else:
21752176
tick_kw = self._minor_tick_kw
2176-
return YTick(self.axes, 0, '', major=major, **tick_kw)
2177+
return YTick(self.axes, 0, major=major, **tick_kw)
21772178

21782179
def set_label_position(self, position):
21792180
"""

lib/matplotlib/backend_bases.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,13 @@ def set_message(self, s):
26922692
"""Display a message on toolbar or in status bar."""
26932693

26942694
def back(self, *args):
2695-
"""Move back up the view lim stack."""
2695+
"""
2696+
Move back up the view lim stack.
2697+
2698+
For convenience of being directly connected as a GUI callback, which
2699+
often get passed additional parameters, this method accepts arbitrary
2700+
parameters, but does not use them.
2701+
"""
26962702
self._nav_stack.back()
26972703
self.set_history_buttons()
26982704
self._update_view()
@@ -2708,13 +2714,25 @@ def remove_rubberband(self):
27082714
"""Remove the rubberband."""
27092715

27102716
def forward(self, *args):
2711-
"""Move forward in the view lim stack."""
2717+
"""
2718+
Move forward in the view lim stack.
2719+
2720+
For convenience of being directly connected as a GUI callback, which
2721+
often get passed additional parameters, this method accepts arbitrary
2722+
parameters, but does not use them.
2723+
"""
27122724
self._nav_stack.forward()
27132725
self.set_history_buttons()
27142726
self._update_view()
27152727

27162728
def home(self, *args):
2717-
"""Restore the original view."""
2729+
"""
2730+
Restore the original view.
2731+
2732+
For convenience of being directly connected as a GUI callback, which
2733+
often get passed additional parameters, this method accepts arbitrary
2734+
parameters, but does not use them.
2735+
"""
27182736
self._nav_stack.home()
27192737
self.set_history_buttons()
27202738
self._update_view()

lib/matplotlib/offsetbox.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,7 @@ def set_fontsize(self, s=None):
15771577
self.prop = FontProperties(size=s)
15781578
self.stale = True
15791579

1580+
@cbook._delete_parameter("3.3", "s")
15801581
def get_fontsize(self, s=None):
15811582
"""Return the fontsize in points."""
15821583
return self.prop.get_size_in_points()

lib/matplotlib/path.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ def iter_segments(self, transform=None, remove_nans=True, clip=None,
416416
curr_vertices = np.append(curr_vertices, next(vertices))
417417
yield curr_vertices, code
418418

419+
@cbook._delete_parameter("3.3", "quantize")
419420
def cleaned(self, transform=None, remove_nans=False, clip=None,
420421
quantize=False, simplify=False, curves=False,
421422
stroke_width=1.0, snap=False, sketch=None):

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def _get_tick(self, major):
352352
tick_kw = self._major_tick_kw
353353
else:
354354
tick_kw = self._minor_tick_kw
355-
return ThetaTick(self.axes, 0, '', major=major, **tick_kw)
355+
return ThetaTick(self.axes, 0, major=major, **tick_kw)
356356

357357
def _wrap_locator_formatter(self):
358358
self.set_major_locator(ThetaLocator(self.get_major_locator()))
@@ -659,7 +659,7 @@ def _get_tick(self, major):
659659
tick_kw = self._major_tick_kw
660660
else:
661661
tick_kw = self._minor_tick_kw
662-
return RadialTick(self.axes, 0, '', major=major, **tick_kw)
662+
return RadialTick(self.axes, 0, major=major, **tick_kw)
663663

664664
def _wrap_locator_formatter(self):
665665
self.set_major_locator(RadialLocator(self.get_major_locator(),

lib/matplotlib/streamplot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
233233
class StreamplotSet:
234234

235235
def __init__(self, lines, arrows, **kwargs):
236+
if kwargs:
237+
cbook.warn_deprecated(
238+
"3.3", "Passing arbitrary keyword arguments to StreamplotSet "
239+
"is deprecated.")
236240
self.lines = lines
237241
self.arrows = arrows
238242

lib/matplotlib/tests/test_skew.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def get_view_interval(self):
4646
# as well as create instances of the custom tick
4747
class SkewXAxis(maxis.XAxis):
4848
def _get_tick(self, major):
49-
return SkewXTick(self.axes, None, '', major=major)
49+
return SkewXTick(self.axes, None, major=major)
5050

5151
def get_view_interval(self):
5252
return self.axes.upper_xlim[0], self.axes.lower_xlim[1]

0 commit comments

Comments
 (0)