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

Skip to content

Commit 493400d

Browse files
committed
Use super() in blocking input.
1 parent a78721b commit 493400d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

lib/matplotlib/blocking_input.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ def __init__(self, fig,
115115
mouse_add=MouseButton.LEFT,
116116
mouse_pop=MouseButton.RIGHT,
117117
mouse_stop=MouseButton.MIDDLE):
118-
BlockingInput.__init__(self, fig=fig,
119-
eventslist=('button_press_event',
120-
'key_press_event'))
118+
super().__init__(fig=fig,
119+
eventslist=('button_press_event', 'key_press_event'))
121120
self.button_add = mouse_add
122121
self.button_pop = mouse_pop
123122
self.button_stop = mouse_stop
@@ -239,7 +238,7 @@ def pop(self, event, index=-1):
239238
Defaults to the last click.
240239
"""
241240
self.pop_click(event, index)
242-
BlockingInput.pop(self, index)
241+
super().pop(index)
243242

244243
def cleanup(self, event=None):
245244
"""
@@ -255,7 +254,7 @@ def cleanup(self, event=None):
255254
self.marks = []
256255
self.fig.canvas.draw()
257256
# Call base class to remove callbacks.
258-
BlockingInput.cleanup(self)
257+
super().cleanup()
259258

260259
def __call__(self, n=1, timeout=30, show_clicks=True):
261260
"""
@@ -264,7 +263,7 @@ def __call__(self, n=1, timeout=30, show_clicks=True):
264263
self.show_clicks = show_clicks
265264
self.clicks = []
266265
self.marks = []
267-
BlockingInput.__call__(self, n=n, timeout=timeout)
266+
super().__call__(n=n, timeout=timeout)
268267
return self.clicks
269268

270269

@@ -277,7 +276,7 @@ class BlockingContourLabeler(BlockingMouseInput):
277276

278277
def __init__(self, cs):
279278
self.cs = cs
280-
BlockingMouseInput.__init__(self, fig=cs.axes.figure)
279+
super().__init__(fig=cs.axes.figure)
281280

282281
def add_click(self, event):
283282
self.button1(event)
@@ -323,8 +322,7 @@ def button3(self, event):
323322
def __call__(self, inline, inline_spacing=5, n=-1, timeout=-1):
324323
self.inline = inline
325324
self.inline_spacing = inline_spacing
326-
BlockingMouseInput.__call__(self, n=n, timeout=timeout,
327-
show_clicks=False)
325+
super().__call__(n=n, timeout=timeout, show_clicks=False)
328326

329327

330328
class BlockingKeyMouseInput(BlockingInput):
@@ -333,8 +331,8 @@ class BlockingKeyMouseInput(BlockingInput):
333331
"""
334332

335333
def __init__(self, fig):
336-
BlockingInput.__init__(self, fig=fig, eventslist=(
337-
'button_press_event', 'key_press_event'))
334+
super().__init__(fig=fig,
335+
eventslist=('button_press_event', 'key_press_event'))
338336

339337
def post_event(self):
340338
"""Determine if it is a key event."""
@@ -351,6 +349,6 @@ def __call__(self, timeout=30):
351349
timed out.
352350
"""
353351
self.keyormouse = None
354-
BlockingInput.__call__(self, n=1, timeout=timeout)
352+
super().__call__(n=1, timeout=timeout)
355353

356354
return self.keyormouse

0 commit comments

Comments
 (0)