Skip to content

Commit eec341a

Browse files
committed
Remove several unused variables
1 parent 5f7f6a8 commit eec341a

File tree

18 files changed

+18
-38
lines changed

18 files changed

+18
-38
lines changed

doc/sphinxext/redirect_from.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class RedirectFrom(Directive):
9191
def run(self):
9292
redirected_doc, = self.arguments
9393
env = self.app.env
94-
builder = self.app.builder
9594
domain = env.get_domain('redirect_from')
9695
current_doc = env.path2doc(self.state.document.current_source)
9796
redirected_reldoc, _ = env.relfn2path(redirected_doc, current_doc)

examples/event_handling/coords_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def on_move(event):
2929
if event.inaxes:
3030
# get the x and y pixel coords
3131
x, y = event.x, event.y
32-
ax = event.inaxes # the axes instance
3332
print('data coords %f %f, pixel coords %f %f'
3433
% (event.xdata, event.ydata, x, y))
3534

examples/event_handling/pong_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def __init__(self, ax):
190190
animated=False)
191191
self.canvas.mpl_connect('key_press_event', self.on_key_press)
192192

193-
def draw(self, event):
193+
def draw(self):
194194
draw_artist = self.ax.draw_artist
195195
if self.background is None:
196196
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
@@ -318,7 +318,7 @@ def start_anim(event):
318318

319319
def local_draw():
320320
if animation.ax.get_renderer_cache():
321-
animation.draw(None)
321+
animation.draw()
322322
start_anim.timer.add_callback(local_draw)
323323
start_anim.timer.start()
324324
canvas.mpl_connect('draw_event', on_redraw)

lib/matplotlib/_docstring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def some_function(x):
3333
def __init__(self, *args, **kwargs):
3434
if args and kwargs:
3535
raise TypeError("Only positional or keyword args are allowed")
36-
self.params = params = args or kwargs
36+
self.params = args or kwargs
3737

3838
def __call__(self, func):
3939
if func.__doc__:

lib/matplotlib/_layoutgrid.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,7 @@ def seq_id():
507507
return '%06d' % next(_layoutboxobjnum)
508508

509509

510-
def print_children(lb):
511-
"""Print the children of the layoutbox."""
512-
for child in lb.children:
513-
print_children(child)
514-
515-
516-
def plot_children(fig, lg=None, level=0, printit=False):
510+
def plot_children(fig, lg=None, level=0):
517511
"""Simple plotting to show where boxes are."""
518512
import matplotlib.pyplot as plt
519513
import matplotlib.patches as mpatches

lib/matplotlib/backend_managers.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,24 +284,22 @@ def add_tool(self, name, tool, *args, **kwargs):
284284

285285
# If initially toggled
286286
if tool_obj.toggled:
287-
self._handle_toggle(tool_obj, None, None, None)
287+
self._handle_toggle(tool_obj, None, None)
288288
tool_obj.set_figure(self.figure)
289289

290290
event = ToolEvent('tool_added_event', self, tool_obj)
291291
self._callbacks.process(event.name, event)
292292

293293
return tool_obj
294294

295-
def _handle_toggle(self, tool, sender, canvasevent, data):
295+
def _handle_toggle(self, tool, canvasevent, data):
296296
"""
297297
Toggle tools, need to untoggle prior to using other Toggle tool.
298298
Called from trigger_tool.
299299
300300
Parameters
301301
----------
302302
tool : `.ToolBase`
303-
sender : object
304-
Object that wishes to trigger the tool.
305303
canvasevent : Event
306304
Original Canvas event or None.
307305
data : object
@@ -360,7 +358,7 @@ def trigger_tool(self, name, sender=None, canvasevent=None, data=None):
360358
sender = self
361359

362360
if isinstance(tool, backend_tools.ToolToggleBase):
363-
self._handle_toggle(tool, sender, canvasevent, data)
361+
self._handle_toggle(tool, canvasevent, data)
364362

365363
tool.trigger(sender, canvasevent, data) # Actually trigger Tool.
366364

lib/matplotlib/dviread.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ def _read(self):
356356
while True:
357357
byte = self.file.read(1)[0]
358358
self._dtable[byte](self, byte)
359-
name = self._dtable[byte].__name__
360359
if byte == 140: # end of page
361360
return True
362361
if self.state is _dvistate.post_post: # end of file

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ def set_stretch(self, stretch):
890890
return
891891
try:
892892
stretch = int(stretch)
893-
except ValueError as err:
893+
except ValueError:
894894
pass
895895
else:
896896
if 0 <= stretch <= 1000:

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3822,8 +3822,6 @@ def test_errorbar_nan(fig_test, fig_ref):
38223822
es = np.array([4, 5, np.nan, np.nan, 6])
38233823
ax.errorbar(xs, ys, es)
38243824
ax = fig_ref.add_subplot()
3825-
ys = np.array([1, 2, np.nan, np.nan, 3])
3826-
es = np.array([4, 5, np.nan, np.nan, 6])
38273825
ax.errorbar([0, 1], [1, 2], [4, 5])
38283826
ax.errorbar([4], [3], [6], fmt="C0")
38293827

@@ -7787,10 +7785,7 @@ def test_patch_bounds(): # PR 19078
77877785
def test_warn_ignored_scatter_kwargs():
77887786
with pytest.warns(UserWarning,
77897787
match=r"You passed a edgecolor/edgecolors"):
7790-
7791-
c = plt.scatter(
7792-
[0], [0], marker="+", s=500, facecolor="r", edgecolor="b"
7793-
)
7788+
plt.scatter([0], [0], marker="+", s=500, facecolor="r", edgecolor="b")
77947789

77957790

77967791
def test_artist_sublists():

lib/matplotlib/tests/test_backend_qt.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
@pytest.fixture
3131
def qt_core(request):
32-
backend, = request.node.get_closest_marker('backend').args
3332
qt_compat = pytest.importorskip('matplotlib.backends.qt_compat')
3433
QtCore = qt_compat.QtCore
3534

0 commit comments

Comments
 (0)