Skip to content

Commit a258d42

Browse files
authored
Merge pull request #22365 from oscargus/animationdeprecationremoval
Remove deprecated `MovieWriter.cleanup`
2 parents 52ac63e + 0dea16a commit a258d42

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Removal of deprecated ``MovieWriter.cleanup``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The cleanup logic is instead fully implemented in `.MovieWriter.finish` and
5+
``cleanup`` is no longer called.

lib/matplotlib/animation.py

+13-26
Original file line numberDiff line numberDiff line change
@@ -334,29 +334,6 @@ def _run(self):
334334

335335
def finish(self):
336336
"""Finish any processing for writing the movie."""
337-
overridden_cleanup = _api.deprecate_method_override(
338-
__class__.cleanup, self, since="3.4", alternative="finish()")
339-
if overridden_cleanup is not None:
340-
overridden_cleanup()
341-
else:
342-
self._cleanup() # Inline _cleanup() once cleanup() is removed.
343-
344-
def grab_frame(self, **savefig_kwargs):
345-
# docstring inherited
346-
_log.debug('MovieWriter.grab_frame: Grabbing frame.')
347-
# Readjust the figure size in case it has been changed by the user.
348-
# All frames must have the same size to save the movie correctly.
349-
self.fig.set_size_inches(self._w, self._h)
350-
# Save the figure data to the sink, using the frame format and dpi.
351-
self.fig.savefig(self._proc.stdin, format=self.frame_format,
352-
dpi=self.dpi, **savefig_kwargs)
353-
354-
def _args(self):
355-
"""Assemble list of encoder-specific command-line arguments."""
356-
return NotImplementedError("args needs to be implemented by subclass.")
357-
358-
def _cleanup(self): # Inline to finish() once cleanup() is removed.
359-
"""Clean-up and collect the process used to write the movie file."""
360337
out, err = self._proc.communicate()
361338
# Use the encoding/errors that universal_newlines would use.
362339
out = TextIOWrapper(BytesIO(out)).read()
@@ -373,9 +350,19 @@ def _cleanup(self): # Inline to finish() once cleanup() is removed.
373350
raise subprocess.CalledProcessError(
374351
self._proc.returncode, self._proc.args, out, err)
375352

376-
@_api.deprecated("3.4")
377-
def cleanup(self):
378-
self._cleanup()
353+
def grab_frame(self, **savefig_kwargs):
354+
# docstring inherited
355+
_log.debug('MovieWriter.grab_frame: Grabbing frame.')
356+
# Readjust the figure size in case it has been changed by the user.
357+
# All frames must have the same size to save the movie correctly.
358+
self.fig.set_size_inches(self._w, self._h)
359+
# Save the figure data to the sink, using the frame format and dpi.
360+
self.fig.savefig(self._proc.stdin, format=self.frame_format,
361+
dpi=self.dpi, **savefig_kwargs)
362+
363+
def _args(self):
364+
"""Assemble list of encoder-specific command-line arguments."""
365+
return NotImplementedError("args needs to be implemented by subclass.")
379366

380367
@classmethod
381368
def bin_path(cls):

0 commit comments

Comments
 (0)