8000 Deprecate clear_temp param/attr of FileMovieWriter. · matplotlib/matplotlib@075bcfb · GitHub
[go: up one dir, main page]

Skip to content

Commit 075bcfb

Browse files
committed
Deprecate clear_temp param/attr of FileMovieWriter.
It overlaps in awkward ways with frame_prefix, which effectively provides the same functionality.
1 parent 7c04486 commit 075bcfb

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,10 @@ and containment checks) via `.Line2D.set_picker` is deprecated. Use
150150
The ``on_mappable_changed`` and ``update_bruteforce`` methods of
151151
`~matplotlib.colorbar.Colorbar` are deprecated; both can be replaced by calls
152152
to `~matplotlib.colorbar.Colorbar.update_normal`.
153+
154+
*clear_temp* parameter and attribute of `.FileMovieWriter`
155+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156+
The *clear_temp* parameter and attribute of `.FileMovieWriter` is
157+
deprecated. In the future, files placed in a temporary directory (using
158+
``frame_prefix=None``, the default) will be cleared; files placed elsewhere
159+
will not.

lib/matplotlib/animation.py

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

442+
@cbook._delete_parameter("3.3", "clear_temp")
442443
def setup(self, fig, outfile, dpi=None, frame_prefix=None,
443444
clear_temp=True):
444445
"""
@@ -476,11 +477,20 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
476477
else:
477478
self._tmpdir = None
478479
self.temp_prefix = frame_prefix
479-
self.clear_temp = clear_temp
480+
self._clear_temp = clear_temp
480481
self._frame_counter = 0 # used for generating sequential file names
481482
self._temp_paths = list()
482483
self.fname_format_str = '%s%%07d.%s'
483484

485+
@cbook.deprecated("3.3")
486+
@property
487+
def clear_temp(self):
488+
return self._clear_temp
489+
490+
@clear_temp.setter
491+
def clear_temp(self, value):
492+
self._clear_temp = value
493+
484494
@property
485495
def frame_format(self):
486496
"""
@@ -538,7 +548,7 @@ def cleanup(self):
538548
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
539549
self._tmpdir.cleanup()
540550
else:
541-
if self.clear_temp:
551+
if self._clear_temp:
542552
_log.debug('MovieWriter: clearing temporary paths=%s',
543553
self._temp_paths)
544554
for path in self._temp_paths:
@@ -833,7 +843,8 @@ def setup(self, fig, outfile, dpi, frame_dir=None):
833843
else:
834844
frame_prefix = None
835845

836-
super().setup(fig, outfile, dpi, frame_prefix, clear_temp=False)
846+
super().setup(fig, outfile, dpi, frame_prefix)
847+
self._clear_temp = False
837848

838849
def grab_frame(self, **savefig_kwargs):
839850
if self.embed_frames:

0 commit comments

Comments
 (0)
0