Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcdec6b9

Browse files
committed
Prepare inlining MovieWriter.cleanup() into MovieWriter.finish().
The docs only mention `finish()`; but the implementations of `finish()`simply forwards themselves to `cleanup()` (and do a bit more). One caninstead just put all the relevant logic in `finish()` and not expose aseparate (basically internal) API.
1 parent7c813db commitcdec6b9

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``MovieWriter.cleanup`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Cleanup logic is now fully implemented in `.MovieWriter.finish`. Third-party
4+
movie writers should likewise move the relevant cleanup logic there, as
5+
overridden ``cleanup``\s will no longer be called in the future.

‎doc/missing-references.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,15 @@
251251
],
252252
"matplotlib.axes._axes.Axes": [
253253
"doc/api/artist_api.rst:189",
254-
"doc/api/axes_api.rst:617",
254+
"doc/api/axes_api.rst:609",
255255
"lib/matplotlib/projections/polar.py:docstring of matplotlib.projections.polar.PolarAxes:1",
256256
"lib/mpl_toolkits/axes_grid1/mpl_axes.py:docstring of mpl_toolkits.axes_grid1.mpl_axes.Axes:1",
257257
"lib/mpl_toolkits/axisartist/axislines.py:docstring of mpl_toolkits.axisartist.axislines.Axes:1",
258258
"lib/mpl_toolkits/mplot3d/axes3d.py:docstring of mpl_toolkits.mplot3d.axes3d.Axes3D:1"
259259
],
260260
"matplotlib.axes._base._AxesBase": [
261261
"doc/api/artist_api.rst:189",
262-
"doc/api/axes_api.rst:617",
262+
"doc/api/axes_api.rst:609",
263263
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes.Axes:1"
264264
],
265265
"matplotlib.backend_bases.FigureCanvas": [
@@ -831,6 +831,7 @@
831831
"lib/matplotlib/image.py:docstring of matplotlib.image.composite_images:9"
832832
],
833833
"cleanup": [
834+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.setup:18",
834835
"lib/matplotlib/animation.py:docstring of matplotlib.animation.HTMLWriter.setup:18"
835836
],
836837
"colorbar.ColorbarBase.outline": [
@@ -895,7 +896,7 @@
895896
"lib/mpl_toolkits/mplot3d/axes3d.py:docstring of mpl_toolkits.mplot3d.axes3d.Axes3D.get_ylim3d:24"
896897
],
897898
"ipykernel.pylab.backend_inline": [
898-
"doc/users/interactive.rst:256"
899+
"doc/users/interactive.rst:257"
899900
],
900901
"kde.covariance_factor": [
901902
"lib/matplotlib/mlab.py:docstring of matplotlib.mlab.GaussianKDE:41"
@@ -1102,16 +1103,19 @@
11021103
"doc/api/_as_gen/matplotlib.animation.FFMpegWriter.rst:28:<autosummary>:1"
11031104
],
11041105
"matplotlib.animation.FileMovieWriter.args_key": [
1105-
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.cleanup:1:<autosummary>:1"
1106+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.clear_temp:1:<autosummary>:1"
11061107
],
11071108
"matplotlib.animation.FileMovieWriter.bin_path": [
11081109
"doc/api/_as_gen/matplotlib.animation.FileMovieWriter.rst:28:<autosummary>:1"
11091110
],
1111+
"matplotlib.animation.FileMovieWriter.cleanup": [
1112+
"doc/api/_as_gen/matplotlib.animation.FileMovieWriter.rst:28:<autosummary>:1"
1113+
],
11101114
"matplotlib.animation.FileMovieWriter.exec_key": [
1111-
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.cleanup:1:<autosummary>:1"
1115+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.clear_temp:1:<autosummary>:1"
11121116
],
11131117
"matplotlib.animation.FileMovieWriter.frame_size": [
1114-
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.cleanup:1:<autosummary>:1"
1118+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FileMovieWriter.clear_temp:1:<autosummary>:1"
11151119
],
11161120
"matplotlib.animation.FileMovieWriter.isAvailable": [
11171121
"doc/api/_as_gen/matplotlib.animation.FileMovieWriter.rst:28:<autosummary>:1"

‎lib/matplotlib/animation.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,12 @@ def _run(self):
335335

336336
deffinish(self):
337337
"""Finish any processing for writing the movie."""
338-
self.cleanup()
338+
overridden_cleanup=cbook._deprecate_method_override(
339+
__class__.cleanup,self,since="3.4",alternative="finish()")
340+
ifoverridden_cleanupisnotNone:
341+
overridden_cleanup()
342+
else:
343+
self._cleanup()# Inline _cleanup() once cleanup() is removed.
339344

340345
defgrab_frame(self,**savefig_kwargs):
341346
# docstring inherited
@@ -355,7 +360,7 @@ def _args(self):
355360
"""Assemble list of encoder-specific command-line arguments."""
356361
returnNotImplementedError("args needs to be implemented by subclass.")
357362

358-
defcleanup(self):
363+
def_cleanup(self):# Inline to finish() once cleanup() is removed.
359364
"""Clean-up and collect the process used to write the movie file."""
360365
out,err=self._proc.communicate()
361366
self._frame_sink().close()
@@ -374,6 +379,10 @@ def cleanup(self):
374379
raisesubprocess.CalledProcessError(
375380
self._proc.returncode,self._proc.args,out,err)
376381

382+
@_api.deprecated("3.4")
383+
defcleanup(self):
384+
self._cleanup()
385+
377386
@classmethod
378387
defbin_path(cls):
379388
"""
@@ -505,8 +514,8 @@ def finish(self):
505514
self._run()
506515
super().finish()# Will call clean-up
507516

508-
defcleanup(self):
509-
super().cleanup()
517+
def_cleanup(self):# Inline to finish() once cleanup() is removed.
518+
super()._cleanup()
510519
ifself._tmpdir:
511520
_log.debug('MovieWriter: clearing temporary path=%s',self._tmpdir)
512521
self._tmpdir.cleanup()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp