8000 Merge pull request #16092 from anntzer/anim-cleartemp · matplotlib/matplotlib@2699c70 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2699c70

Browse files
authored
Merge pull request #16092 from anntzer/anim-cleartemp
Deprecate clear_temp param/attr of FileMovieWriter.
2 parents aaf140e + 6abad46 commit 2699c70

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-14
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,10 @@ use e.g. ``ax.set_xscale("log", base=10); ax.set_yscale("log", base=2)``.
204204
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205205
This method is deprecated. If you previously reimplemented it in a subclass,
206206
set the artist's picker instead with `.Artist.set_picker`.
207+
208+
*clear_temp* parameter and attribute of `.FileMovieWriter`
209+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
210+
The *clear_temp* parameter and attribute of `.FileMovieWriter` is
211+
deprecated. In the future, files placed in a temporary directory (using
212+
``frame_prefix=None``, the default) will be cleared; files placed elsewhere
213+
will not.

doc/missing-references.json

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@
497497
"doc/users/prev_whats_new/whats_new_2.1.0.rst:409"
498498
],
499499
"matplotlib.test": [
500-
"doc/devel/testing.rst:84"
500+
"doc/devel/testing.rst:79"
501501
],
502502
"matplotlib.testing.conftest.mpl_test_settings": [
503-
"doc/devel/testing.rst:111"
503+
"doc/devel/testing.rst:106"
504504
]
505505
},
506506
"py:meth": {
@@ -624,7 +624,7 @@
624624
"doc/api/prev_api_changes/api_changes_0.91.0.rst:34"
625625
],
626626
"matplotlib.tests.test_basic": [
627-
"doc/devel/testing.rst:98"
627+
"doc/devel/testing.rst:93"
628628
]
629629
},
630630
"py:obj": {
@@ -816,8 +816,7 @@
816816
],
817817
"Timer": [
818818
"lib/matplotlib/backend_bases.py:docstring of matplotlib.backend_bases.FigureCanvasBase.new_timer:2",
819-
"lib/matplotlib/backend_bases.py:docstring of matplotlib.backend_bases.TimerBase:14",
820-
"lib/matplotlib/backends/backend_nbagg.py:docstring of matplotlib.backends.backend_nbagg.FigureCanvasNbAgg.new_timer:2"
819+
"lib/matplotlib/backend_bases.py:docstring of matplotlib.backend_bases.TimerBase:14"
821820
],
822821
"Tool": [
823822
"doc/devel/MEP/MEP22.rst:60",
@@ -1137,25 +1136,28 @@
11371136
"lib/matplotlib/animation.py:docstring of matplotlib.animation.AVConvBase.isAvailable:1:<autosummary>:1"
11381137
],
11391138
"matplotlib.animation.AVConvFileWriter.args_key": [
1140-
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
1139+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
11411140
],
11421141
"matplotlib.animation.AVConvFileWriter.bin_path": [
11431142
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
11441143
],
11451144
"matplotlib.animation.AVConvFileWriter.cleanup": [
11461145
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
11471146
],
1147+
"matplotlib.animation.AVConvFileWriter.clear_temp": [
1148+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
1149+
],
11481150
"matplotlib.animation.AVConvFileWriter.exec_key": [
1149-
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
1151+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
11501152
],
11511153
"matplotlib.animation.AVConvFileWriter.finish": [
11521154
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
11531155
],
11541156
"matplotlib.animation.AVConvFileWriter.frame_format": [
1155-
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
1157+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
11561158
],
11571159
"matplotlib.animation.AVConvFileWriter.frame_size": [
1158-
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
1160+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
11591161
],
11601162
"matplotlib.animation.AVConvFileWriter.grab_frame": [
11611163
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
@@ -1164,7 +1166,7 @@
11641166
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
11651167
],
11661168
"matplotlib.animation.AVConvFileWriter.output_args": [
1167-
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
1169+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
11681170
],
11691171
"matplotlib.animation.AVConvFileWriter.saving": [
11701172
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
@@ -1173,7 +1175,7 @@
11731175
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
11741176
],
11751177
"matplotlib.animation.AVConvFileWriter.supported_formats": [
1176-
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
1178+
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
11771179
],
11781180
"matplotlib.animation.AVConvWriter.args_key": [
11791181
"doc/api/_as_gen/matplotlib.animation.AVConvWriter.rst:36:<autosummary>:1"
@@ -1232,6 +1234,9 @@
12321234
"matplotlib.animation.FFMpegFileWriter.cleanup": [
12331235
"doc/api/_as_gen/matplotlib.animation.FFMpegFileWriter.rst:28:<autosummary>:1"
12341236
],
1237+
"matplotlib.animation.FFMpegFileWriter.clear_temp": [
1238+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FFMpegFileWriter.supported_formats:1:<autosummary>:1"
1239+
],
12351240
"matplotlib.animation.FFMpegFileWriter.exec_key": [
12361241
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FFMpegFileWriter.supported_formats:1:<autosummary>:1"
12371242
],
@@ -1328,6 +1333,9 @@
13281333
"matplotlib.animation.HTMLWriter.cleanup": [
13291334
"doc/api/_as_gen/matplotlib.animation.HTMLWriter.rst:28:<autosummary>:1"
13301335
],
1336+
"matplotlib.animation.HTMLWriter.clear_temp": [
1337+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.HTMLWriter.finish:1:<autosummary>:1"
1338+
],
13311339
"matplotlib.animation.HTMLWriter.exec_key": [
13321340
"lib/matplotlib/animation.py:docstring of matplotlib.animation.HTMLWriter.finish:1:<autosummary>:1"
13331341
],
@@ -1349,6 +1357,9 @@
13491357
"matplotlib.animation.ImageMagickFileWriter.cleanup": [
13501358
"doc/api/_as_gen/matplotlib.animation.ImageMagickFileWriter.rst:28:<autosummary>:1"
13511359
],
1360+
"matplotlib.animation.ImageMagickFileWriter.clear_temp": [
1361+
"lib/matplotlib/animation.py:docstring of matplotlib.animation.ImageMagickFileWriter.supported_formats:1:<autosummary>:1"
1362+
],
13521363
"matplotlib.animation.ImageMagickFileWriter.delay": [
13531364
"lib/matplotlib/animation.py:docstring of matplotlib.animation.ImageMagickFileWriter.supported_formats:1:<autosummary>:1"
13541365
],

lib/matplotlib/animation.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ def __init__(self, *args, **kwargs):
427427
MovieWriter.__init__(self, *args, **kwargs)
428428
self.frame_format = mpl.rcParams['animation.frame_format']
429429

430+
@cbook._delete_parameter("3.3", "clear_temp")
430431
def setup(self, fig, outfile, dpi=None, frame_prefix=None,
431432
clear_temp=True):
432433
"""
@@ -464,11 +465,20 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
464465
else:
465466
self._tmpdir = None
466467
self.temp_prefix = frame_prefix
467-
self.clear_temp = clear_temp
468+
self._clear_temp = clear_temp
468469
self._frame_counter = 0 # used for generating sequential file names
469470
self._temp_paths = list()
470471
self.fname_format_str = '%s%%07d.%s'
471472

473+
@cbook.deprecated("3.3")
474+
@property
475+
def clear_temp(self):
476+
return self._clear_temp
477+
478+
@clear_temp.setter
479+
def clear_temp(self, value):
480+
self._clear_temp = value
481+
472482
@property
473483
def frame_format(self):
474484
"""
@@ -526,7 +536,7 @@ def cleanup(self):
526536
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
527537
self._tmpdir.cleanup()
528538
else:
529-
if self.clear_temp:
539+
if self._clear_temp:
530540
_log.debug('MovieWriter: clearing temporary paths=%s',
531541
self._temp_paths)
532542
for path in self._temp_paths:
@@ -824,7 +834,8 @@ def setup(self, fig, outfile, dpi, frame_dir=None):
824834
else:
825835
frame_prefix = None
826836

827-
super().setup(fig, outfile, dpi, frame_prefix, clear_temp=False)
837+
super().setup(fig, outfile, dpi, frame_prefix)
838+
self._clear_temp = False
828839

829840
def grab_frame(self, **savefig_kwargs):
830841
if self.embed_frames:

0 commit comments

Comments
 (0)
0