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

Skip to content

Commit 38b2876

Browse files
committed
Use super() in animation classes.
1 parent 9617ea7 commit 38b2876

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/matplotlib/animation.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ class FileMovieWriter(MovieWriter):
411411
This must be sub-classed to be useful.
412412
"""
413413
def __init__(self, *args, **kwargs):
414-
MovieWriter.__init__(self, *args, **kwargs)
414+
super().__init__(*args, **kwargs)
415415
self.frame_format = mpl.rcParams['animation.frame_format']
416416

417417
@cbook._delete_parameter("3.3", "clear_temp")
@@ -515,10 +515,10 @@ def finish(self):
515515
# Call run here now that all frame grabbing is done. All temp files
516516
# are available to be assembled.
517517
self._run()
518-
MovieWriter.finish(self) # Will call clean-up
518+
super().finish() # Will call clean-up
519519

520520
def cleanup(self):
521-
MovieWriter.cleanup(self)
521+
super().cleanup()
522522
if self._tmpdir:
523523
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
524524
self._tmpdir.cleanup()
@@ -1404,8 +1404,7 @@ def __init__(self, fig, interval=200, repeat_delay=0, repeat=True,
14041404
# sharing timers between animation objects for syncing animations.
14051405
if event_source is None:
14061406
event_source = fig.canvas.new_timer(interval=self._interval)
1407-
Animation.__init__(self, fig, event_source=event_source,
1408-
*args, **kwargs)
1407+
super().__init__(fig, event_source=event_source, *args, **kwargs)
14091408

14101409
def _step(self, *args):
14111410
"""Handler for getting events."""
@@ -1415,7 +1414,7 @@ def _step(self, *args):
14151414
# _repeat_delay is set, change the event_source's interval to our loop
14161415
# delay and set the callback to one which will then set the interval
14171416
# back.
1418-
still_going = Animation._step(self, *args)
1417+
still_going = super()._step(*args)
14191418
if not still_going and self.repeat:
14201419
self._init_draw()
14211420
self.frame_seq = self.new_frame_seq()
@@ -1431,7 +1430,7 @@ def _stop(self, *args):
14311430
# given the potential pause here), remove the loop_delay callback as
14321431
# well.
14331432
self.event_source.remove_callback(self._loop_delay)
1434-
Animation._stop(self)
1433+
super()._stop()
14351434

14361435
def _loop_delay(self, *args):
14371436
# Reset the interval and change callbacks after the delay.
@@ -1473,7 +1472,7 @@ def __init__(self, fig, artists, *args, **kwargs):
14731472
# Use the list of artists as the framedata, which will be iterated
14741473
# over by the machinery.
14751474
self._framedata = artists
1476-
TimedAnimation.__init__(self, fig, *args, **kwargs)
1475+
super().__init__(fig, *args, **kwargs)
14771476

14781477
def _init_draw(self):
14791478
# Make all the artists involved in *any* frame invisible
@@ -1645,7 +1644,7 @@ def iter_frames(frames=frames):
16451644
# Needs to be initialized so the draw functions work without checking
16461645
self._save_seq = []
16471646

1648-
TimedAnimation.__init__(self, fig, **kwargs)
1647+
super().__init__(fig, **kwargs)
16491648

16501649
# Need to reset the saved seq, since right now it will contain data
16511650
# for a single frame from init, which is not what we want.

0 commit comments

Comments
 (0)